EDIT:

I got it quite literally two minutes after I posted.

Turns out for my query line, instead of writing "author =
db.query("SELECT * FROM items WHERE id = $id", vars = {"id": id})", it
needed to be "author = db.query("SELECT * FROM items WHERE id = $id",
vars = {"id": id}).list()[0]["author"]".

Everything works perfectly now!!

On Aug 2, 10:23 pm, Milo Gertjejansen <[email protected]> wrote:
> I am building a comment system where I have the ability to edit posts
> for moderation. To get the data out of the MySQL database and assign
> it to a variable I use "author = db.query(SELECT * FROM items WHERE id
> = $id", vars = {"id": id})"
>
> This queries the database as shown in the cli server (ran with
> python2), but it returns the value "<web.utils.IterBetter instance at
> 0x9dc44ec>".
>
> I need this to be a string (in this case, the author). I have tried
> "$author.__name__" in the templates, "author = str(type(author))" and
> "author = type(author).__name__" in my main.py.
>
> Any insight as to how to do this?

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to