Commit f2a7d664 authored by Jim Fulton's avatar Jim Fulton

Cleaned up some redundant (confusing) permission settings.

Fixed bug in something you don't want to know about. ;)

BACKWARD INCOMPATIBLE CHANGE in instance creation!

  - Previously, the __call__ method was an alias for the index_html method
    which took took an id and a request and created a new instance and
    added the instance to the destination.

  - Now, the __call__ method simply calls the underlying managed class
    with the supplied arguments to create and return an instance.  The
    instance is not added to a folder.

    The index_html method is now an alias for the
    createInObjectManager method, which does what the index_html method did
    before.

  - There is a new method, fromRequest, that takes an id and a request and
    creates a new instance.  It does not at the instance to a destination.
parent 23d3b86c
......@@ -179,8 +179,6 @@ class ZClass(OFS.SimpleItem.SimpleItem):
isPrincipiaFolderish=1
__ac_permissions__=(
('View management screens', ('manage_tabs', 'manage_workspace')),
('Change permissions', ('manage_access',) ),
('View', ('', '__call__', 'index_html') ),
)
......@@ -269,7 +267,7 @@ class ZClass(OFS.SimpleItem.SimpleItem):
self._p_jar.exchange(self.propertysheets.__class__,
copy.propertysheets.__class__)
self._zbases=bases
self._zbases=copy._zbases
def manage_options(self):
r=[]
......@@ -285,7 +283,7 @@ class ZClass(OFS.SimpleItem.SimpleItem):
manage_options=ComputedAttribute(manage_options)
def index_html(self, id, REQUEST, RESPONSE=None):
def createInObjectManager(self, id, REQUEST, RESPONSE=None):
"""
Create Z instance. If called with a RESPONSE,
the RESPONSE will be redirected to the management
......@@ -313,8 +311,16 @@ class ZClass(OFS.SimpleItem.SimpleItem):
else:
return getattr(folder, id)
index_html=createInObjectManager
__call__=index_html
def fromRequest(self, id=None, REQUEST={}):
i=mapply(self._zclass_, (), REQUEST)
if id is not None and (not hasattr(i, 'id') or not i.id): i.id=id
return i
def __call__(self, *args, **kw):
return apply(self._zclass_, args, kw)
def zclass_candidate_view_actions(self):
r={}
......@@ -462,7 +468,7 @@ addDefault="""<HTML>
to initialize the object.
<!--#/comment-->
<!--#with "%(id)s(REQUEST['id'], REQUEST)"-->
<!--#with "%(id)s.createInObjectManager(REQUEST['id'], REQUEST)"-->
<!--#comment-->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment