[Zope] Variable name use in with statement

2000-10-13 Thread Burchill, Scott B.

I'm working on a simple auction site as a newbe challenge.  I am taking bids
on three static items, none will be added or removed.  I have a folder named
bid_records in which there is a folder for each item.  These item folders
have current bid information in properties and bid history in ZClass items
stored in them.

When I'm working with a specific auction item I have the name of the folder
in a REQUEST variable.  I am finding myself doing the following and am sure
there is a simpler way to do this.

Any help would be greatly appreciated!  Thanks.

dtml-with bid_records
  dtml-if "_.str(REQUEST.form['selection']) == 'walkon'"
dtml-with walkon
  dtml-call "REQUEST.set('cur_bidder', bidder)"
/dtml-with
  dtml-elif "_.str(REQUEST.form['selection']) == 'fullhouse'"
dtml-with fullhouse
  dtml-call "REQUEST.set('cur_bidder', bidder)"
/dtml-with
  dtml-else
dtml-with snoopy
  dtml-call "REQUEST.set('cur_bidder', bidder)"
/dtml-with
  /dtml-if
/dtml-with

--
Scott B. Burchill, MIS Manager
Ordway Center for the Performing Arts
345 Washington Street
St. Paul, MN  55102-1495

voice +1 (651) 282-3082
cell  +1 (651) 248-2713
pager +1 (612) 818-7600
fax   +1 (651) 224-1820
efax  +1 (508) 519-6133

http://www.ordway.org

\:)
 /:(


___
Zope maillist  -  [EMAIL PROTECTED]
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 )




[Zope] Variable name use in with statement

2000-10-13 Thread Spicklemire, Jerry

Scott Butchill wonders if:

"there is a simpler way to do this."

Not much simpler, but how about:

dtml-call "REQUEST.set('user_select', ['walkon', 'fullhouse'])"
dtml-with bid_records
 dtml-in user_select
  dtml-if "_.str(REQUEST.form['selection']) == _['sequence-item']"
   dtml-with "_['sequence-item']"
dtml-call "REQUEST.set('cur_bidder', bidder)"
   /dtml-with
  dtml-elif "_['sequence-index'] == -1
   dtml-with snoopy
dtml-call "REQUEST.set('cur_bidder', bidder)"
   /dtml-with
  /dtml-if
 /dtml-in
/dtml-with

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Variable name use in with statement

2000-10-13 Thread Dieter Maurer

Burchill, Scott B. writes:
  
  I am finding myself doing the following and am sure
  there is a simpler way to do this.
  
  Any help would be greatly appreciated!  Thanks.
  
  dtml-with bid_records
dtml-if "_.str(REQUEST.form['selection']) == 'walkon'"
  dtml-with walkon
dtml-call "REQUEST.set('cur_bidder', bidder)"
  /dtml-with
dtml-elif "_.str(REQUEST.form['selection']) == 'fullhouse'"
  dtml-with fullhouse
dtml-call "REQUEST.set('cur_bidder', bidder)"
  /dtml-with
dtml-else
  dtml-with snoopy
dtml-call "REQUEST.set('cur_bidder', bidder)"
  /dtml-with
/dtml-if
  /dtml-with
If you are sure, that only these values can occur in
"selection" (as I expect, as otherwise, it would not be a selection),
then you can use:

dtml-call "REQUEST.set('cur_bidder',_.getitem(REQUEST.form['selection']).bidder)"


Dieter

___
Zope maillist  -  [EMAIL PROTECTED]
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 )