summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-09-30 13:00:41 -0500
committerDan McGee <dan@archlinux.org>2012-09-30 13:00:41 -0500
commit50daf33d080c9fa85bf10e98b975cc44f6f72314 (patch)
tree79c32eb452ee4cfa1fc088f2c10bb737657ece12
parent0b55ccb67263ad5405c912d9b10346173b399bad (diff)
pkg_details_link template tag enhancements
* Output the blank string when passed None for pkg argument * Allow override of the link text if optional argument passed Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--packages/templatetags/package_extras.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/templatetags/package_extras.py b/packages/templatetags/package_extras.py
index d87a74a5..994265d8 100644
--- a/packages/templatetags/package_extras.py
+++ b/packages/templatetags/package_extras.py
@@ -61,9 +61,13 @@ def do_buildsortqs(parser, token):
@register.simple_tag
-def pkg_details_link(pkg):
+def pkg_details_link(pkg, link_title=None):
+ if not pkg:
+ return ''
+ if link_title is None:
+ link_title = pkg.pkgname
link = '<a href="%s" title="View package details for %s">%s</a>'
- return link % (pkg.get_absolute_url(), pkg.pkgname, pkg.pkgname)
+ return link % (pkg.get_absolute_url(), pkg.pkgname, link_title)
@register.simple_tag