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
916da7f9
Commit
916da7f9
authored
Mar 28, 2002
by
Casey Duncan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge ZClass constructor spruce up changes
parent
35f0fe58
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
54 deletions
+37
-54
doc/CHANGES.txt
doc/CHANGES.txt
+4
-0
lib/python/Products/ZCatalog/__init__.py
lib/python/Products/ZCatalog/__init__.py
+2
-2
lib/python/ZClasses/ZClass.py
lib/python/ZClasses/ZClass.py
+31
-52
No files found.
doc/CHANGES.txt
View file @
916da7f9
...
@@ -8,6 +8,10 @@ Zope Changes
...
@@ -8,6 +8,10 @@ Zope Changes
new Features:
new Features:
- ZClasses now use a python script as their constructor method
instead of a DTML method. Also, ZClasses inherit from
CatalogPathAwareness now instead of CatalogAwareness.
- added browser_default hook to ZPublisher. This allows objects to
- added browser_default hook to ZPublisher. This allows objects to
specify the path to the default method that the publisher calls
specify the path to the default method that the publisher calls
when the object is published. The default for objects not defining
when the object is published. The default for objects not defining
...
...
lib/python/Products/ZCatalog/__init__.py
View file @
916da7f9
...
@@ -13,13 +13,13 @@
...
@@ -13,13 +13,13 @@
"""ZCatalog product"""
"""ZCatalog product"""
import
ZCatalog
,
Catalog
,
CatalogAwareness
,
ZClasses
import
ZCatalog
,
Catalog
,
Catalog
Path
Awareness
,
ZClasses
from
Products.PluginIndexes.TextIndex
import
Vocabulary
from
Products.PluginIndexes.TextIndex
import
Vocabulary
from
ZClasses
import
createZClassForBase
from
ZClasses
import
createZClassForBase
createZClassForBase
(
ZCatalog
.
ZCatalog
,
globals
()
createZClassForBase
(
ZCatalog
.
ZCatalog
,
globals
()
,
'ZCatalogBase'
,
'ZCatalog'
)
,
'ZCatalogBase'
,
'ZCatalog'
)
createZClassForBase
(
CatalogAwareness
.
CatalogAware
,
globals
()
createZClassForBase
(
Catalog
Path
Awareness
.
CatalogAware
,
globals
()
,
'CatalogAwareBase'
,
'CatalogAware'
)
,
'CatalogAwareBase'
,
'CatalogAware'
)
def
initialize
(
context
):
def
initialize
(
context
):
...
...
lib/python/ZClasses/ZClass.py
View file @
916da7f9
...
@@ -19,6 +19,7 @@ from ZPublisher.mapply import mapply
...
@@ -19,6 +19,7 @@ from ZPublisher.mapply import mapply
from
ExtensionClass
import
Base
from
ExtensionClass
import
Base
from
App.FactoryDispatcher
import
FactoryDispatcher
from
App.FactoryDispatcher
import
FactoryDispatcher
from
ComputedAttribute
import
ComputedAttribute
from
ComputedAttribute
import
ComputedAttribute
from
Products.PythonScripts.PythonScript
import
PythonScript
import
webdav.Collection
import
webdav.Collection
import
marshal
import
marshal
...
@@ -153,11 +154,9 @@ def manage_addZClass(self, id, title='', baseclasses=[],
...
@@ -153,11 +154,9 @@ def manage_addZClass(self, id, title='', baseclasses=[],
id
+
' constructor input form'
,
id
+
' constructor input form'
,
addFormDefault
%
{
'id'
:
id
,
'meta_type'
:
meta_type
},
addFormDefault
%
{
'id'
:
id
,
'meta_type'
:
meta_type
},
)
)
self
.
manage_addDTMLMethod
(
constScript
=
PythonScript
(
id
+
'_add'
)
id
+
'_add'
,
constScript
.
write
(
addDefault
%
{
'id'
:
id
,
'title'
:
id
+
' constructor'
})
id
+
' constructor'
,
self
.
_setObject
(
constScript
.
getId
(),
constScript
)
addDefault
%
{
'id'
:
id
},
)
self
.
manage_addPermission
(
self
.
manage_addPermission
(
id
+
'_add_permission'
,
id
+
'_add_permission'
,
id
+
' constructor permission'
,
id
+
' constructor permission'
,
...
@@ -705,51 +704,31 @@ addFormDefault="""<HTML>
...
@@ -705,51 +704,31 @@ addFormDefault="""<HTML>
</body></html>
</body></html>
"""
"""
addDefault
=
"""<HTML>
addDefault
=
"""## Script (Python) "%(id)s_add"
<HEAD><TITLE>Add %(id)s</TITLE></HEAD>
##bind container=container
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
##bind context=context
##bind namespace=
<dtml-comment> We add the new object by calling the class in
##bind script=script
a with tag. Not only does this get the thing
##bind subpath=traverse_subpath
added, it adds the new thing's attributes to
##parameters=redirect=1
the DTML name space, so we can call methods
##title=%(title)s
to initialize the object.
##
</dtml-comment>
# Add a new instance of the ZClass
request = context.REQUEST
<dtml-with "%(id)s.createInObjectManager(REQUEST['id'], REQUEST)">
instance = container.%(id)s.createInObjectManager(request['id'], request)
<dtml-comment>
# *****************************************************************
# Perform any initialization of the new instance here.
You can add code that modifies the new instance here.
# For example, to update a property sheet named "Basic" from the
# form values, uncomment the following line of code:
For example, if you have a property sheet that you want to update
# instance.propertysheets.Basic.manage_editProperties(request)
from form values, you can call it here:
# *****************************************************************
<dtml-call "propertysheets.Basic.manage_editProperties(
if redirect:
REQUEST)">
# redirect to the management view of the instance's container
request.RESPONSE.redirect(instance.aq_parent.absolute_url() + '/manage_main')
</dtml-comment>
else:
# If we aren't supposed to redirect (ie, we are called from a script)
</dtml-with>
# then just return the ZClass instance to the caller
return instance
<dtml-comment> Now we need to return something. We do this via
a redirect so that the URL is correct.
Unfortunately, the way we do this depends on
whether we live in a product or in a class.
If we live in a product, we need to use DestinationURL
to decide where to go. If we live in a class,
DestinationURL won't be available, so we use URL2.
</dtml-comment>
<dtml-if DestinationURL>
<dtml-call "RESPONSE.redirect(
DestinationURL+'/manage_workspace')">
<dtml-else>
<dtml-call "RESPONSE.redirect(
URL2+'/manage_workspace')">
</dtml-if>
</body></html>
"""
"""
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