On Jan 17, 2011, at 4:43 AM, Johann Spies wrote:
> In the shell this works:
> 
> In [7]: print db._lastsql
> ------> print(db._lastsql)
> SELECT count(*) FROM artikel WHERE (artikel.id > 0)
> 
> In [8]: query = db.artikel.id > 0
> 
> In [9]: l = db(query).count()
> 
> In [10]: print db._lastsql
> -------> print(db._lastsql)
> SELECT count(*) FROM artikel WHERE (artikel.id > 0)
> 
> However when I use it in a controller like this:
> 
> query = db.artikel.id > 0
> total_found = db(query).count()
> redirect(URL('list_records', vars = dict(
>         table = db.artikel,
>         query = query,
>         total_found = total_found ,
>         flds = ()
>         )))
> 
> 
> Then I found in 'list_records' that the request vars look like this:
> 
> <Storage {'query': '(artikel.id > 0)', 'table': 'artikel'}>
> 
> So what happened to total_found and flds?

You might try putting this just before the redirect:

        session.flash = URL('list_records', vars=... (same as above))

...and see what that shows you. That is, see what URL is generating before it 
goes through the redirection.

Something to consider (not necessarily having to do with the disappearing 
items) is that the encoding of a URL query string is strictly a string 
encoding; there's no preservation of Python objects. So for example flds is 
going to come back (if it comes back) as the string '()', not as an empty 
tuple. You can get it back with eval(), of course, but that opens a pretty big 
security hole.

Reply via email to