diff options
author | Dan McGee <dan@archlinux.org> | 2012-09-30 20:00:41 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-09-30 20:00:41 +0200 |
commit | 50daf33d080c9fa85bf10e98b975cc44f6f72314 (patch) | |
tree | 79c32eb452ee4cfa1fc088f2c10bb737657ece12 | |
parent | 0b55ccb67263ad5405c912d9b10346173b399bad (diff) | |
download | archweb-50daf33d080c9fa85bf10e98b975cc44f6f72314.tar.gz archweb-50daf33d080c9fa85bf10e98b975cc44f6f72314.tar.xz |
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.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/templatetags/package_extras.py b/packages/templatetags/package_extras.py index d87a74a..994265d 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 |