Hi, This must be a dumb question, but I can't seem to get to grips with the DTML syntax :( I would like to assign a value 0/1 to a variable "authorize" like in the code snippet below (allowed_users is a multiple selection property): ------------------------------------------------------------------ <dtml-let authorize="0"> <dtml-in allowed_users> <dtml-if "AUTHENTICATED_USER.getUserName() == _['sequence-item']"> <dtml-var sequence-item> Hello, we are autorized <dtml-call "_['authorize']='1'"> </dtml-if> </dtml-in> </dtml-let> ------------------------------------------------------------------ What do I have to do to get authorize = 1? This syntax for <dtml-call> doesn't work, but I've tried just about everything :( Greetings, Michiel Toneman --
From a Sun Microsystems bug report (#4102680): "Workaround: don't pound on the mouse like a wild monkey."
Michiel Toneman schrieb:
Hi,
This must be a dumb question, but I can't seem to get to grips with the DTML syntax :(
I would like to assign a value 0/1 to a variable "authorize" like in the code snippet below (allowed_users is a multiple selection property):
------------------------------------------------------------------ <dtml-let authorize="0">
<dtml-in allowed_users>
<dtml-if "AUTHENTICATED_USER.getUserName() == _['sequence-item']"> <dtml-var sequence-item> Hello, we are autorized <dtml-call "_['authorize']='1'"> </dtml-if>
</dtml-in> </dtml-let> ------------------------------------------------------------------
What do I have to do to get authorize = 1? This syntax for <dtml-call> doesn't work, but I've tried just about everything :(
<dtml-call "REQUEST.set('authorize',1)"> if authorize should be treated as integer or <dtml-call "REQUEST.set('authorize','1')"> if authorize should be treated as a string. hth, Thomas -- fon: ++49 (0)40 42878 3781 fax: ++49 (0)40 42878 2728
----- Original Message ----- From: Thomas Weiner <weiner@tu-harburg.de>
<dtml-call "REQUEST.set('authorize',1)"> if authorize should be treated as integer or <dtml-call "REQUEST.set('authorize','1')"> if authorize should be treated as a string.
Note that if you do this, you should also get rid of the <dtml-let> and replace its opening tag with a REQUEST.set to zero. Cheers, Evan @ digicool
On Tue, Feb 15, 2000 at 06:40:13PM +0100, Michiel Toneman wrote:
Hi,
This must be a dumb question, but I can't seem to get to grips with the DTML syntax :(
I would like to assign a value 0/1 to a variable "authorize" like in the code snippet below (allowed_users is a multiple selection property):
------------------------------------------------------------------ <dtml-let authorize="0">
<dtml-in allowed_users>
<dtml-if "AUTHENTICATED_USER.getUserName() == _['sequence-item']"> <dtml-var sequence-item> Hello, we are autorized <dtml-call "_['authorize']='1'"> </dtml-if>
</dtml-in> </dtml-let> ------------------------------------------------------------------
What do I have to do to get authorize = 1? This syntax for <dtml-call> doesn't work, but I've tried just about everything :(
Try: <dtml-call "REQUEST.set('authorize, 1)"> -- Stephen Pitts smpitts@midsouth.rr.com webmaster - http://www.mschess.org
Hi,, Really simple question that I just cannot figure out. I want to append items together and pass as form item to another method in REQUEST. Well I can create an empty string in REQUEST with <dtml-call "REQUEST.set('list', [])"> I can then iterate and fill the list fine. <dtml-call "list.insert(0, id)"> Then I want the results of the list in one variable in another method. i.e.: I have a list ['item1','item2','last item'] and I want a string like "item1/item2/last item". I know I can iterate through the list with dtml-in but what is the right join syntax? <dtml-call _.string.join(list,' ')> doesn't get me anywere. Thanks for your help Chip
Never mind! Sorry for wasteing the disk space I just stubbled across the syntax using my typical trial & error & errorr approach. If anyone is interested this is the resulting (very ugly and inefficient) code. This climbs up the folder tree and creates two lists. One in forward order the other in reverse. The reverse list is displayed as a navigator and the forward list is converted to string and used to query the catalog for items. If anyone has improvements ;) Thanks anyway, Chip <dtml-call "REQUEST.set('tkeysreverse', [])"> <dtml-call "REQUEST.set('tkeysforward', [])"> <dtml-call "REQUEST.set('Topic', '')"> <dtml-in PARENTS skip_unauthorized reverse> <dtml-unless sequence-start> <dtml-unless "id == 'PortalRoot' or id == 'Pub'"> <span class="ItemBack"> <dtml-with sequence-item> <dtml-call "tkeysreverse.insert(0, id)"> <dtml-call "tkeysforward.append(id)"> <a href="<dtml-var absolute_url>/showTopics"> <dtml-var id></a> </dtml-with> <dtml-unless sequence-end> > </dtml-unless> </span> </dtml-unless> </dtml-unless> </dtml-in> <dtml-call "REQUEST.set('Topic', _.string.join(tkeysforward))">
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Chip Vanek Sent: Wednesday, February 16, 2000 4:19 PM To: zope@zope.org Subject: [Zope] NEWBIE: DTML Appending string and passing in REQUEST?
Hi,,
Really simple question that I just cannot figure out.
I want to append items together and pass as form item to another method in REQUEST.
Well I can create an empty string in REQUEST with <dtml-call "REQUEST.set('list', [])">
I can then iterate and fill the list fine. <dtml-call "list.insert(0, id)">
Then I want the results of the list in one variable in another method. i.e.: I have a list ['item1','item2','last item'] and I want a string like "item1/item2/last item".
I know I can iterate through the list with dtml-in but what is the right join syntax?
<dtml-call _.string.join(list,' ')> doesn't get me anywere.
Thanks for your help
Chip
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hye thanks Chip, this is the kind of thing that should be in a HOW-TO (DTML tutorial actually), it begins to solve my problems quite nicely. One of the things that bug me with the DTML tutorial thing in the documentation section of zope.org is that it's so bare of example code, it gives information but it's really hard to put together! Especially not being a python person. -- Roddy => <dtml-call "REQUEST.set('tkeysreverse', [])"> => <dtml-call "REQUEST.set('tkeysforward', [])"> => <dtml-call "REQUEST.set('Topic', '')"> => <dtml-in PARENTS skip_unauthorized reverse> => <dtml-unless sequence-start> => <dtml-unless "id == 'PortalRoot' or id == 'Pub'"> => <span class="ItemBack"> => <dtml-with sequence-item> => <dtml-call "tkeysreverse.insert(0, id)"> => <dtml-call "tkeysforward.append(id)"> => <a href="<dtml-var absolute_url>/showTopics"> => <dtml-var id></a> => </dtml-with> => <dtml-unless sequence-end> => > => </dtml-unless> => </span> => </dtml-unless> => </dtml-unless> => </dtml-in> => <dtml-call "REQUEST.set('Topic', _.string.join(tkeysforward))"> --- Roddy Vagg Programmer, Web Developer Cooperative Research Centre for Cattle and Beef Quality (and) Total Genetic Resource Management (TGRM) Ph: (+61)267733978 ---
participants (6)
-
Chip Vanek -
Evan Simpson -
Michiel Toneman -
Roddy -
Stephen Pitts -
Thomas Weiner