-> This is a newbie question.
->
-> I am trying to display a query from a sql table using quixote. If I want
-> to do a simple query it works very elegantly, for example with a simple
-> URL:
->
-> http://myserver/showuserdetail/
->
-> I can write a function for "showuserdetail" and use the _q_lookup
-> function to access the and pass it onto the SQL query
->
-> But suppose I want user statistics for the month of November. What do I
-> use for a URL:
->
-> http://myserver/showuserstatistics//November
->
-> or
->
-> http://myserver/showuserstatistics/?month=November
->
-> and how do I write an "elegant" function to access the required
-> variables?
Hi, Ian,
First, make the page an object instead, i.e. have
'showuserdetail' use _q_lookup to load 'username' and then return a
subclass of Directory. Then you can add _q_lookup to *that* class and
have it do the query on "November".
In your specific case, I'd almost prefer the 2nd URL hierarchy, because
it makes clear that you're talking about 'month'. For that you can just
use request.form and iterate over the keys to construct your SQL query.
Hope that helps; let me know if you want more detail ;)
--titus