[Checkins] SVN: zope3org/trunk/src/zorg/multiform/ fixed proxy TODO: checker implementation

Bernd Dorn bernd.dorn at fhv.at
Tue Apr 11 10:38:18 EDT 2006


Log message for revision 66853:
  fixed proxy TODO: checker implementation

Changed:
  U   zope3org/trunk/src/zorg/multiform/configure.zcml
  U   zope3org/trunk/src/zorg/multiform/selection.py

-=-
Modified: zope3org/trunk/src/zorg/multiform/configure.zcml
===================================================================
--- zope3org/trunk/src/zorg/multiform/configure.zcml	2006-04-11 14:16:20 UTC (rev 66852)
+++ zope3org/trunk/src/zorg/multiform/configure.zcml	2006-04-11 14:38:18 UTC (rev 66853)
@@ -7,6 +7,7 @@
                zope.formlib.interfaces.IForm"
           provides=".interfaces.IFormLocation"
           factory=".selection.FormLocationProxy"
+          trusted="true"
           />
 
  <adapter for=".interfaces.IFormLocation"

Modified: zope3org/trunk/src/zorg/multiform/selection.py
===================================================================
--- zope3org/trunk/src/zorg/multiform/selection.py	2006-04-11 14:16:20 UTC (rev 66852)
+++ zope3org/trunk/src/zorg/multiform/selection.py	2006-04-11 14:38:18 UTC (rev 66853)
@@ -4,6 +4,8 @@
 from zope.app.decorator import DecoratorSpecificationDescriptor
 from zope.app.decorator import DecoratedSecurityCheckerDescriptor
 from zope.app.location import location
+from zope.security.checker import NamesChecker,defineChecker
+from zope.security.proxy import removeSecurityProxy
 
 class FormLocationSelection(object):
 
@@ -39,12 +41,15 @@
         self.context = context
 
     def _setSelected(self,v):
-        key = '_mf_selection.' + self.context.__form__.prefix
-        self.context.__form__.request.form[key]=v
+        key = '_mf_selection.' + removeSecurityProxy(
+            self.context.__form__).prefix
+        removeSecurityProxy(self.context.__form__).request.form[key]=v
 
     def _getSelected(self):
-        key = '_mf_selection.' + self.context.__form__.prefix
-        return self.context.__form__.request.form.get(key,False)
+        key = '_mf_selection.' + removeSecurityProxy(
+            self.context.__form__).prefix
+        return removeSecurityProxy(
+            self.context.__form__).request.form.get(key,False)
 
     selected = property(_getSelected ,_setSelected)
         
@@ -53,6 +58,9 @@
 
     __doc__ = """Form Location-object proxy
 
+    XXX the attributes of the form are not available because of a
+    security proxy issue
+
     This is a non-picklable proxy that can be put around objects that
     implement `ILocation`.
 
@@ -119,4 +127,8 @@
 
     __Security_checker__ = DecoratedSecurityCheckerDescriptor()
 
+formLocationChecker = NamesChecker(['__form__'])
+defineChecker(FormLocationProxy, formLocationChecker)
 
+
+



More information about the Checkins mailing list