[Checkins] SVN: five.pt/trunk/src/five/pt/ The container should be the Acquisition.aq_parent.
Wichert Akkerman
wichert at wiggy.net
Sun Oct 24 05:47:21 EDT 2010
Can you test if the GenericSetup import step ZMI pages still work after
this change?
On 10/24/10 01:13 , Ross Patterson wrote:
> Log message for revision 117827:
> The container should be the Acquisition.aq_parent.
>
> Many templates expect this. Without Chameleon, a
> Products.CMFCore.FSPageTemplate inherits from
> Products.PageTemplates whose classes which set the container using
> self.aq_inner.aq_parent or self._getContainer() which in turn comes
> from Shared.DC.Scripts.Bindings.Bindings. With cmf.pt, the
> FSPageTemplate no longer inherits from Products.PageTemplates or the
> mro is changed such that this no longer takes effect.
>
> What's more confusing is that it seems like
> Products.Five.browser.pagetemplate should be doing this anyways, since
> in a Zope2 app, container really should be the aq_parent of the
> context. So I'm not entirely sure what the right answer is but I know
> this fixes the CMFPlacefulWorkflow placeful_workflow_configuration
> redirect loop I encountered and there's no place in cmf.pt to affect
> the locals definition of "container" so I'm doing it here.
>
>
> Changed:
> U five.pt/trunk/src/five/pt/pagetemplate.py
> U five.pt/trunk/src/five/pt/tests/locals.pt
> A five.pt/trunk/src/five/pt/tests/locals_base.pt
> U five.pt/trunk/src/five/pt/tests/test_viewpagetemplatefile.py
>
> -=-
> Modified: five.pt/trunk/src/five/pt/pagetemplate.py
> ===================================================================
> --- five.pt/trunk/src/five/pt/pagetemplate.py 2010-10-23 20:31:56 UTC (rev 117826)
> +++ five.pt/trunk/src/five/pt/pagetemplate.py 2010-10-23 23:13:52 UTC (rev 117827)
> @@ -60,7 +60,7 @@
> request=request or aq_get(instance, 'REQUEST', None),
> template=self,
> here=context,
> - container=context,
> + container=aq_parent(aq_inner(context)),
> nothing=None,
> same_type=same_type,
> test=test,
> @@ -108,7 +108,7 @@
> view=view,
> template=self,
> here=context,
> - container=context,
> + container=aq_parent(aq_inner(context)),
> nothing=None,
> path=pagetemplate.evaluate_path,
> exists=pagetemplate.evaluate_exists,
>
> Modified: five.pt/trunk/src/five/pt/tests/locals.pt
> ===================================================================
> --- five.pt/trunk/src/five/pt/tests/locals.pt 2010-10-23 20:31:56 UTC (rev 117826)
> +++ five.pt/trunk/src/five/pt/tests/locals.pt 2010-10-23 23:13:52 UTC (rev 117827)
> @@ -2,7 +2,7 @@
> xmlns:tal="http://xml.zope.org/namespaces/tal">
> <div tal:replace="string:view:${view/available}" />
> <div tal:replace="python:'here==context:'+str(here==context)" />
> -<div tal:replace="python:'here==container:'+str(here==container)" />
> +<div tal:replace="python:'parent==container:'+str(here.aq_parent==container)" />
> <div tal:replace="string:root:${root/getPhysicalPath}" />
> <div tal:replace="string:nothing:${nothing}" />
> <div tal:define="cgi python:modules['cgi']">
>
> Added: five.pt/trunk/src/five/pt/tests/locals_base.pt
> ===================================================================
> --- five.pt/trunk/src/five/pt/tests/locals_base.pt (rev 0)
> +++ five.pt/trunk/src/five/pt/tests/locals_base.pt 2010-10-23 23:13:52 UTC (rev 117827)
> @@ -0,0 +1,6 @@
> +<div xmlns="http://www.w3.org/1999/xhtml"
> + xmlns:tal="http://xml.zope.org/namespaces/tal">
> +<div tal:replace="python:'here==context:'+str(here==context)" />
> +<div tal:replace="python:'container==None:'+str(None==container)" />
> +<div tal:replace="string:nothing:${nothing}" />
> +</div>
>
> Modified: five.pt/trunk/src/five/pt/tests/test_viewpagetemplatefile.py
> ===================================================================
> --- five.pt/trunk/src/five/pt/tests/test_viewpagetemplatefile.py 2010-10-23 20:31:56 UTC (rev 117826)
> +++ five.pt/trunk/src/five/pt/tests/test_viewpagetemplatefile.py 2010-10-23 23:13:52 UTC (rev 117827)
> @@ -4,6 +4,7 @@
> from Testing.ZopeTestCase import ZopeTestCase
>
> from five.pt.pagetemplate import ViewPageTemplateFile
> +from five.pt.pagetemplate import BaseTemplateFile
>
>
> class SimpleView(BrowserView):
> @@ -20,6 +21,11 @@
> index = ViewPageTemplateFile('locals.pt')
>
>
> +class LocalsBaseView(BrowserView):
> +
> + index = BaseTemplateFile('locals_base.pt')
> +
> +
> class OptionsView(BrowserView):
> index = ViewPageTemplateFile('options.pt')
>
> @@ -50,11 +56,18 @@
> #self.failUnless('Folder at test_folder_1_' in result)
> #self.failUnless('http://nohost' in result)
> self.failUnless('here==context:True' in result)
> - self.failUnless('here==container:True' in result)
> + self.failUnless('parent==container:True' in result)
> self.failUnless("root:(\'\',)" in result)
> self.failUnless("nothing:None" in result)
> self.failUnless("modules:<foo>" in result)
>
> + def test_locals_base(self):
> + view = LocalsBaseView(self.folder, self.folder.REQUEST)
> + result = view.index()
> + self.failUnless('here==context:True' in result)
> + self.failUnless('container==None:True' in result)
> + self.failUnless("nothing:None" in result)
> +
> def test_options(self):
> view = OptionsView(self.folder, self.folder.REQUEST)
> options = dict(
>
> _______________________________________________
> checkins mailing list
> checkins at zope.org
> https://mail.zope.org/mailman/listinfo/checkins
More information about the checkins
mailing list