[Zope] How do I convert an id to a string?

Pavlos Christoforou pavlos@gaaros.msrc.sunysb.edu
Fri, 26 Nov 1999 12:44:56 -0500 (EST)


On Fri, 26 Nov 1999, Farzad Farid wrote:

>  This may be a simple problem but I tried all I could yesterday, I browsed
> the docs quickly and could not find the answer: I want to use the id of a
> object as a string in an expression and I can't find how to
> convert/extract the string representation of the id. I want to write some
> code like this: 
> 
> <dtml-comment>Do not show backup files</dtml-comment>
> <dtml-in "objectValues(['DTML Document'])">
>   <dtml-if "_.string.rfind(id, '~') != -1">

try:

<dtml-if "_.string.rfind(_['id'], '~') != -1">

BTW in python you can look up single characters in a string by:

<dtml-if "'~' in id()">

id is weird, sometime you need to call it as a function sometimes
(depending on the context) you might not. In any case try both versions if
you get in trouble. It is hard to remember which is which as there is no
real design rational behind it.
Pavlos