[Zope] dtml-if errors in sql method

2000-07-18 Thread Tim Hicks

dtml-if "which_table == 'Plays'"

SELECT *
FROM dtml-var which_table
WHERE "Play title" like dtml-sqlvar
"'%'+_.string.strip(form_string)+'%'" type=string;

Can anybody explain to me what is going on with my zsql method?  Zope
gives me the following error when I try and change my method to what
is above.

Invalid attribute name, "which_table", for tag dtml-if "which_table
== 'Plays'", on line 16 of string

I've scoured the mailing list, but I'm still mightily confused.
which_table is one of the arguments for the the sql method and Plays
is a string that I want to compare it with.  which_table comes from a
form elsewhere.  I'm sure it's something really simple, and I'm sure
it's been discussed here before (at length?), but ATM, I don't even
know what I'm looking for!

Thanks for the help

tim


___
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] dtml-if errors in sql method

2000-07-18 Thread Tim Hicks

- Original Message -
From: "Gregory Haley" [EMAIL PROTECTED]
To: "Tim Hicks" [EMAIL PROTECTED]
Sent: Tuesday, July 18, 2000 7:35 PM
Subject: Re: [Zope] dtml-if errors in sql method


 Hi,

 Are you searching for the exact word "Plays", or is there a
 variable called Plays against which you are trying to match
 a value?  If it's the latter, having the single quotes is
 teling it to search for the literal.  If you are setting the
 value of plays in a higher call, eg. dtml-call
 "REQUEST.set('Plays', Play_titles)", your if expression
 would need to be "which_table == Plays".

 Hope this is helpful, as it is a mistake I am always making!

 ciao!
 greg.

 Gregory Haley
 venaca.com


Thanks for that... I am trying to compare which_table to the exact
string Plays.  Plays is not a variable/argument/integer//whatever,
I am just trying to see if the string that is returned from one of the
fields of my form (which_table) is equal to the string Plays.

snip

Tim:  [EMAIL PROTECTED]





___
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] dtml-if errors in sql method

2000-07-18 Thread Tim Hicks

- Original Message -
From: "Dieter Maurer" [EMAIL PROTECTED]
To: "Tim Hicks" [EMAIL PROTECTED]
Sent: Tuesday, July 18, 2000 9:51 PM
Subject: Re: [Zope] dtml-if errors in sql method


 Tim Hicks writes:
   dtml-if "which_table == 'Plays'"
  
   SELECT *
   FROM dtml-var which_table
   WHERE "Play title" like dtml-sqlvar
   "'%'+_.string.strip(form_string)+'%'" type=string;
  
   Can anybody explain to me what is going on with my zsql method?
Zope
   gives me the following error when I try and change my method to
what
   is above.
  
   Invalid attribute name, "which_table", for tag dtml-if
"which_table
   == 'Plays'", on line 16 of string
 The error message looks strange.
 It seems that the parser does not see the "...", because
"which_table"
 actually is not an attribute at all.

 Did you declare "which_table" as argument of the Z SQL method.
 This will probably not remove your current problem but
 may later come up.


 Dieter


Yes, which_table and form_string are both declared as arguments in the
zsql method.

Tim:  [EMAIL PROTECTED]




___
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 )