On Friday, March 23, 2012 6:09:30 PM UTC-4, Anthony wrote: > > There is also an .as_list() method, which converts to a list of > dictionaries rather than a dictionary of dictionaries. You can also just > store Rows objects directly in the session or cache -- the DAL defines a > reduction function that calls the .as_list() method when a Rows object is > pickled, so you don't have to call the method manually.
as_dict() and as_list() are both very helpful. A caveat that I've noticed with them, however, is that as_dict() defaults to leaving datetime fields as-is (you can override that to convert them to string), whereas as_list() defaults to converting datetime fields to string (you can override that so that they stay as-is). While this is not going to change because of backward compatibility issues, I think this deserves more attention in the documentation. I have a few things to contribute to a "web2py caveats" page if one was to be put on web2py.com -- things that people find unintuitive and surprising about web2py (which is, in general, has a very logical coherent structure with almost no surprises).

