Hi, in GAE it's better to denormalize, so place the post_category
fields directly as a fields on the the posts db, and write the values
when the post is made.
This way you only have to work wth the post table and there is no need
to perform a join.


On Mon, Jun 22, 2009 at 6:20 PM, ProfessionalIT<lsever...@gmail.com> wrote:
>
> Hans,
>
>   I Have this code:
>
>   def get_post_cats(post_id):
>    cats=db((db.posts.id == post_id) & (db.posts.post_category ==
> db.categories.id)).select(db.categories.ALL)
>    items=[]
>    for cat in cats:
>        item="<a href='/category/%(cat)s' title='%(tip)s'>%(name)s</
> a>" % {'app':request.application, 'cat':cat.category_name,
> 'name':cat.category_name, 'tip':cat.category_tip}
>        items.append(item)
>    pass
>    cat_list=", ".join(items)
>    return XML(cat_list)
>
>   How to transform this code to run in GAE ?
>
>   ps: I'm sorry but I'm a Python dummie programmer.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to