[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Publisher/Browser - metaConfigure.py:1.1.2.5
Jim Fulton
jim@zope.com
Tue, 4 Jun 2002 16:00:38 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/Publisher/Browser
In directory cvs.zope.org:/tmp/cvs-serv26888
Modified Files:
Tag: Zope3InWonderland-branch
metaConfigure.py
Log Message:
Included __getitem__ and browserDefault in allowable attributes for
simple templates.
Added code to get the full template file name. (So the template
wouldn't appear to come from this package.)
=== Zope3/lib/python/Zope/App/Publisher/Browser/metaConfigure.py 1.1.2.4 => 1.1.2.5 ===
type = IBrowserPresentation
+ default_allowed_attributes = '__call__'
def __init__(self, _context, factory, name=None, layer='default',
permission=None,
@@ -125,7 +126,7 @@
if ((not allowed_attributes) and (allowed_interface is None)
and (not self.pages)):
- allowed_attributes = "__call__"
+ allowed_attributes = self.default_allowed_attributes
require={}
for name in (allowed_attributes or '').split():
@@ -150,7 +151,12 @@
def _proxyFactory(self, factory, checker):
def proxyView(request,
factory=factory, checker=checker):
- return Proxy(factory(request), checker)
+ resource = factory(request)
+
+ # We need this in case the resource gets unwrapped and needs to be rewrapped
+ resource.__Security_checker__ = checker
+
+ return Proxy(resource, checker)
return proxyView
@@ -167,7 +173,13 @@
raise ConfigurationError(
"Must specify name for template view")
+ self.default_allowed_attributes = (
+ '__call__ __getitem__ browserDefault')
+
+ template = _context.path(template)
+
self.template = template
+
if for_ is not None:
for_ = _context.resolve(for_)
self.for_ = for_
@@ -237,7 +249,13 @@
def proxyView(context, request,
factory=factory[-1], checker=checker):
- return Proxy(factory(context, request), checker)
+
+ view = factory(context, request)
+
+ # We need this in case the resource gets unwrapped and needs to be rewrapped
+ view.__Security_checker__ = checker
+
+ return Proxy(view, checker)
factory[-1] = proxyView