[Zope-Checkins]
SVN: Zope/branches/philikon-aq/lib/python/Products/Five/browser/providerexpression.py
We don't need a custom Z2ProviderExpression anymore :)
Hanno Schlichting
plone at hannosch.info
Sun Jul 29 07:17:46 EDT 2007
Log message for revision 78456:
We don't need a custom Z2ProviderExpression anymore :)
Changed:
U Zope/branches/philikon-aq/lib/python/Products/Five/browser/providerexpression.py
-=-
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-29 11:11:27 UTC (rev 78455)
+++ Zope/branches/philikon-aq/lib/python/Products/Five/browser/providerexpression.py 2007-07-29 11:17:46 UTC (rev 78456)
@@ -15,37 +15,12 @@
$Id$
"""
-import zope.component
from zope.contentprovider import interfaces as cp_interfaces
-from zope.contentprovider.tales import addTALNamespaceData
+from zope.contentprovider.tales import TALESProviderExpression
from zope.interface import implements
-from zope.tales.expressions import StringExpr
-class Z2ProviderExpression(StringExpr):
- """Create a custom provider expression which overrides __call__ to
- acquisition wrap the provider so that security lookups can be done."""
+class Z2ProviderExpression(TALESProviderExpression):
+ """This legacy provider was needed before to add acquisition wrappers to
+ the providers in order for security to work."""
implements(cp_interfaces.ITALESProviderExpression)
-
- 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), cp_interfaces.IContentProvider, name)
-
- # Provide a useful error message, if the provider was not found.
- if provider is None:
- raise cp_interfaces.ContentProviderLookupError(name)
-
- # Insert the data gotten from the context
- addTALNamespaceData(provider, econtext)
-
- # Stage 1: Do the state update.
- provider.update()
-
- # Stage 2: Render the HTML content.
- return provider.render()
More information about the Zope-Checkins
mailing list