[Zope-Checkins] SVN: Zope/trunk/ Revert to the standard Zope 3 provider-expression; this is reasonable and required after the sane acquisition branch has been merged.
Malthe Borch
mborch at gmail.com
Fri Nov 28 09:06:05 EST 2008
Log message for revision 93423:
Revert to the standard Zope 3 provider-expression; this is reasonable and required after the sane acquisition branch has been merged.
Changed:
U Zope/trunk/doc/CHANGES.txt
D Zope/trunk/lib/python/Products/Five/browser/providerexpression.py
U Zope/trunk/lib/python/Products/PageTemplates/Expressions.py
-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt 2008-11-28 12:59:43 UTC (rev 93422)
+++ Zope/trunk/doc/CHANGES.txt 2008-11-28 14:06:04 UTC (rev 93423)
@@ -223,6 +223,11 @@
Bugs Fixed
+ - After the proper introduction of parent-pointers, it's now
+ wrong to acquisition-wrap content providers. We will now use
+ the "classic" content provider expression from Zope
+ 3. [malthe]
+
- Testing.ZopeTestCase: Remove quota argument from DemoStorage calls in
preparation for ZODB 3.9.
Deleted: Zope/trunk/lib/python/Products/Five/browser/providerexpression.py
===================================================================
--- Zope/trunk/lib/python/Products/Five/browser/providerexpression.py 2008-11-28 12:59:43 UTC (rev 93422)
+++ Zope/trunk/lib/python/Products/Five/browser/providerexpression.py 2008-11-28 14:06:04 UTC (rev 93423)
@@ -1,63 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Provider expression.
-"""
-import zope.event
-import zope.interface
-import zope.component
-
-from zope.tales import expressions
-from zope.contentprovider import interfaces, tales
-from zope.location.interfaces import ILocation
-
-from Acquisition.interfaces import IAcquirer
-
-class Z2ProviderExpression(expressions.StringExpr):
- zope.interface.implements(interfaces.ITALESProviderExpression)
-
- # This is mostly a copy of
- # zope.contentprovider.tales.TALESProviderExpression's __call__
- # method.
- def __call__(self, econtext):
- name = super(Z2ProviderExpression, self).__call__(econtext)
- context = econtext.vars['context']
- request = econtext.vars['request']
- view = econtext.vars['view']
-
- # Try to look up the provider.
- provider = zope.component.queryMultiAdapter(
- (context, request, view), interfaces.IContentProvider, name)
-
- # Provide a useful error message, if the provider was not found.
- if provider is None:
- raise interfaces.ContentProviderLookupError(name)
-
- # add the __name__ attribute if it implements ILocation
- if ILocation.providedBy(provider):
- provider.__name__ = name
-
- # ATTN: This is where we are different from
- # TALESProviderExpression: We support Acquisition wrapping.
- if IAcquirer.providedBy(provider):
- provider = provider.__of__(context)
-
- # Insert the data gotten from the context
- tales.addTALNamespaceData(provider, econtext)
-
- # Stage 1: Do the state update.
- zope.event.notify(interfaces.BeforeUpdateEvent(provider, request))
- provider.update()
-
- # Stage 2: Render the HTML content.
- return provider.render()
Modified: Zope/trunk/lib/python/Products/PageTemplates/Expressions.py
===================================================================
--- Zope/trunk/lib/python/Products/PageTemplates/Expressions.py 2008-11-28 12:59:43 UTC (rev 93422)
+++ Zope/trunk/lib/python/Products/PageTemplates/Expressions.py 2008-11-28 14:06:04 UTC (rev 93423)
@@ -36,7 +36,7 @@
from Acquisition import aq_base
from zExceptions import NotFound, Unauthorized
-from Products.Five.browser.providerexpression import Z2ProviderExpression
+from zope.contentprovider.tales import TALESProviderExpression
from Products.PageTemplates import ZRPythonExpr
from Products.PageTemplates.DeferExpr import LazyExpr
from Products.PageTemplates.GlobalTranslationService import getGlobalTranslationService
@@ -334,7 +334,7 @@
e.registerType('not', NotExpr)
e.registerType('defer', DeferExpr)
e.registerType('lazy', LazyExpr)
- e.registerType('provider', Z2ProviderExpression)
+ e.registerType('provider', TALESProviderExpression)
e.registerBaseName('modules', SecureModuleImporter)
return e
More information about the Zope-Checkins
mailing list