diff options
author | Wojciech Polak <polak@gnu.org> | 2013-03-08 20:21:32 +0100 |
---|---|---|
committer | Wojciech Polak <polak@gnu.org> | 2013-03-08 20:42:56 +0100 |
commit | 8f61a0bf3cd35445dc5cb5c18faf69d3a1d32680 (patch) | |
tree | 2c4f046ee1a2c82c400b47ad9ace60c73aac3f9c /dicoweb/templatetags | |
parent | 9d08cdfd73267b2fcd84b968258536cbdfad9af2 (diff) | |
download | dico-8f61a0bf3cd35445dc5cb5c18faf69d3a1d32680.tar.gz dico-8f61a0bf3cd35445dc5cb5c18faf69d3a1d32680.tar.bz2 |
PEP8 code formatting changes.
Update Dicoweb for Django 1.4+
Add requirements.txt file for PIP.
Diffstat (limited to 'dicoweb/templatetags')
-rw-r--r-- | dicoweb/templatetags/dictlookup.py | 11 | ||||
-rw-r--r-- | dicoweb/templatetags/media.py | 9 |
2 files changed, 11 insertions, 9 deletions
diff --git a/dicoweb/templatetags/dictlookup.py b/dicoweb/templatetags/dictlookup.py index e9ea334..870e806 100644 --- a/dicoweb/templatetags/dictlookup.py +++ b/dicoweb/templatetags/dictlookup.py | |||
@@ -1,5 +1,5 @@ | |||
1 | # This file is part of GNU Dico. | 1 | # This file is part of GNU Dico. |
2 | # Copyright (C) 2008-2009, 2012 Wojciech Polak | 2 | # Copyright (C) 2008-2009, 2012, 2013 Wojciech Polak |
3 | # | 3 | # |
4 | # GNU Dico is free software; you can redistribute it and/or modify | 4 | # GNU Dico is free software; you can redistribute it and/or modify |
5 | # it under the terms of the GNU General Public License as published by | 5 | # it under the terms of the GNU General Public License as published by |
@@ -16,12 +16,13 @@ | |||
16 | 16 | ||
17 | from django.template import Library | 17 | from django.template import Library |
18 | 18 | ||
19 | register = Library () | 19 | register = Library() |
20 | 20 | ||
21 | def dictlookup (dict, key): | 21 | |
22 | def dictlookup(dict, key): | ||
22 | try: | 23 | try: |
23 | return dict.get (key, '') | 24 | return dict.get(key, '') |
24 | except KeyError: | 25 | except KeyError: |
25 | return '' | 26 | return '' |
26 | 27 | ||
27 | register.filter (dictlookup) | 28 | register.filter(dictlookup) |
diff --git a/dicoweb/templatetags/media.py b/dicoweb/templatetags/media.py index 961194e..498e1a4 100644 --- a/dicoweb/templatetags/media.py +++ b/dicoweb/templatetags/media.py | |||
@@ -1,5 +1,5 @@ | |||
1 | # This file is part of GNU Dico. | 1 | # This file is part of GNU Dico. |
2 | # Copyright (C) 2008-2009, 2012 Wojciech Polak | 2 | # Copyright (C) 2008-2009, 2012, 2013 Wojciech Polak |
3 | # | 3 | # |
4 | # GNU Dico is free software; you can redistribute it and/or modify | 4 | # GNU Dico is free software; you can redistribute it and/or modify |
5 | # it under the terms of the GNU General Public License as published by | 5 | # it under the terms of the GNU General Public License as published by |
@@ -16,9 +16,10 @@ | |||
16 | 16 | ||
17 | from django.template import Library | 17 | from django.template import Library |
18 | 18 | ||
19 | register = Library () | 19 | register = Library() |
20 | 20 | ||
21 | def media_prefix (): | 21 | |
22 | def media_prefix(): | ||
22 | """Return the string contained in the setting MEDIA_URL.""" | 23 | """Return the string contained in the setting MEDIA_URL.""" |
23 | try: | 24 | try: |
24 | from django.conf import settings | 25 | from django.conf import settings |
@@ -26,4 +27,4 @@ def media_prefix (): | |||
26 | return '' | 27 | return '' |
27 | return settings.MEDIA_URL | 28 | return settings.MEDIA_URL |
28 | 29 | ||
29 | media_prefix = register.simple_tag (media_prefix) | 30 | media_prefix = register.simple_tag(media_prefix) |