diff options
| author | Jacob Kaplan-Moss | 2009-04-12 18:45:51 -0500 |
|---|---|---|
| committer | Jacob Kaplan-Moss | 2009-04-12 18:45:51 -0500 |
| commit | 1210c461e575e14b4b8eb90f429757456cbea8e0 (patch) | |
| tree | 36675e533662014ca6d7b61b86e1fe5e00719349 /src | |
| parent | 9d86549d74c6d3f4d7e661fd643aee739e268a6d (diff) | |
| download | django-shorturls-1210c461e575e14b4b8eb90f429757456cbea8e0.tar.bz2 | |
Added docs, and fixed a bug that writing the docs revealed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/shorturls/templatetags/shorturl.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/shorturls/templatetags/shorturl.py b/src/shorturls/templatetags/shorturl.py index 5d4ec5e..2eef0ce 100644 --- a/src/shorturls/templatetags/shorturl.py +++ b/src/shorturls/templatetags/shorturl.py @@ -26,19 +26,19 @@ class ShortURL(template.Node): prefix = self.get_prefix(obj) except (AttributeError, KeyError): return '' - + + tinyid = base62.from_decimal(obj.pk) + + if hasattr(settings, 'SHORT_BASE_URL') and settings.SHORT_BASE_URL: + return urlparse.urljoin(settings.SHORT_BASE_URL, prefix+) + try: - url = urlresolvers.reverse('shorturls.views.redirect', kwargs = { + return urlresolvers.reverse('shorturls.views.redirect', kwargs = { 'prefix': prefix, - 'tiny': base62.from_decimal(obj.pk) + 'tiny': tinyid }) except urlresolvers.NoReverseMatch: return '' - - if hasattr(settings, 'SHORT_BASE_URL') and settings.SHORT_BASE_URL: - return urlparse.urljoin(settings.SHORT_BASE_URL, url) - else: - return url def get_prefix(self, model): if not hasattr(self.__class__, '_prefixmap'): |
