[Zope] to hide a portlet for certain groups
Olivier Wambacq
olivier.wambacq at naturalsciences.be
Tue Mar 14 11:11:53 EST 2006
hello,
I have several portlets, and several user groups.
now I want to hide the portlet for some groups, and show it to some others.
I found this site:
http://64.233.179.104/search?q=cache:y8smCcbQ9TAJ:zope.groupsense.co.nz/grou
psense.co.nz/zwiki/PersonalisingAccess+tal:condition+group&hl=nl&gl=be&ct=cl
nk&cd=4
so I tried:
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
i18n:domain="plone">
<body>
<div metal:define-macro="portlet">
<div class="portlet"
id="portlet-partners"
tal:condition="python: 'partners' in user.getGroups()">
...
but it doesn't work.
now,
when I log in as a member of the 'partners' group, the portlet doesn't show,
when I log in as a member of another group, it doesn't show either,
and when I look at the site as an anonymous user, ...
I get an error,
thanks in advance,
Olivier
here's the traceback:
Site Error
An error was encountered while publishing this resource.
AttributeError
Sorry, a site error occurred.
Traceback (innermost last):
Module ZPublisher.Publish, line 175, in publish_module_standard
Module Products.PlacelessTranslationService.PatchStringIO, line 51, in
new_publish
Module ZPublisher.Publish, line 132, in publish
Module Zope.App.startup, line 204, in zpublisher_exception_hook
Module ZPublisher.Publish, line 101, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 39, in call_object
Module Shared.DC.Scripts.Bindings, line 306, in __call__
Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
Module Products.CMFCore.FSPageTemplate, line 191, in _exec
Module Products.CMFCore.FSPageTemplate, line 124, in pt_render
Module Products.PTProfiler.ProfilerPatch, line 66, in __patched_render__
Module Products.PageTemplates.PageTemplate, line 96, in pt_render
<FSPageTemplate at /pss-ccs/logged_out>
Module TAL.TALInterpreter, line 190, in __call__
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 671, in do_useMacro
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 409, in do_optTag_tal
Module TAL.TALInterpreter, line 394, in do_optTag
Module TAL.TALInterpreter, line 389, in no_tag
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 702, in do_defineSlot
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 637, in do_condition
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 702, in do_defineSlot
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 409, in do_optTag_tal
Module TAL.TALInterpreter, line 394, in do_optTag
Module TAL.TALInterpreter, line 389, in no_tag
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 671, in do_useMacro
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 637, in do_condition
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 409, in do_optTag_tal
Module TAL.TALInterpreter, line 394, in do_optTag
Module TAL.TALInterpreter, line 389, in no_tag
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 613, in do_loop_tal
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 409, in do_optTag_tal
Module TAL.TALInterpreter, line 394, in do_optTag
Module TAL.TALInterpreter, line 389, in no_tag
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 637, in do_condition
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 409, in do_optTag_tal
Module TAL.TALInterpreter, line 394, in do_optTag
Module TAL.TALInterpreter, line 389, in no_tag
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 671, in do_useMacro
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 636, in do_condition
Module Products.PageTemplates.TALES, line 221, in evaluate
URL: /pss-ccs/portal_skins/custom/portlet_partners
Line 11, Column 6
Expression: <PythonExpr 'partners' in user.getGroups()>
Names:
{'container': <PloneSite instance at 593e91a0>,
'context': <PloneSite instance at 593e91a0>,
'default': <Products.PageTemplates.TALES.Default instance at 0x5634680c>,
'here': <PloneSite instance at 593e91a0>,
'loop': <SafeMapping instance at 5b738f30>,
'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter
instance at 0x563462cc>,
'nothing': None,
'options': {'args': ()},
'repeat': <SafeMapping instance at 5b738f30>,
'request': <HTTPRequest,
URL=http://www.naturalsciences.be/pss-ccs/logged_out>,
'root': <Application instance at 571676e0>,
'template': <FSPageTemplate at /pss-ccs/logged_out>,
'traverse_subpath': [],
'user': Anonymous User}
Module Products.PTProfiler.ProfilerPatch, line 25, in __patched_call__
Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__
__traceback_info__: 'partners' in user.getGroups()
Module Python expression "'partners' in user.getGroups()", line 1, in
<expression>
AttributeError: getGroups
More information about the Zope
mailing list