[Zope] newbie DTML namespace

2000-07-27 Thread Brad Moulton

Hi all,

as a newbie to both python and zope i am struggling with understanding the
howto and the syntax of accessing stuff in namespace

eg

I would like to build a table depending on some tests peformed on stuff
returned form a Z SQL method

1. I have a form with a name="spam" value="egs"
this value is passed onto next dtml document
-
table
tr
tddtml-var spam td// displays 'eggs'  to test spam is OK
/tr
dtml-var sqlstuff // this does a join of two tables 
dtml-in sqlstuff
dtml-if {CAN'T WORK OUT SYNTAX TO ACCESS  spam to compare with lets say
sqlstuff.spam}
trtddtml-var sqlstuff.column/tdetc
/dtml-if
/dtml-in  
--
I have read DTML  Reference but dtml-if says "a valid python expression"
Can I still access spam inside the dtml-in if so how dtml-var spam, spam
'spam', ['spam']
and then how do i refer to a table column name returned in the SQL
query  to make the comparison 

TIA
brad








___
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] newbie DTML namespace

2000-07-27 Thread Dieter Maurer

Brad Moulton writes:
  I would like to build a table depending on some tests peformed on stuff
  returned form a Z SQL method
  
  1. I have a form with a name="spam" value="egs"
  this value is passed onto next dtml document
  -
  table
  tr
  tddtml-var spam td // displays 'eggs'  to test spam is OK
  /tr
  dtml-var sqlstuff  // this does a join of two tables 
  dtml-in sqlstuff
  dtml-if {CAN'T WORK OUT SYNTAX TO ACCESS  spam to compare with lets say
  sqlstuff.spam}
  trtddtml-var sqlstuff.column/tdetc
  /dtml-if
  /dtml-in  
  --
Your problem is solved by renaming.

You can either rename your DTML var or your SQL column result name:

DTML var:

  dtml-let myspam=spam !-- you can now access "spam" as "myspam"--
dtml-in sqlstuff
   
   dtml-if "myspam == spam"/dtml-if
   
/dtml-in
  /dtml-let

SQL column result name:

  select spam as sqlspam ...

You now access the "spam" column under the name "sqlspam".


I, regularly, use SQL column renaming.


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 )