[Checkins] SVN: z3c.form/branches/adamg-objectwidget/src/z3c/form/object.py Make sure that the object of the object widget is returned naked.

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Oct 21 12:22:48 EDT 2008


Log message for revision 92433:
  Make sure that the object of the object widget is returned naked.
  

Changed:
  U   z3c.form/branches/adamg-objectwidget/src/z3c/form/object.py

-=-
Modified: z3c.form/branches/adamg-objectwidget/src/z3c/form/object.py
===================================================================
--- z3c.form/branches/adamg-objectwidget/src/z3c/form/object.py	2008-10-21 16:15:16 UTC (rev 92432)
+++ z3c.form/branches/adamg-objectwidget/src/z3c/form/object.py	2008-10-21 16:22:47 UTC (rev 92433)
@@ -22,7 +22,7 @@
 import zope.schema
 import zope.event
 import zope.lifecycleevent
-
+from zope.security.proxy import removeSecurityProxy
 from z3c.form.converter import BaseDataConverter
 
 from z3c.form import form, interfaces, util, widget
@@ -165,12 +165,14 @@
             zope.event.notify(
                 zope.lifecycleevent.ObjectModifiedEvent(obj,
                     zope.lifecycleevent.Attributes(self.field.schema, *names)))
-        return obj
 
+        # Commonly the widget context is security proxied. This method,
+        # however, should return a bare object, so let's remove the
+        # security proxy now that all fields have been set using the security
+        # mechanism.
+        return removeSecurityProxy(obj)
 
-        return value
 
-
 class ObjectWidget(widget.Widget):
     zope.interface.implements(interfaces.IObjectWidget)
 
@@ -300,4 +302,4 @@
     name = getIfName(for_)
     class temp(FactoryAdapter):
         factory = klass
-    zope.component.provideAdapter(temp, name=name)
\ No newline at end of file
+    zope.component.provideAdapter(temp, name=name)



More information about the Checkins mailing list