views:

25

answers:

1

I'm looking for the best way to pull info from the datastore into a list (with the intention of outputting to ReportLab to generate a pdf). Is there a way to do it besides looping through the output, and creating a list from it?

+2  A: 

Per the source fetch() returns a list:

Returns: A list of db.Model instances...

The results of that query will look something like this:

[<models.YourModel object at 0x02641B30>, 
<models.YourModel object at 0x02641B70>]

Edit:
And then to get certain attributes of the model instances you'd do something like this:

values = [(model.name, model.type, model.source) 
          for model 
          in models_returned_from_query]

I don't know of any further shortcut for the above.

Adam Bernier
Unfortunately I need the results themselves, not just the object instances. For ex: [['john', 'cat', 'store'],['charlie','dog','shelter']]
etc