X-Git-Url: http://git.veekun.com/zzz-floof.git/blobdiff_plain/36dba08534b4309de0e0746784e2a6c5bb854030..83db05b7c671b4736dc83393b8ff4e90943a9793:/floof/lib/tags.py diff --git a/floof/lib/tags.py b/floof/lib/tags.py index 9bfdf04..134ba6f 100644 --- a/floof/lib/tags.py +++ b/floof/lib/tags.py @@ -2,6 +2,9 @@ from floof.model import Art, ArtUser, ArtUserType, Tag, TagText, User import elixir from dbhelpers import find_or_create import re + +from pylons import c + def parse(search_string): """Parses a search query, and returns a query object on Art. @@ -25,6 +28,8 @@ def parse(search_string): # This is a special tag; at the moment, by/for/of to indicate # related users prefix, tag = tag.split(':', 1) + if tag == 'me': + tag = c.user.name # XXX what to do if this fails? abort? return empty query? target_user = User.get_by(name=tag) @@ -93,7 +98,10 @@ def add_tags(art, tag_string, user): # Do work! if prefix: - target_user = User.get_by(name=tag_text) + if tag_text == 'me': + target_user = c.user + else: + target_user = User.get_by(name=tag_text) # Special tag; at the moment, just a relationship if prefix == 'by':