[Zope] zope string question, easy for pythonistas
Kapil Thangavelu
hazmat at objectrealms.net
Sun Mar 28 03:55:44 EST 2004
1. authenticated user is a user object not a string, use
AUTHENTICATED_USER.getId() to get a string to compare against
2. use a python script
3. string in string doesn't work until python2.3, you'll have to do
string in list/tuple.
-kapil
On Sat, 2004-03-27 at 22:58, Joshua Newman wrote:
> Hi all,
>
> I'm trying to compare an AUTHENTICATED_USER string to a variable which
> I named '2nd_smr' in this script to determine if it should be bolded
> in a big table and stick out for the user:
>
> <dtml-if "_.string.lower(_.str(
> AUTHENTICATED_USER)) in _.string.lower(_.str(2nd_smr))">
> <b>2ndS <dtml-var 2nd_smr ><br></b><dtml-else>
> 2ndS <dtml-var 2nd_smr ><br></dtml-if>
>
> The above script won't save, and gives an error.
>
> The _.string.lower(_.str(2nd_smr)) expression is obviously the culprit
> and won't save unless I do ('2nd_smr') which saves but isn't what I
> want obviously, and ("2nd_smr") won't save.
>
> Did I screw up by naming a variable with a number as the first
> character?
>
> Is is salvageable with some funky syntax like:
> _.string.lower(_.str(_['{2nd_smr}']))
> or do I have to just change the name of the variable?
>
> Thanks
> J
>
>
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
More information about the Zope
mailing list