Mercurial > code > home > repos > href
diff lookup.py @ 22:fa55f4439977
fix autocomplete. less console.log
Ignore-this: 302e2080d044221c430c4eb77ccd4221
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Thu, 11 Jul 2013 01:05:22 -0700 |
parents | 8008ec2fd763 |
children | ab9a6132529a |
line wrap: on
line diff
--- a/lookup.py Thu Jul 11 00:45:55 2013 -0700 +++ b/lookup.py Thu Jul 11 01:05:22 2013 -0700 @@ -116,11 +116,21 @@ def tagFilterComplete(): params = bottle.request.params haveTags = filter(None, params['have'].split(',')) - return {'tags' : [ - {'id': t['label'], - 'text': "%s (%s%s)" % (t['label'], t['count'], " left" if haveTags else "")} - for t in allTags(params.user, - withTags=haveTags)]} + if haveTags and len(haveTags[-1]) > 0: + haveTags, partialTerm = haveTags[:-1], haveTags[-1] + else: + partialTerm = "" + + out = [] + for t in allTags(params.user, withTags=haveTags): + if partialTerm and partialTerm not in t['label']: + continue + out.append({'id': t['label'], + 'text': "%s (%s%s)" % (t['label'], + t['count'], + " left" if haveTags else "")}) + + return {'tags' : out} @bottle.route('/<user>/') def userSlash(user):