[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/ Bugfix,
Roger Ineichen
roger at projekt01.ch
Fri Sep 9 21:59:08 EDT 2005
Log message for revision 38437:
Bugfix,
make pagelet locatable, so that local authentication utilities
are recognized for check the permission.
Fix ftest in pagelet demo where didn't check this correct.
Changed:
U Zope3/trunk/src/zope/app/demo/pagelet/ftests.py
U Zope3/trunk/src/zope/app/pagelet/collector.py
U Zope3/trunk/src/zope/app/pagelet/interfaces.py
U Zope3/trunk/src/zope/app/pagelet/metaconfigure.py
-=-
Modified: Zope3/trunk/src/zope/app/demo/pagelet/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/demo/pagelet/ftests.py 2005-09-09 21:41:29 UTC (rev 38436)
+++ Zope3/trunk/src/zope/app/demo/pagelet/ftests.py 2005-09-10 01:59:07 UTC (rev 38437)
@@ -65,7 +65,7 @@
# As zope.Manager we see both pagelets
self.assert_(body.find('Macro: demo_pagelet_macro') != -1)
- self.assert_(body.find('demo_pagelet_macro2') == -1)
+ self.assert_(body.find('demo_pagelet_macro2') != -1)
def test_suite():
Modified: Zope3/trunk/src/zope/app/pagelet/collector.py
===================================================================
--- Zope3/trunk/src/zope/app/pagelet/collector.py 2005-09-09 21:41:29 UTC (rev 38436)
+++ Zope3/trunk/src/zope/app/pagelet/collector.py 2005-09-10 01:59:07 UTC (rev 38437)
@@ -106,7 +106,8 @@
pagelets.sort(lambda x, y: x[1].weight - y[1].weight)
for name, pagelet in pagelets:
- # append pagelet macros if the permission is correct
+ # append pagelet macros if the permission is correct pagelets
+ # are now locatable and can invoke local authentication utilities
if canAccess(pagelet, '__getitem__'):
macros.append(pagelet[name])
@@ -192,7 +193,7 @@
pagelet = zapi.getMultiAdapter(objects, IPagelet, key)
# rasie Unauthorized exception if we don't have the permission for
- # calling the pagelet's macro code
+ # calling the pagelet's macro code. Pagelets are locatable.
if canAccess(pagelet, '__getitem__'):
return pagelet[key]
else:
Modified: Zope3/trunk/src/zope/app/pagelet/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/pagelet/interfaces.py 2005-09-09 21:41:29 UTC (rev 38436)
+++ Zope3/trunk/src/zope/app/pagelet/interfaces.py 2005-09-10 01:59:07 UTC (rev 38437)
@@ -24,6 +24,7 @@
from zope.schema import Int
from zope.app.i18n import ZopeMessageIDFactory as _
+from zope.app.location import ILocation
@@ -36,7 +37,7 @@
-class IPagelet(Interface):
+class IPagelet(ILocation):
"""Interface for custom pagelet adapters.
Pagelets can be used in a page template as a piece of content
@@ -173,7 +174,7 @@
class ITALESPageDataExpression(ITALESExpression):
"""Tal namespace for set the view namespace in MacrosCollector.
- For to call a page data adapter in a page template use the the
+ For calling a page data adapter in a page template use the
following syntax:
<metal:block
tal:define="data pagedata:x.y.interfaces.IDemoPageData" />
Modified: Zope3/trunk/src/zope/app/pagelet/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/pagelet/metaconfigure.py 2005-09-09 21:41:29 UTC (rev 38436)
+++ Zope3/trunk/src/zope/app/pagelet/metaconfigure.py 2005-09-10 01:59:07 UTC (rev 38437)
@@ -70,6 +70,7 @@
self.context = context
self.request = request
self.view = view
+ self.__parent__ = context
def __getitem__(self, name):
"""Get the zpt code defined in 'define-macro' by name."""
More information about the Zope3-Checkins
mailing list