List Info

Thread: dtml-let variables in sql queries




dtml-let variables in sql queries
user name
2006-11-23 16:03:47
On Thu, 23 Nov 2006, Jonathan wrote:

>> <params>name nameid
>> 
>> </params>
>> SELECT * FROM names
>> WHERE fake = 0
>> <dtml-if name>
>>   AND <dtml-sqltest name op=like type=nb>
>> </dtml-if>
>> <dtml-if nameid>
>>   AND <dtml-sqltest nameid op=eq type=int>
>> </dtml-if>
>
> First off, i would highly recommend using python
scripts instead of DTML for 
> the kind of processing you have described.

You are right here and I would definitely prefer Python
scripts.  The
problem is that I'm using the Formulator Product and despite
there are
descriptions how to use it with Python scripts I failed
while it was
very straigtforeward to use DTML (in fact, this is the only
part of
my application in DTML).  I just stripped down the
application to a
very simple example and avoided Formulator magic which is
obviousely
not the source of the problem.

> That said,  you have not described the GetCases method.

I forgot to mention the name.  It is the code snipped above.

> If GetCases is the 
> name of your SQL method, then you need to pass in the
parameter 'nameid'

Well, nameid is not explicitely passed but taken from the
parent
out of

     <dtml-let
nameid="REQUEST.form['nameid']">

and this works.  The problem is that name which is builded
out of

     <dtml-let
namepart="REQUEST.form['namepart']">
          Namepart = <dtml-var namepart><br />
          <dtml-let name="namepart + '%'">

is ignored by the SQL method and I fail to see the
difference.
The <dtml-if name> seems to be false in any case.

Kind regards

         Andreas.

-- 
http://fam-tille.de
_______________________________________________
Zope-DB mailing list
Zope-DBzope.org
http://
mail.zope.org/mailman/listinfo/zope-db
dtml-let variables in sql queries
user name
2006-11-23 16:35:55
Am 23.11.2006, 17:03 Uhr, schrieb Andreas Tille
<tillearki.de>:

> You are right here and I would definitely prefer Python
scripts.  The
> problem is that I'm using the Formulator Product and
despite there are
> descriptions how to use it with Python scripts I failed
while it was
> very straigtforeward to use DTML (in fact, this is the
only part of
> my application in DTML).  I just stripped down the
application to a
> very simple example and avoided Formulator magic which
is obviousely
> not the source of the problem.

It's easy enough to call Formulator from within a script and
extract the  
results from it:

result =
context.MY_FORMULATOR_THINGY.validate_all(context.REQUEST)

Make it work with a Script so you can forget all the evil
DTML stuff, you  
won't regret it!

Charlie
_______________________________________________
Zope-DB mailing list
Zope-DBzope.org
http://
mail.zope.org/mailman/listinfo/zope-db
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )