From 1edfbbbf9ef7b79a06c483fe22250be45dedf8cc Mon Sep 17 00:00:00 2001 From: Yoshinori Okuji <yo@nexedi.com> Date: Sun, 29 Jun 2008 00:04:06 +0000 Subject: [PATCH] _getExtensibleContent was not working with unrestrictedTraverse, because it provides a fake request as just a plain dict object, thus request.other does not exist, and UserFolder.validate only raises an exception. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22053 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/Document.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/product/ERP5/Document/Document.py b/product/ERP5/Document/Document.py index faa25ef323..747b69bffa 100644 --- a/product/ERP5/Document/Document.py +++ b/product/ERP5/Document/Document.py @@ -276,13 +276,24 @@ class PermanentURLMixIn(ExtensibleTraversableMixIn): try: if request.get('PUBLISHED', _MARKER) is _MARKER: # request['PUBLISHED'] is required by validate - request.other['PUBLISHED'] = self + request['PUBLISHED'] = self has_published = False else: has_published = True - user = user_folder.validate(request) + try: + user = user_folder.validate(request) + except AttributeError: + # This kind of error happens with unrestrictedTraverse, + # because the request object is a fake, and it is just + # a dict object. + user = None if not has_published: - del request.other['PUBLISHED'] + try: + del request.other['PUBLISHED'] + except AttributeError: + # The same here as above. unrestrictedTraverse provides + # just a plain dict, so request.other does not exist. + del request['PUBLISHED'] except: LOG("ERP5 WARNING",0, "Failed to retrieve user in __bobo_traverse__ of WebSection %s" % self.getPath(), -- 2.30.9