Commit bccbdb90 authored by Ryan Herbert's avatar Ryan Herbert
Browse files

modules/ add tag querying and json conversion functions

parent 175a4d4f
import defs
import re
import json
class TagManager(object):
......@@ -85,3 +86,21 @@ def register_tags(db, table, record_id, text, group_id, reset=False):
tag_prefix = get_tag_prefix()
tag_extractor = TagExtractor(tag_prefix, db)
tags = tag_extractor.execute(table, record_id, text, group_id, reset)
def get_tags(db, group_id, query):
like = '%s%%' % query
return db(( == db.group_tag.tag_id) &
(db.group_tag.group_id == group_id) &
(, case_sensitive=False))
def tags_to_json(tags):
tag_list = []
for tag in tags:
tag_dict = {}
tag_dict['id'] =
tag_dict['value'] =
suggestions = {'suggestions': tag_list}
return json.dumps(suggestions)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment