On 12/10/10 4:49 PM, Michael Smith wrote: > I had been using code including tal:define="portal_url > context/plone_portal_state/portal_url" for some time before I encountered > errors about it. Mikko suggested using > context/@@plone_portal_state/portal_url instead, and that fixed the problem. > I'd like to understand why.
Wouldn't we all… ;-) You will likely need to do some digging (and by digging I mean pdb step through Zope 2 ZPublisher, maybe); I don't think anyone will be able to just "give you the answer" but I'll give it a shot. AFAICT, and this is just an educated guess, but it has something to do with Acquisition (that is always the answer :-). If you look at http://plone.org/plone_portal_state, you notice you get a result. And the same goes for: http://plone.org/@@plone_portal_state. The former may be working because somewhere in the Acquisition chain, something checks browser views for you. The case where it doesn't work would be easy to explain: you either lost Acquisition, or you lost the thing in the chain that was doing the check for you (this theory is mostly coming from my imagination vs. real life). That's one theory. Another is that there is some method aliasing in place that I can't remember right now (similar to the way you can specify that the default view "/view" of something is actually "/my_view" or "/@@my_view". (But I must confess this is coming mostly from my imagination too.) Regardless, the point is that "plone_portal_state" is only working because either Zope 2 or Plone is "helping" you. Traversal to browser views is more likely to succeed (AFAIK) when you ask for a browser view (via '@@' syntax). Alex > > Specifically, the traceback below happened when I installed plone.app.ldap > and tried to add an ldap server. The plone.app.ldap control panel (as well as > the rest of the site afaict) appeared without an error until I clicked the > "add LDAP server" button. > > Traceback (innermost last): > Module ZPublisher.Publish, line 119, in publish > Module ZPublisher.mapply, line 88, in mapply > Module ZPublisher.Publish, line 42, in call_object > Module zope.formlib.form, line 770, in __call__ > Module zope.formlib.form, line 885, in render > Module zope.formlib.form, line 764, in render > Module plone.app.form._named, line 26, in __call__ > Module Shared.DC.Scripts.Bindings, line 313, in __call__ > Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec > Module Products.PageTemplates.PageTemplateFile, line 129, in _exec > Module Products.CacheSetup.patch_cmf, line 126, in PT_pt_render > Module zope.tal.talinterpreter, line 271, in __call__ > Module zope.tal.talinterpreter, line 346, in interpret > Module zope.tal.talinterpreter, line 891, in do_useMacro > Module zope.tal.talinterpreter, line 346, in interpret > Module zope.tal.talinterpreter, line 536, in do_optTag_tal > Module zope.tal.talinterpreter, line 521, in do_optTag > Module zope.tal.talinterpreter, line 516, in no_tag > Module zope.tal.talinterpreter, line 346, in interpret > Module zope.tal.talinterpreter, line 534, in do_optTag_tal > Module zope.tal.talinterpreter, line 516, in no_tag > Module zope.tal.talinterpreter, line 346, in interpret > Module zope.tal.talinterpreter, line 745, in do_insertStructure_tal > Module Products.PageTemplates.Expressions, line 223, in evaluateStructure > Module zope.tales.tales, line 696, in evaluate > - URL: > file:/opt/plone/zeocluster/parts/svnproducts/naz.umbrella/naz/umbrella/skins/naz_umbrella_custom_templates/main_template.pt > - Line 126, Column 3 > - Expression:<StringExpr u'naz.portalbottom'> > - Names: > {'container':<Products.Five.metaclass.ServerAdding object at > 0x120b75d0>, > 'context':<Products.Five.metaclass.ServerAdding object at 0x120b75d0>, > 'default':<object object at 0x7fb9821d9200>, > 'here':<Products.Five.metaclass.ServerAdding object at 0x120b75d0>, > 'loop': {}, > 'nothing': None, > 'options': {'args': ()}, > 'repeat':<Products.PageTemplates.Expressions.SafeMapping object at > 0x7fb971986830>, > 'request':<HTTPRequest, > URL=http://10.0.0.3:8080/Plone/+ldapserver/plone.LdapServer>, > 'root':<Application at>, > 'template':<ImplicitAcquirerWrapper object at 0xb101450>, > 'traverse_subpath': [], > 'user':<PropertiedUser 'admin'>, > 'view':<Products.Five.metaclass.ServerAddForm object at 0x120b73d0>, > 'views':<zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object > at 0xb101390>} > Module Products.Five.browser.providerexpression, line 37, in __call__ > Module plone.app.viewletmanager.manager, line 154, in render > Module plone.app.viewletmanager.manager, line 83, in render > Module zope.app.pagetemplate.simpleviewclass, line 44, in __call__ > Module Shared.DC.Scripts.Bindings, line 313, in __call__ > Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec > Module Products.PageTemplates.PageTemplateFile, line 129, in _exec > Module Products.CacheSetup.patch_cmf, line 126, in PT_pt_render > Module zope.tal.talinterpreter, line 271, in __call__ > Module zope.tal.talinterpreter, line 346, in interpret > Module zope.tal.talinterpreter, line 586, in do_setLocal_tal > Module zope.tales.tales, line 696, in evaluate > - URL: index > - Line 2, Column 0 > - Expression:<PathExpr standard:'context/plone_portal_state/portal_url'> > - Names: > {'container':<Products.Five.metaclass.ServerAdding object at > 0x120b75d0>, > 'context':<Products.Five.metaclass.ServerAdding object at 0x120b75d0>, > 'default':<object object at 0x7fb9821d9200>, > 'here':<Products.Five.metaclass.ServerAdding object at 0x120b75d0>, > 'loop': {}, > 'nothing': None, > 'options': {'args': ()}, > 'repeat':<Products.PageTemplates.Expressions.SafeMapping object at > 0xb151b90>, > 'request':<HTTPRequest, > URL=http://10.0.0.3:8080/Plone/+ldapserver/plone.LdapServer>, > 'root':<Application at>, > 'template':<ImplicitAcquirerWrapper object at 0xb15f190>, > 'traverse_subpath': [], > 'user':<PropertiedUser 'admin'>, > 'view':<Products.Five.viewlet.viewlet.SimpleViewletClass from > /opt/plone/zeocluster/parts/svnproducts/naz.umbrella/naz/umbrella/browser/templates/umbrella_footer.pt > object at 0x7fb971a0f4d0>, > 'views':<zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object > at 0xb15fdd0>} > Module zope.tales.expressions, line 217, in __call__ > Module Products.PageTemplates.Expressions, line 155, in _eval > Module zope.tales.expressions, line 124, in _eval > Module Products.PageTemplates.Expressions, line 105, in > trustedBoboAwareZopeTraverse > Module zope.traversing.adapters, line 164, in traversePathElement > - __traceback_info__: (<Products.Five.metaclass.ServerAdding object at > 0x120b75d0>, 'plone_portal_state') > Module zope.traversing.adapters, line 52, in traverse > - __traceback_info__: (<Products.Five.metaclass.ServerAdding object at > 0x120b75d0>, 'plone_portal_state', ['portal_url']) > TraversalError: (<Products.Five.metaclass.ServerAdding object at 0x120b75d0>, > 'plone_portal_state') > > > Best wishes, > Michael A. Smith > Web& Digital / Academic Technologies Manager > Nazareth College -- Alex Clark · http://aclark.net Author · http://aclark.net/admin _______________________________________________ Product-Developers mailing list [email protected] http://lists.plone.org/mailman/listinfo/product-developers
