fnp
/
prawokultury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Contact forms app.
[prawokultury.git]
/
prawokultury
/
helpers.py
diff --git
a/prawokultury/helpers.py
b/prawokultury/helpers.py
index
5877e0b
..
9b943de
100644
(file)
--- a/
prawokultury/helpers.py
+++ b/
prawokultury/helpers.py
@@
-3,6
+3,7
@@
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.conf import settings
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.conf import settings
+from django.http import HttpResponse, HttpResponseRedirect
from textile import Textile
from textile import Textile
@@
-23,7
+24,7
@@
def textile_restricted_pl(text):
text, rel='nofollow')
text, rel='nofollow')
-class LazyUGettextLazy():
+class LazyUGettextLazy(
object
):
"""You can use it to internationalize strings in settings.
Just import this class as gettext.
"""You can use it to internationalize strings in settings.
Just import this class as gettext.
@@
-64,3
+65,13
@@
class AppSettings(object):
if hasattr(self, more):
value = getattr(self, more)(value)
return value
if hasattr(self, more):
value = getattr(self, more)(value)
return value
+
+
+def serve_file(url):
+ if settings.X_ACCEL_REDIRECT:
+ response = HttpResponse()
+ response['Content-Type'] = ""
+ response['X-Accel-Redirect'] = url
+ return response
+ else:
+ return HttpResponseRedirect(url)