aboutsummaryrefslogtreecommitdiff
path: root/dicoweb/templatetags
diff options
context:
space:
mode:
authorWojciech Polak <polak@gnu.org>2013-03-08 20:21:32 +0100
committerWojciech Polak <polak@gnu.org>2013-03-08 20:42:56 +0100
commit8f61a0bf3cd35445dc5cb5c18faf69d3a1d32680 (patch)
tree2c4f046ee1a2c82c400b47ad9ace60c73aac3f9c /dicoweb/templatetags
parent9d08cdfd73267b2fcd84b968258536cbdfad9af2 (diff)
downloaddico-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.py11
-rw-r--r--dicoweb/templatetags/media.py9
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
17from django.template import Library 17from django.template import Library
18 18
19register = Library () 19register = Library()
20 20
21def dictlookup (dict, key): 21
22def 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
27register.filter (dictlookup) 28register.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
17from django.template import Library 17from django.template import Library
18 18
19register = Library () 19register = Library()
20 20
21def media_prefix (): 21
22def 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
29media_prefix = register.simple_tag (media_prefix) 30media_prefix = register.simple_tag(media_prefix)

Return to:

Send suggestions and report system problems to the System administrator.