Hi,

I'm new to w2p and would like to incorporate tag cloud function into
my site but can't seem to convert a dictionary to a list from a
database query result. Can anyone help me with this?

def gen_tags():

    #tags = ['java','php','python','python']
    query=db.tags.id>0
    tags = db(query).select(db.tags.word)
    # results show--- tags.word indian italian spanish indian
    words = {}
    for x in (' '.join(tags)).split():
        words[x] = 1 + words.get(x, 0)
    return ' '.join([('<font size="%d">%s</font>'%(min(1+p*5/max
(words.values()), 5), x)) for (x, p) in words.items()])


thanks in advance.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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