diff options
author | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2011-01-19 00:42:18 -0300 |
---|---|---|
committer | Nicolás Reynolds <fauno@kiwwwi.com.ar> | 2011-01-19 00:42:18 -0300 |
commit | 27d7ccd7a928da74a881cf4fbd508e23613780fa (patch) | |
tree | ebed6ca44c1a5512b272685234ddfbb76fba76d8 /packages/templatetags/package_extras.py | |
parent | 755a03d279631138cb982dc07b2d67b341a4f99c (diff) | |
parent | 523a15f81e819379d1d9ae8412ebd8a7c017a512 (diff) |
Merge branch 'master' of git://projects.archlinux.org/archweb
Conflicts:
templates/devel/clock.html
templates/packages/group_details.html
templates/packages/groups.html
Diffstat (limited to 'packages/templatetags/package_extras.py')
-rw-r--r-- | packages/templatetags/package_extras.py | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/packages/templatetags/package_extras.py b/packages/templatetags/package_extras.py index 3cd2b91b..d59a5562 100644 --- a/packages/templatetags/package_extras.py +++ b/packages/templatetags/package_extras.py @@ -31,29 +31,16 @@ def do_buildsortqs(parser, token): "%r tag's argument should be in quotes" % tagname) return BuildQueryStringNode(sortfield[1:-1]) -@register.tag -def userpkgs(parser, token): - try: - tagname, user = token.split_contents() - except ValueError: - raise template.TemplateSyntaxError( - "%r tag requires a single argument" % tagname) - return UserPkgsNode(user) - -class UserPkgsNode(template.Node): - def __init__(self, user): - self.user = template.Variable(user) +@register.simple_tag +def userpkgs(user): + if user: + # TODO don't hardcode + title = escape('View packages maintained by ' + user.get_full_name()) + return '<a href="/packages/?maintainer=%s" title="%s">%s</a>' % ( + user.username, + title, + user.get_full_name(), + ) + return '' - def render(self, context): - try: - real_user = self.user.resolve(context) - # TODO don't hardcode - title = escape('View packages maintained by ' + real_user.get_full_name()) - return '<a href="/packages/search/?maintainer=%s" title="%s">%s</a>' % ( - real_user.username, - title, - real_user.get_full_name(), - ) - except template.VariableDoesNotExist: - return '' - pass +# vim: set ts=4 sw=4 et: |