[Zope-Checkins] CVS: Zope/lib/python/OFS - Folder.py:1.100 ObjectManager.py:1.151
Casey Duncan
casey@zope.com
Fri, 7 Jun 2002 14:11:01 -0400
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv5229/lib/python/OFS
Modified Files:
Folder.py ObjectManager.py
Log Message:
Yanked OM browser default implementation for alpha 1, planning on a more modular implementation for alpha 2.
=== Zope/lib/python/OFS/Folder.py 1.99 => 1.100 ===
self._setObject(id, ob)
ob=self._getOb(id)
-
- # Acquire browser_default from parent
- ob.setBrowserDefaultId(acquire=1)
checkPermission=getSecurityManager().checkPermission
@@ -64,7 +61,7 @@
'You are not authorized to add Page Templates.'
)
ob.manage_addProduct['PageTemplates'].manage_addPageTemplate(
- id=ob.getBrowserDefaultId(acquire=1), title='')
+ id='index_html', title='')
if REQUEST is not None:
return self.manage_main(self, REQUEST, update_menu=1)
=== Zope/lib/python/OFS/ObjectManager.py 1.150 => 1.151 ===
)
-class BrowserDefault(Acquisition.Implicit, Persistent):
- """Callable default browser object for object managers. This is made as a
- class so that folderish objs not overriding browser_default can simply
- not define it. We also define this class as replaceable so that TTW
- scripts can override it
- """
- security = ClassSecurityInfo()
-
- __replaceable__ = REPLACEABLE # Allow this to be overridden in instances
-
- def __call__(self, request):
- """Return the proper default method name to be published
- This name is acquired from the parent object"""
- return self.aq_parent, \
- (self.aq_acquire('_object_manager_browser_default_id'),)
-
-default__class_init__(BrowserDefault)
-
class BeforeDeleteException( Exception ): pass # raise to veto deletion
class BreakoutException ( Exception ): pass # raised to break out of loops
@@ -132,10 +114,8 @@
('manage_importObject','manage_importExportForm',
'manage_exportObject')
),
- ('View', ('getBrowserDefaultId',)),
('Manage folderish settings',
- ('manage_settings', 'setBrowserDefaultId',
- 'isBrowserDefaultAcquired','hasCustomBrowserDefault')
+ ('manage_settings',)
),
)
@@ -153,7 +133,6 @@
manage_options=(
{'label':'Contents', 'action':'manage_main',
'help':('OFSP','ObjectManager_Contents.stx')},
- {'label':'Settings', 'action':'manage_settings'},
)
isAnObjectManager=1
@@ -676,73 +655,6 @@
if request.maybe_webdav_client and not method in ('GET', 'POST'):
return NullResource(self, key, request).__of__(self)
raise KeyError, key
-
- #######################################################################
- # Death to index_html implementation (casey)
-
- def setBrowserDefaultId(self, id='', acquire=0, REQUEST=None):
- """Set the id of the browser_default method. If acquire is true
- then the local browser_default is cleared and the setting is
- acquired
- """
- if self.hasCustomBrowserDefault():
- # If a custom browser default is installed, don't override it
- raise BadRequestException, \
- 'Cannot override custom browser default'
-
- if acquire:
- try:
- del self._object_manager_browser_default_id
- except (AttributeError, KeyError):
- pass # If its already gone, so be it
- id = self.aq_acquire('_object_manager_browser_default_id')
- else:
- self._checkId(id, allow_dup=1)
- self._object_manager_browser_default_id = id
-
- if id == 'index_html':
- # This is a small optimization since the publisher stills falls
- # back on this default value if there is no browser_default
- # method at all for bw compatibility
- try:
- del self.browser_default
- except (AttributeError, KeyError):
- pass
- else:
- # Create a browser_default callable
- self.browser_default = BrowserDefault()
-
- if REQUEST:
- REQUEST.RESPONSE.redirect(REQUEST.URL1 +
- '/manage_settings?manage_tabs_message=Settings+Changed')
-
- def getBrowserDefaultId(self, acquire=0):
- """Get the id of the browser_default method. If acquire is true
- then the acquired value is returned if there is no local setting,
- otherwise None is returned. None is also returned if
- browser_default has been overidden in this (or a higher) instance
- using a custom callable.
- """
- if self.hasCustomBrowserDefault():
- return None
- if acquire:
- return self.aq_acquire('_object_manager_browser_default_id')
- else:
- return getattr(self, '_object_manager_browser_default_id', None)
-
- def isBrowserDefaultAcquired(self):
- """Return true if the current browser default is being acquired"""
- return not hasattr(self, '_object_manager_browser_default_id')
-
- def hasCustomBrowserDefault(self):
- """Return true if a custom browser_default object has been
- installed
- """
- try:
- return getattr(self.browser_default, '__class__', None) \
- is not BrowserDefault
- except AttributeError:
- return 0
def findChilds(obj,dirname=''):
""" recursive walk through the object hierarchy to