Here's a suggestion - there might be better ways to get where you want
to go, of course. This tries to minimize the changes to your existing
code.

Since you can't work with more than one table at a time with GAE, you
could change your GAE 'cats' query to work with only one table, then
perform a lookup for each resulting row.

so this:
>     cats=db((db.posts.id == post_id) & (db.posts.post_category ==
> db.categories.id)).select(db.categories.ALL)

would become this:
     posts=db((db.posts.id == post_id).select
(db.posts.post_category).as_list()
     cats=[]
     for p in posts
          cats.append({
               db((db.categories.id == p).select
(db.categories.category_name,db.categories.category_tip)
          })


On Jun 22, 9:20 am, 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