Commit 3420457b authored by Hanno Schlichting's avatar Hanno Schlichting

We don't need a custom Z2ProviderExpression anymore :)

parent 60f2b77e
...@@ -15,37 +15,12 @@ ...@@ -15,37 +15,12 @@
$Id$ $Id$
""" """
import zope.component
from zope.contentprovider import interfaces as cp_interfaces 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.interface import implements
from zope.tales.expressions import StringExpr
class Z2ProviderExpression(StringExpr): class Z2ProviderExpression(TALESProviderExpression):
"""Create a custom provider expression which overrides __call__ to """This legacy provider was needed before to add acquisition wrappers to
acquisition wrap the provider so that security lookups can be done.""" the providers in order for security to work."""
implements(cp_interfaces.ITALESProviderExpression) 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()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment