Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
5220ac16
Commit
5220ac16
authored
Mar 30, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed to support new Python product registry mechanism
parent
0a4ef9a5
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
56 additions
and
47 deletions
+56
-47
lib/python/OFS/Application.py
lib/python/OFS/Application.py
+26
-28
lib/python/OFS/DTMLDocument.py
lib/python/OFS/DTMLDocument.py
+2
-2
lib/python/OFS/DTMLMethod.py
lib/python/OFS/DTMLMethod.py
+4
-4
lib/python/OFS/Document.py
lib/python/OFS/Document.py
+2
-2
lib/python/OFS/Folder.py
lib/python/OFS/Folder.py
+2
-3
lib/python/OFS/Image.py
lib/python/OFS/Image.py
+1
-3
lib/python/OFS/PropertySheets.py
lib/python/OFS/PropertySheets.py
+3
-1
lib/python/OFS/documentAdd.dtml
lib/python/OFS/documentAdd.dtml
+1
-1
lib/python/OFS/methodAdd.dtml
lib/python/OFS/methodAdd.dtml
+1
-1
lib/python/OFS/misc_.py
lib/python/OFS/misc_.py
+14
-2
No files found.
lib/python/OFS/Application.py
View file @
5220ac16
...
...
@@ -85,8 +85,8 @@
__doc__
=
'''Application support
$Id: Application.py,v 1.9
6 1999/03/26 19:50:37 brian
Exp $'''
__version__
=
'$Revision: 1.9
6
$'
[
11
:
-
2
]
$Id: Application.py,v 1.9
7 1999/03/30 18:09:33 jim
Exp $'''
__version__
=
'$Revision: 1.9
7
$'
[
11
:
-
2
]
import
Globals
,
Folder
,
os
,
regex
,
sys
,
App
.
Product
,
App
.
ProductRegistry
,
misc_
...
...
@@ -101,6 +101,9 @@ from Globals import Persistent
from
FindSupport
import
FindSupport
from
urllib
import
quote
from
cStringIO
import
StringIO
from
AccessControl.PermissionRole
import
PermissionRole
from
App.ProductContext
import
ProductContext
from
misc_
import
Misc_
_standard_error_msg
=
'''
\
...
...
@@ -417,30 +420,40 @@ def install_products(app):
product
=
__import__
(
"Products.%s"
%
product_name
,
global_dict
,
global_dict
,
silly
)
# Set up dynamic project information.
productObject
=
App
.
Product
.
initializeProduct
(
product
,
product_name
,
package_dir
,
app
)
pgetattr
(
product
,
'initialize'
,
lambda
context
:
None
)(
ProductContext
(
productObject
,
app
,
product
))
permissions
=
{}
new_permissions
=
{}
for
permission
,
names
in
pgetattr
(
product
,
'__ac_permissions__'
,
()):
for
p
in
pgetattr
(
product
,
'__ac_permissions__'
,
()):
permission
,
names
,
default
=
(
tuple
(
p
)
+
(
'Manager'
,))[:
3
]
if
names
:
for
name
in
names
:
permissions
[
name
]
=
permission
for
name
in
names
:
permissions
[
name
]
=
permission
elif
not
folder_permissions
.
has_key
(
permission
):
new_permissions
[
permission
]
=
()
for
meta_type
in
pgetattr
(
product
,
'meta_types'
,
()):
if
product_name
==
'OFSP'
:
meta_types
.
insert
(
0
,
meta_type
)
else
:
meta_types
.
append
(
meta_type
)
name
=
meta_type
[
'name'
]
for
name
,
method
in
pgetattr
(
product
,
'methods'
,
{}).
items
():
if
not
hasattr
(
Folder
,
name
):
setattr
(
Folder
,
name
,
method
)
if
name
[
-
9
:]
==
'__roles__'
:
continue
#
Just setting roles
if
(
permissions
.
has_key
(
name
)
and
not
folder_permissions
.
has_key
(
permissions
[
name
])):
permission
=
permissions
[
name
]
if
new_permissions
.
has_key
(
permission
):
new_permissions
[
permission
].
append
(
name
)
else
:
new_permissions
[
permission
]
=
[
name
]
if
name
[
-
9
:]
!=
'__roles__'
:
# not
Just setting roles
if
(
permissions
.
has_key
(
name
)
and
not
folder_permissions
.
has_key
(
permissions
[
name
])):
permission
=
permissions
[
name
]
if
new_permissions
.
has_key
(
permission
):
new_permissions
[
permission
].
append
(
name
)
else
:
new_permissions
[
permission
]
=
[
name
]
if
new_permissions
:
new_permissions
=
new_permissions
.
items
()
...
...
@@ -454,9 +467,6 @@ def install_products(app):
if
type
(
misc_
)
is
DictType
:
misc_
=
Misc_
(
product_name
,
misc_
)
Application
.
misc_
.
__dict__
[
product_name
]
=
misc_
# Set up dynamic project information.
App
.
Product
.
initializeProduct
(
product
,
product_name
,
package_dir
,
app
)
get_transaction
().
note
(
'Installed product '
+
product_name
)
get_transaction
().
commit
()
...
...
@@ -474,15 +484,3 @@ def pgetattr(product, name, default=install_products, __init__=0):
if
default
is
not
install_products
:
return
default
raise
AttributeError
,
name
class
Misc_
:
"Miscellaneous product information"
__roles__
=
None
def
__init__
(
self
,
name
,
dict
):
self
.
_d
=
dict
self
.
__name__
=
name
def
__str__
(
self
):
return
self
.
__name__
def
__getitem__
(
self
,
name
):
return
self
.
_d
[
name
]
lib/python/OFS/DTMLDocument.py
View file @
5220ac16
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""DTML Document objects."""
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
6
$'
[
11
:
-
2
]
from
DocumentTemplate.DT_Util
import
InstanceDict
,
TemplateDict
from
ZPublisher.Converters
import
type_converters
from
Globals
import
HTML
,
HTMLFile
,
MessageDialog
...
...
@@ -192,7 +192,7 @@ This is the <!--#var id--> Document.
addForm
=
HTMLFile
(
'documentAdd'
,
globals
())
def
add
(
self
,
id
,
title
=
''
,
file
=
''
,
REQUEST
=
None
,
submit
=
None
):
def
add
DTMLDocument
(
self
,
id
,
title
=
''
,
file
=
''
,
REQUEST
=
None
,
submit
=
None
):
"""Add a DTML Document object with the contents of file. If
'file' is empty, default document text is used.
"""
...
...
lib/python/OFS/DTMLMethod.py
View file @
5220ac16
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""DTML Method objects."""
__version__
=
'$Revision: 1.1
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
3
$'
[
11
:
-
2
]
from
Globals
import
HTML
,
HTMLFile
,
MessageDialog
from
string
import
join
,
split
,
strip
,
rfind
,
atoi
,
lower
...
...
@@ -101,7 +101,6 @@ class DTMLMethod(cDocument, HTML, Acquisition.Implicit, RoleManager,
"""DTML Method objects are DocumentTemplate.HTML objects that act
as methods of their containers."""
meta_type
=
'DTML Method'
icon
=
'p_/dtmlmethod'
_proxy_roles
=
()
index_html
=
None
# Prevent accidental acquisition
...
...
@@ -359,7 +358,7 @@ the <!--#var title_and_id--> Folder.</P>
addForm=HTMLFile('
methodAdd
', globals())
def add(self, id, title='', file='', REQUEST=None, submit=None):
def add
DTMLMethod
(self, id, title='', file='', REQUEST=None, submit=None):
"""Add a DTML Method object with the contents of file. If
'
file
' is empty, default document text is used.
"""
...
...
@@ -369,7 +368,8 @@ def add(self, id, title='', file='', REQUEST=None, submit=None):
ob.title=title
id=self._setObject(id, ob)
if REQUEST is not None:
u=REQUEST['
URL1
']
if hasattr(self, '
DestinationURL
'): u=self.DestinationURL()
else: u=REQUEST['
URL1
']
if submit==" Add and Edit ": u="%s/%s" % (u,quote(id))
REQUEST.RESPONSE.redirect(u+'
/
manage_main
')
return ''
...
...
lib/python/OFS/Document.py
View file @
5220ac16
...
...
@@ -84,9 +84,9 @@
##############################################################################
"""Deprecated - use DTMLMethod"""
__version__
=
'$Revision: 1.7
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.7
4
$'
[
11
:
-
2
]
import
DTMLMethod
Document
=
DTMLMethod
.
DTMLMethod
manage_addDocument
=
DTMLMethod
.
add
manage_addDocument
=
DTMLMethod
.
add
DTMLMethod
lib/python/OFS/Folder.py
View file @
5220ac16
...
...
@@ -87,9 +87,9 @@
Folders are the basic container objects and are analogous to directories.
$Id: Folder.py,v 1.7
4 1999/03/25 15:46:26
jim Exp $"""
$Id: Folder.py,v 1.7
5 1999/03/30 18:09:33
jim Exp $"""
__version__
=
'$Revision: 1.7
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.7
5
$'
[
11
:
-
2
]
import
Globals
,
SimpleItem
,
Acquisition
,
mimetypes
,
content_types
from
Globals
import
HTMLFile
...
...
@@ -131,7 +131,6 @@ class Folder(ObjectManager, PropertyManager, RoleManager, Collection,
other Principia objects.
"""
meta_type
=
'Folder'
icon
=
'p_/folder'
_properties
=
({
'id'
:
'title'
,
'type'
:
'string'
},)
...
...
lib/python/OFS/Image.py
View file @
5220ac16
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Image object"""
__version__
=
'$Revision: 1.6
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.6
5
$'
[
11
:
-
2
]
import
Globals
,
string
,
struct
,
mimetypes
,
content_types
from
Globals
import
HTMLFile
,
MessageDialog
...
...
@@ -113,7 +113,6 @@ class File(Persistent,Implicit,PropertyManager,
"""A File object is a content object for arbitrary files."""
meta_type
=
'File'
icon
=
'p_/file'
precondition
=
''
manage_editForm
=
HTMLFile
(
'fileEdit'
,
globals
(),
Kind
=
'File'
,
kind
=
'file'
)
...
...
@@ -297,7 +296,6 @@ class Image(File):
that renders an HTML 'IMG' tag.
"""
meta_type
=
'Image'
icon
=
'p_/image'
height
=
0
width
=
0
...
...
lib/python/OFS/PropertySheets.py
View file @
5220ac16
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Property sheets"""
__version__
=
'$Revision: 1.3
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
4
$'
[
11
:
-
2
]
import
time
,
string
,
App
.
Management
,
Globals
from
ZPublisher.Converters
import
type_converters
...
...
@@ -134,6 +134,8 @@ class PropertySheet(Persistent, Implicit):
_properties
=
()
_extensible
=
1
icon
=
'p_/Properties_icon'
def
property_extensible_schema__
(
self
):
return
self
.
_extensible
def
__init__
(
self
,
id
,
md
=
None
):
...
...
lib/python/OFS/documentAdd.dtml
View file @
5220ac16
...
...
@@ -9,7 +9,7 @@ You may create a new DTML Document using the form below.
You may also choose to upload an existing html file from your
local computer by clicking the <I>Browse</I> button.
<FORM ACTION="
manage_
addDTMLDocument" METHOD="POST"
<FORM ACTION="addDTMLDocument" METHOD="POST"
ENCTYPE="multipart/form-data">
<TABLE CELLSPACING="2">
<TR>
...
...
lib/python/OFS/methodAdd.dtml
View file @
5220ac16
...
...
@@ -9,7 +9,7 @@
You may also choose to upload an existing html file from your
local computer by clicking the <I>Browse</I> button.
<FORM ACTION="
manage_
addDTMLMethod" METHOD="POST"
<FORM ACTION="addDTMLMethod" METHOD="POST"
ENCTYPE="multipart/form-data">
<TABLE CELLSPACING="2">
<TR>
...
...
lib/python/OFS/misc_.py
View file @
5220ac16
...
...
@@ -97,11 +97,9 @@ class p_:
image
=
ImageFile
(
'www/Image_icon.gif'
,
globals
())
file
=
ImageFile
(
'www/File_icon.gif'
,
globals
())
dtmldoc
=
doc
=
ImageFile
(
'www/dtmldoc.gif'
,
globals
())
dtmlmethod
=
ImageFile
(
'www/dtmlmethod.gif'
,
globals
())
broken
=
ImageFile
(
'www/broken.gif'
,
globals
())
UserFolder
=
ImageFile
(
'AccessControl/www/UserFolder_icon.gif'
)
User_icon
=
ImageFile
(
'AccessControl/www/User_icon.gif'
)
locked
=
ImageFile
(
'www/modified.gif'
,
globals
())
...
...
@@ -122,3 +120,17 @@ class p_:
PyPoweredSmall_Gif
=
ImageFile
(
'App/www/PythonPoweredSmall.gif'
)
ZopeButton
=
ImageFile
(
'App/www/zope_button.gif'
)
Properties_icon
=
ImageFile
(
'OFS/www/Properties_icon.gif'
)
class
Misc_
:
"Miscellaneous product information"
__roles__
=
None
def
__init__
(
self
,
name
,
dict
):
self
.
_d
=
dict
self
.
__name__
=
name
def
__str__
(
self
):
return
self
.
__name__
def
__getitem__
(
self
,
name
):
return
self
.
_d
[
name
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment