[Zope-DB] Reference DTML-sqlvar in ZPT?

2007-07-30 Thread Richard Flaaten
Dear list,

I have a ZPT that lists results from a Z SQL Method. It has one argument:
dropdown-department. Everything works fine, except I cannot find a way
to include the passed SQL argument as a string in the ZPT document!

To explain it in another way, a user selects a value from a drop-down
list. This value is passed to a Z SQL Method. My ZPT displays these
results, and I need to include the passed value (DTML-sqlvar) in a heading
in the ZPT.


Any help would be much appreciated.

Richard

___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Reference DTML-sqlvar in ZPT?

2007-07-30 Thread Charlie Clark

Am 30.07.2007, 18:55 Uhr, schrieb Richard Flaaten [EMAIL PROTECTED]:


Dear list,
I have a ZPT that lists results from a Z SQL Method. It has one argument:
dropdown-department. Everything works fine, except I cannot find a way
to include the passed SQL argument as a string in the ZPT document!



To explain it in another way, a user selects a value from a drop-down
list. This value is passed to a Z SQL Method. My ZPT displays these
results, and I need to include the passed value (DTML-sqlvar) in a  
heading

in the ZPT.


Neither explanation is particularly helpful but it sound like you're  
trying to do something you shouldn't!


You if you are wishing to call a ZSQL method and pass in a parameter from  
your template this is done using a Python expression:


tal:content=python: mySQLMethod(SQLvar=ZPTvar)...

You can pass variables into a PageTemplate using the options dictionary.

You might want to look at my presentation (with sample code) which touches  
on Zope and RDBMS.


http://www.egenix.com/library/presentations/EuroPython2007-Zope-and-RDBMS/

Charlie

--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/



 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 

eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Reference DTML-sqlvar in ZPT?

2007-07-30 Thread Richard Flaaten
quote who=Charlie Clark
 Am 30.07.2007, 18:55 Uhr, schrieb Richard Flaaten [EMAIL PROTECTED]:

 Dear list,
 I have a ZPT that lists results from a Z SQL Method. It has one
 argument:
 dropdown-department. Everything works fine, except I cannot find a way
 to include the passed SQL argument as a string in the ZPT document!

 To explain it in another way, a user selects a value from a drop-down
 list. This value is passed to a Z SQL Method. My ZPT displays these
 results, and I need to include the passed value (DTML-sqlvar) in a
 heading
 in the ZPT.

 Neither explanation is particularly helpful but it sound like you're
 trying to do something you shouldn't!

 You if you are wishing to call a ZSQL method and pass in a parameter from
 your template this is done using a Python expression:

 tal:content=python: mySQLMethod(SQLvar=ZPTvar)...

 You can pass variables into a PageTemplate using the options dictionary.

 You might want to look at my presentation (with sample code) which touches
 on Zope and RDBMS.

 http://www.egenix.com/library/presentations/EuroPython2007-Zope-and-RDBMS/

 Charlie

 --
 Charlie Clark
 eGenix.com

Dear Charlie,

Thanks for your input.

All I want to do is use the dtml-sqlvar argument as a string in my ZPT. My
ZPT is simply a report containing the results of the SQL query; I need to
use the argument as a title for the page. I am not passing any arguments
in the ZPT.



Richard


Richard Flaaten
[EMAIL PROTECTED], mobil 905 87 330]

___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Reference DTML-sqlvar in ZPT?

2007-07-30 Thread Charlie Clark

Am 30.07.2007, 19:18 Uhr, schrieb Richard Flaaten [EMAIL PROTECTED]:

Richard,

although this is actually a ZPT issue and nothing specific to do with  
RDBMS.



All I want to do is use the dtml-sqlvar argument as a string in my ZPT.

  

My ZPT is simply a report containing the results of the SQL query; I  
need to

use the argument as a title for the page. I am not passing any arguments

 ^

in the ZPT.


Your explanation is self-contradictory: you seem to want to use an  
argument within ZPT without passing it or defining it? Please provide a  
code snippet.


Charlie
--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source

Python/Zope Consulting and Support ...http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/



 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 

eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Reference DTML-sqlvar in ZPT?

2007-07-30 Thread Richard Flaaten
I guess my questions are confusing since I am new to Zope. The dtml-sqlvar
is already defined; the results from the Z SQL Method are already
presented; I just want to remind the user of what they passed to the Z
SQL Method.

In other words, I only want to print what they selected from a drop-down
list and passed to the Z SQL Method. I just want to print an already
defined variable. The problem is: how to print a dtml-sqlvar in ZPT? I
tried

p tal:replace=dtml-sqlvar/dropdown-selectiondropdown-selection goes
here/p

Which did not work.



Richard

quote who=Charlie Clark
 Am 30.07.2007, 19:18 Uhr, schrieb Richard Flaaten [EMAIL PROTECTED]:

 Richard,

 although this is actually a ZPT issue and nothing specific to do with
 RDBMS.

 All I want to do is use the dtml-sqlvar argument as a string in my ZPT.


 My ZPT is simply a report containing the results of the SQL query; I
 need to
 use the argument as a title for the page. I am not passing any arguments
   ^
 in the ZPT.

 Your explanation is self-contradictory: you seem to want to use an
 argument within ZPT without passing it or defining it? Please provide a
 code snippet.

 Charlie
 --
 Charlie Clark
 eGenix.com

 Professional Python Services directly from the Source
 Python/Zope Consulting and Support ...http://www.egenix.com/
 mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
 mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/
 

  Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 

  eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
  D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
 Registered at Amtsgericht Duesseldorf: HRB 46611





___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Reference DTML-sqlvar in ZPT?

2007-07-30 Thread Maciej Wisniowski

 I guess my questions are confusing since I am new to Zope. The dtml-sqlvar
 is already defined; the results from the Z SQL Method are already
 presented; I just want to remind the user of what they passed to the Z
 SQL Method.
You can't get sql query parameters from it's results. It's like calling
a function. You pass some parameters to it and get results...

 In other words, I only want to print what they selected from a drop-down
 list and passed to the Z SQL Method. I just want to print an already
 defined variable. The problem is: how to print a dtml-sqlvar in ZPT? I
 tried
I think you're looking at this from the wrong side ;)

When you submit a form that contains your select list, then you have
chosen option at REQUEST object. You may get this with:
context.REQUEST.get('name-of-your-parameter')
and pass it into PageTemplate with results.

For example (may be buggy):

Your form with selection list (PageTemplate):
form action=results.html
select name=my_item
option value=1blablabal1/option
option value=2blablabal2/option
/select
/form


results.html (ScriptPython):
my_item = context.REQUEST.get('my_item')
results = context.mySQL(my_item=my_item)
return context.resultPageTemplate(my_item=my_item, results=results)


resultPageTemplate (PageTemplate):
div tal:define=myitem python: options.get('my_item', 0);
 results python: options.get('results', 0)
You've chosen: span tal:replace=my_item/span

div tal:repeat=item results tal:content=item/name/div
/div

-- 
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db