Tino Wildenhain wrote:
Hi Florian,
Florian Lindner wrote:
Tino Wildenhain wrote:
Hi Florian,
Florian Lindner wrote:
Tino Wildenhain wrote:
Florian Lindner wrote:
Hello, how can I find out if the current user in a authentificated user or just an anonymous, using Page Templates? Thanks, Florian
Simply: you don't. Of course you can build somewhat obscure python expressions into ZTP tal attributes, but as often, its much simpler in a python script:
from AccessControl import getSecurityManager return getSecurityManager().getUser().has_role("Authenticated")
It works as far as it return 1 or 0, but my tal:condtion doesn't work:
<div style="margin-top:0.5em" tal:condtion="here/Scripts/isAuthentificated" > [...] </div>
What is wrong?
You made a typo, it must be tal:condition, not tal:condtion
This was not the error, it still does not work. (I made the typo only on the email, not in the real code). Thx, Florian
Sorry, but this is _impossible_. tal:condition evaluates the "truthness" of an expression just like python does. So 0, "", [], {}, None are all false. The Script returns 0 or 1, so it fits into this model.
(If unsure, check with repr() to see if its 0 or "0")
Even python2.3s real true/false should be supported by tal:condition - since it uses "if" internally.
So I cannot really see why it is not working.
Apparently your pagetemplate or zope installation is broken or you arent using a Page Template at all (File? DTML-whatever?)
Sorry, it was my fault. It is working correctly. I just forgot a not: because I want to have the text rendered it the user is not logged in. Sorry, sorry! Florian