[Zope-Checkins] SVN: Zope/branches/philikon-aq/lib/python/ Death to
__of__!
Philipp von Weitershausen
philikon at philikon.de
Fri Jul 27 19:12:14 EDT 2007
Log message for revision 78398:
Death to __of__!
Changed:
U Zope/branches/philikon-aq/lib/python/OFS/Traversable.py
U Zope/branches/philikon-aq/lib/python/Products/Five/browser/metaconfigure.py
U Zope/branches/philikon-aq/lib/python/Products/Five/browser/providerexpression.py
U Zope/branches/philikon-aq/lib/python/Products/Five/browser/resource.py
U Zope/branches/philikon-aq/lib/python/Products/Five/browser/tests/pages.txt
U Zope/branches/philikon-aq/lib/python/Products/Five/form/objectwidget.py
U Zope/branches/philikon-aq/lib/python/Products/Five/viewlet/manager.py
U Zope/branches/philikon-aq/lib/python/ZPublisher/BaseRequest.py
-=-
Modified: Zope/branches/philikon-aq/lib/python/OFS/Traversable.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/OFS/Traversable.py 2007-07-27 23:11:56 UTC (rev 78397)
+++ Zope/branches/philikon-aq/lib/python/OFS/Traversable.py 2007-07-27 23:12:13 UTC (rev 78398)
@@ -192,7 +192,7 @@
if ns:
try:
next = namespaceLookup(
- ns, nm, obj, self.REQUEST).__of__(obj)
+ ns, nm, obj, self.REQUEST)
if restricted and not validate(
obj, obj, name, next):
raise Unauthorized(name)
@@ -260,7 +260,7 @@
Interface, name)
if next is not None:
- next = next.__of__(obj)
+ next = next
if restricted and not validate(obj, obj, name, next):
raise Unauthorized(name)
elif bobo_traverse is not None:
Modified: Zope/branches/philikon-aq/lib/python/Products/Five/browser/metaconfigure.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/Products/Five/browser/metaconfigure.py 2007-07-27 23:11:56 UTC (rev 78397)
+++ Zope/branches/philikon-aq/lib/python/Products/Five/browser/metaconfigure.py 2007-07-27 23:12:13 UTC (rev 78398)
@@ -209,9 +209,9 @@
view = component.queryMultiAdapter((self, request), name=name,
default=None)
if view is not None:
- return view.__of__(self)
+ return view
- m = class_.publishTraverse.__get__(self).__of__(self)
+ m = class_.publishTraverse.__get__(self)
return m(request, name)
else:
@@ -223,7 +223,7 @@
view = component.queryMultiAdapter((self, request), name=name,
default=None)
if view is not None:
- return view.__of__(self)
+ return view
raise NotFoundError(self, name, request)
Modified: Zope/branches/philikon-aq/lib/python/Products/Five/browser/providerexpression.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/Products/Five/browser/providerexpression.py 2007-07-27 23:11:56 UTC (rev 78397)
+++ Zope/branches/philikon-aq/lib/python/Products/Five/browser/providerexpression.py 2007-07-27 23:12:13 UTC (rev 78398)
@@ -41,11 +41,6 @@
if provider is None:
raise cp_interfaces.ContentProviderLookupError(name)
- # Wrap the content provider's in its __parent__, whatever that
- # may be (typically the view).
- if getattr(provider, '__of__', None) is not None:
- provider = provider.__of__(provider.__parent__)
-
# Insert the data gotten from the context
addTALNamespaceData(provider, econtext)
Modified: Zope/branches/philikon-aq/lib/python/Products/Five/browser/resource.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/Products/Five/browser/resource.py 2007-07-27 23:11:56 UTC (rev 78397)
+++ Zope/branches/philikon-aq/lib/python/Products/Five/browser/resource.py 2007-07-27 23:12:13 UTC (rev 78398)
@@ -18,7 +18,6 @@
import os
import urllib
-import Acquisition
from OFS.Traversable import Traversable as OFSTraversable
from zope.app.publisher.browser.resources import empty
from zope.app.publisher.fileresource import File, Image
@@ -28,12 +27,11 @@
from zope.component.interfaces import IResource
from zope.datetime import time as timeFromDateTimeString
from zope.traversing.browser.interfaces import IAbsoluteURL
-
from Products.Five.browser import BrowserView
_marker = []
-class Resource(Acquisition.Explicit):
+class Resource(object):
"""A publishable resource
"""
implements(IResource)
@@ -63,7 +61,7 @@
"""Rendered content"""
# ZPublisher might have called setBody with an incorrect URL
# we definitely don't want that if we are plain html
- self.request.RESPONSE.setBase(None)
+ self.request.response.setBase(None)
pt = self.context
return pt(self.request)
@@ -229,11 +227,7 @@
resource = factory(name, filename)(self.request)
resource.__name__ = name
resource.__parent__ = self
- # XXX __of__ wrapping is usually done on traversal.
- # However, we don't want to subclass Traversable (or do we?)
- # The right thing should probably be a specific (and very simple)
- # traverser that does __getitem__ and __of__.
- return resource.__of__(self)
+ return resource
class DirectoryResourceFactory(ResourceFactory):
Modified: Zope/branches/philikon-aq/lib/python/Products/Five/browser/tests/pages.txt
===================================================================
--- Zope/branches/philikon-aq/lib/python/Products/Five/browser/tests/pages.txt 2007-07-27 23:11:56 UTC (rev 78397)
+++ Zope/branches/philikon-aq/lib/python/Products/Five/browser/tests/pages.txt 2007-07-27 23:12:13 UTC (rev 78398)
@@ -221,7 +221,6 @@
Wrap into an acquisition so that imPermissionRole objects can be
evaluated. __roles__ is a imPermissionRole object:
- >>> view = view.__of__(self.folder.testoid)
>>> view_roles = getattr(view, '__roles__', None)
>>> view_roles
('Manager',)
Modified: Zope/branches/philikon-aq/lib/python/Products/Five/form/objectwidget.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/Products/Five/form/objectwidget.py 2007-07-27 23:11:56 UTC (rev 78397)
+++ Zope/branches/philikon-aq/lib/python/Products/Five/form/objectwidget.py 2007-07-27 23:12:13 UTC (rev 78398)
@@ -22,23 +22,20 @@
$Id$
"""
-import Acquisition
import zope.app.form.browser.objectwidget
from AccessControl import ClassSecurityInfo
from Globals import InitializeClass as initializeClass
-from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile
+from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
-class ObjectWidgetView(Acquisition.Explicit,
- zope.app.form.browser.objectwidget.ObjectWidgetView):
+class ObjectWidgetView(zope.app.form.browser.objectwidget.ObjectWidgetView):
security = ClassSecurityInfo()
security.declareObjectPublic()
- template = ZopeTwoPageTemplateFile('objectwidget.pt')
+ template = ViewPageTemplateFile('objectwidget.pt')
initializeClass(ObjectWidgetView)
-class ObjectWidgetClass(Acquisition.Explicit,
- zope.app.form.browser.objectwidget.ObjectWidget):
+class ObjectWidgetClass(zope.app.form.browser.objectwidget.ObjectWidget):
def __init__(self, context, request, factory, **kw):
super(ObjectWidgetClass, self).__init__(context, request, factory, **kw)
@@ -58,8 +55,4 @@
val = self.context.schema[name].default
self.getSubWidget(name).setRenderedValue(val)
-def ObjectWidget(context, request, factory, **kw):
- """Return an ObjectWidget suitable in the Five environment, with
- right acquisition context"""
- return ObjectWidgetClass(context, request, factory, **kw
- ).__of__(context.context)
+ObjectWidget = ObjectWidetClass
Modified: Zope/branches/philikon-aq/lib/python/Products/Five/viewlet/manager.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/Products/Five/viewlet/manager.py 2007-07-27 23:11:56 UTC (rev 78397)
+++ Zope/branches/philikon-aq/lib/python/Products/Five/viewlet/manager.py 2007-07-27 23:12:13 UTC (rev 78398)
@@ -41,9 +41,6 @@
raise zope.component.interfaces.ComponentLookupError(
'No provider with name `%s` found.' %name)
- # Wrap the viewlet for security lookups
- viewlet = viewlet.__of__(viewlet.context)
-
# If the viewlet cannot be accessed, then raise an
# unauthorized error
if not guarded_hasattr(viewlet, 'render'):
@@ -65,8 +62,6 @@
# the object has a real context from which to determine owner
# security.
for name, viewlet in viewlets:
- if getattr(viewlet, '__of__', None) is not None:
- viewlet = viewlet.__of__(viewlet.__parent__)
if guarded_hasattr(viewlet, 'render'):
results.append((name, viewlet))
return results
Modified: Zope/branches/philikon-aq/lib/python/ZPublisher/BaseRequest.py
===================================================================
--- Zope/branches/philikon-aq/lib/python/ZPublisher/BaseRequest.py 2007-07-27 23:11:56 UTC (rev 78397)
+++ Zope/branches/philikon-aq/lib/python/ZPublisher/BaseRequest.py 2007-07-27 23:12:13 UTC (rev 78398)
@@ -95,7 +95,7 @@
request.response.setStatus(200)
# We don't need to do the docstring security check
# for views, so lets skip it and return the object here.
- return subobject.__of__(object)
+ return subobject
# No view found. Reraise the error raised by __bobo_traverse__
raise e
else:
@@ -105,9 +105,10 @@
subobject = getattr(object, name)
else:
# We try to fall back to a view:
- subobject = queryMultiAdapter((object, request), Interface, name)
+ subobject = queryMultiAdapter((object, request), Interface,
+ name)
if subobject is not None:
- return subobject.__of__(object)
+ return subobject
# And lastly, of there is no view, try acquired attributes, but
# only if there is no __bobo_traverse__:
@@ -311,9 +312,8 @@
ob2 = namespaceLookup(ns, nm, ob, self)
except TraversalError:
raise KeyError(ob, name)
+ return ob2
- return ob2.__of__(ob)
-
if name == '.':
return ob
More information about the Zope-Checkins
mailing list