[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/form/browser/ Remove
LocationProxy from the EditView, EditWizardView and DisplayView.
Roger Ineichen
roger at projekt01.ch
Tue Mar 8 20:43:58 EST 2005
Log message for revision 29418:
Remove LocationProxy from the EditView, EditWizardView and DisplayView.
I saw also a comment in the method action() of the class Adding
in the file zope.app.container.browser.adding.py which describes the
bug.
# TODO: If the factory wrapped by LocationProxy is already a Proxy,
# then ProxyFactory does not do the right thing and the
# original's checker info gets lost. No factory that was
# registered via ZCML and was used via addMenuItem worked
# here. (SR)
In some situation we got exactly this empty checker. This raises a
error in the canWrite() method used in the setupEditWidget() method.
Changed:
U Zope3/trunk/src/zope/app/form/browser/editview.py
U Zope3/trunk/src/zope/app/form/browser/editwizard.py
U Zope3/trunk/src/zope/app/form/browser/schemadisplay.py
-=-
Modified: Zope3/trunk/src/zope/app/form/browser/editview.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/editview.py 2005-03-08 10:16:43 UTC (rev 29417)
+++ Zope3/trunk/src/zope/app/form/browser/editview.py 2005-03-09 01:43:58 UTC (rev 29418)
@@ -30,8 +30,6 @@
from zope.app.event.objectevent import ObjectModifiedEvent
from zope.app.i18n import ZopeMessageIDFactory as _
from zope.app.form.interfaces import WidgetsError
-from zope.app.location.interfaces import ILocation
-from zope.app.location import LocationProxy
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
from zope.app.publisher.browser import BrowserView
@@ -65,12 +63,7 @@
self._setUpWidgets()
def _setUpWidgets(self):
- adapted = self.schema(self.context)
- if adapted is not self.context:
- if not ILocation.providedBy(adapted):
- adapted = LocationProxy(adapted)
- adapted.__parent__ = self.context
- self.adapted = adapted
+ self.adapted = self.schema(self.context)
setUpEditWidgets(self, self.schema, source=self.adapted,
names=self.fieldNames)
Modified: Zope3/trunk/src/zope/app/form/browser/editwizard.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/editwizard.py 2005-03-08 10:16:43 UTC (rev 29417)
+++ Zope3/trunk/src/zope/app/form/browser/editwizard.py 2005-03-09 01:43:58 UTC (rev 29418)
@@ -24,10 +24,6 @@
from zope.event import notify
from zope.app.event.objectevent import ObjectModifiedEvent
from zope.app.i18n import ZopeMessageIDFactory as _
-from zope.app.location.interfaces import ILocation
-from zope.app.location import LocationProxy
-
-
from zope.app.pagetemplate.simpleviewclass import SimpleViewClass
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
@@ -62,19 +58,14 @@
class EditWizardView(EditView):
def _setUpWidgets(self):
- adapted = self.schema(self.context)
- if adapted is not self.context:
- if not ILocation.providedBy(adapted):
- adapted = LocationProxy(adapted)
- adapted.__parent__ = self.context
- self.adapted = adapted
+ self.adapted = self.schema(self.context)
if self.use_session:
# Need session for File upload fields
raise NotImplementedError, \
'Cannot be implemented until we have an ISessionDataManager'
else:
- self.storage = WizardStorage(self.fieldNames, adapted)
+ self.storage = WizardStorage(self.fieldNames, self.adapted)
# Add all our widgets as attributes on this view
setUpWidgets(self, self.schema, IInputWidget, initial=self.storage,
Modified: Zope3/trunk/src/zope/app/form/browser/schemadisplay.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/schemadisplay.py 2005-03-08 10:16:43 UTC (rev 29417)
+++ Zope3/trunk/src/zope/app/form/browser/schemadisplay.py 2005-03-09 01:43:58 UTC (rev 29418)
@@ -23,8 +23,6 @@
from zope.security.checker import defineChecker, NamesChecker
from zope.app import zapi
-from zope.app.location.interfaces import ILocation
-from zope.app.location import LocationProxy
from zope.app.publisher.browser import BrowserView
from zope.app.form.utility import setUpDisplayWidgets
@@ -50,13 +48,8 @@
self._setUpWidgets()
def _setUpWidgets(self):
- adapted = self.schema(self.context)
- if adapted is not self.context:
- if not ILocation.providedBy(adapted):
- adapted = LocationProxy(adapted)
- adapted.__parent__ = self.context
- self.adapted = adapted
- setUpDisplayWidgets(self, self.schema, source=adapted,
+ self.adapted = self.schema(self.context)
+ setUpDisplayWidgets(self, self.schema, source=self.adapted,
names=self.fieldNames)
def setPrefix(self, prefix):
More information about the Zope3-Checkins
mailing list