http 422, better tagcloud, possibly fixed firbird issue with tagcloud

This commit is contained in:
mdipierro
2012-09-27 14:05:43 -05:00
parent ded6b0579d
commit 4efd08a66f
3 changed files with 16 additions and 11 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.0.9 (2012-09-26 12:45:50) stable Version 2.0.9 (2012-09-27 14:05:37) stable
+1
View File
@@ -42,6 +42,7 @@ defined_status = {
415: 'UNSUPPORTED MEDIA TYPE', 415: 'UNSUPPORTED MEDIA TYPE',
416: 'REQUESTED RANGE NOT SATISFIABLE', 416: 'REQUESTED RANGE NOT SATISFIABLE',
417: 'EXPECTATION FAILED', 417: 'EXPECTATION FAILED',
422: 'UNPROCESSABLE ENTITY',
500: 'INTERNAL SERVER ERROR', 500: 'INTERNAL SERVER ERROR',
501: 'NOT IMPLEMENTED', 501: 'NOT IMPLEMENTED',
502: 'BAD GATEWAY', 502: 'BAD GATEWAY',
+14 -10
View File
@@ -4953,18 +4953,22 @@ class Wiki(object):
ids = db(db.wiki_tag).select( ids = db(db.wiki_tag).select(
db.wiki_tag.name,count, db.wiki_tag.name,count,
distinct=True, distinct=True,
orderby=~count,limitby=(0,20)) groupby = db.wiki_tag.name,
orderby = ~count, limitby=(0,20))
if ids: if ids:
a,b = ids[0](count), ids[-1](count) a,b = ids[0](count), ids[-1](count)
def scale(c): def style(c):
return '%.2f' % (3.0*(c-b)/max(a-b,1)+1) STYLE ='padding:0 0.2em;line-height:%.2fem;font-size:%.2fem'
items = [A(item.wiki_tag.name, size = (1.5*(c-b)/max(a-b,1)+1.3)
_style='padding:0.2em;font-size:%sem' \ return STYLE % (1.3,size)
% scale(item(count)), items = []
_href=URL(args='_search', for item in ids:
vars=dict(q=item.wiki_tag.name))) items.append(A(item.wiki_tag.name,
for item in ids] _style=style(item(count)),
return dict(content=DIV(_class='w2p_cloud',*items)) _href=URL(args='_search',
vars=dict(q=item.wiki_tag.name))))
items.append(' ')
return dict(content = DIV(_class='w2p_cloud',*items))
if __name__ == '__main__': if __name__ == '__main__':
import doctest import doctest