[Zope-Checkins] CVS: Zope/lib/python/OFS - Application.py:1.157.4.2 ObjectManager.py:1.141.6.4 Traversable.py:1.8.20.3
Shane Hathaway
shane@digicool.com
Fri, 28 Sep 2001 15:10:35 -0400
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv21751
Modified Files:
Tag: ComponentArchitecture-branch
Application.py ObjectManager.py Traversable.py
Log Message:
Used new wrapper attributes to fix a problem with getPhysicalPathOf().
=== Zope/lib/python/OFS/Application.py 1.157.4.1 => 1.157.4.2 ===
Redirect=ZopeRedirect=PrincipiaRedirect
- def __bobo_traverse__(self, REQUEST, name=None):
+## def __bobo_traverse__(self, REQUEST, name=None):
- try: return getattr(self, name)
- except AttributeError: pass
- try: return self[name]
- except KeyError: pass
- method=REQUEST.get('REQUEST_METHOD', 'GET')
- if not method in ('GET', 'POST'):
- return NullResource(self, name, REQUEST).__of__(self)
+## try: return getattr(self, name)
+## except AttributeError: pass
+## try: return self[name]
+## except KeyError: pass
+## method=REQUEST.get('REQUEST_METHOD', 'GET')
+## if not method in ('GET', 'POST'):
+## return NullResource(self, name, REQUEST).__of__(self)
- # Waaa. unrestrictedTraverse calls us with a fake REQUEST.
- # There is proabably a better fix for this.
- try: REQUEST.RESPONSE.notFoundError("%s\n%s" % (name, method))
- except AttributeError:
- raise KeyError, name
+## # Waaa. unrestrictedTraverse calls us with a fake REQUEST.
+## # There is proabably a better fix for this.
+## try: REQUEST.RESPONSE.notFoundError("%s\n%s" % (name, method))
+## except AttributeError:
+## raise KeyError, name
def PrincipiaTime(self, *args):
"""Utility function to return current date/time"""
=== Zope/lib/python/OFS/ObjectManager.py 1.141.6.3 => 1.141.6.4 ===
if info['id'] == id:
r = getattr(self, id)
- if not hasattr(r, 'aq_base'):
+ if aq_base(r) is r:
+ # r is not yet wrapped.
# Part of the contract of _getOb() is to always
# return a wrapped object.
r = ExplicitAcquisitionWrapper(r, self)
+ r.aq_setData('id', id)
return r
# Not a subobject.
if default is _marker:
@@ -725,7 +727,12 @@
try:
subob = getattr(self, name)
except AttributeError:
- raise request.response.notFoundError(request['URL'])
+ try:
+ raise request.response.notFoundError(request['URL'])
+ except AttributeError:
+ # Waaa. unrestrictedTraverse calls us with a fake REQUEST.
+ # There is proabably a better fix for this.
+ raise KeyError, name
if not BrowserPublish.isImplementedBy(subob):
subob = ComponentArchitecture.getPresentation(
subob, '_publish', BrowserPublish, subob) # Lame: use a default
@@ -778,7 +785,7 @@
"""
return getURLOf(self.aq_parent)
- def getName():
+ def getName(self):
"""
"""
return '(p)add' # XXX
=== Zope/lib/python/OFS/Traversable.py 1.8.20.2 => 1.8.20.3 ===
from urllib import quote
-from Acquisition import aq_base, aq_get, aq_inner, aq_parent
+from Acquisition import aq_base, aq_get, aq_inner, aq_parent, aq_getData
_marker=[]
@@ -118,11 +118,15 @@
if getattr(ob, '_isTopLevelApplicationObject', 0):
break
base = aq_base(ob)
- # XXX should be looking for "aq_name" or whatever it will be called.
- if hasattr(base, 'getId'):
- r.append(ob.getId())
- elif hasattr(base, '__name__'):
- r.append(ob.__name__)
+ id = aq_getData(ob, 'id', None)
+ if id is not None:
+ r.append(id)
+ else:
+ # Revert to old ways.
+ if hasattr(base, 'getId'):
+ r.append(ob.getId())
+ elif hasattr(base, '__name__'):
+ r.append(ob.__name__)
if hasattr(base, 'im_self'):
# XXX SECURITY HOLE: im_self can be impersonated.
ob = ob.im_self