| home | about me | feed RSS feed

In correcting a small design flaw in this blog's software I ever-so-slightly reduced the amount of code used.
So instead of this potentially unreliable method of retrieving entities:

qry = models.BlogPost.all()
qry.filter('uri = ', blog_uri)
blog_post = qry.get()

we now just do this:

blog_post = models.BlogPost.get_by_id(int(id))

where id comes to the request handler via GET parameter.
Because id is auto-generated by App Engine, there was no need to alter the model :-)
Thanks for reading.

created: 2010-03-13 | updated: 2010-03-19


comments:
on 2010-04-06 Miruska wrote:

moc hezky, that's pretty good reduction from 3 lines only 1, good job :-)

Comments are now closed for this post.