Found the solution in the end, had to add another loop to change it
from SQLROW to list, then to dictionary. Thanks, Fran.
def gen_tags():
#tags = ['java','php','python','python']
query=db.tags.id>0
tags = db(query).select(db.tags.ALL)
# results show--- tags.word indian italian spanish indian
mytags= []
for tag in tags:
mytags.append(tag.word)
words = {}
for x in (' '.join(mytags)).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()])
On Aug 13, 3:41 pm, DenesL <[email protected]> wrote:
> words=[t.word for t in tags]
>
> Font size by tag density requires some thought, maybe later.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---