[Erp5-report] r22053 - /erp5/trunk/products/ERP5/Document/Document.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sun Jun 29 02:04:07 CEST 2008


Author: yo
Date: Sun Jun 29 02:04:06 2008
New Revision: 22053

URL: http://svn.erp5.org?rev=22053&view=rev
Log:
_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.

Modified:
    erp5/trunk/products/ERP5/Document/Document.py

Modified: erp5/trunk/products/ERP5/Document/Document.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Document.py?rev=22053&r1=22052&r2=22053&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Document.py (original)
+++ erp5/trunk/products/ERP5/Document/Document.py Sun Jun 29 02:04:06 2008
@@ -276,13 +276,24 @@
           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(),




More information about the Erp5-report mailing list