aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-03 11:18:05 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-03 11:18:05 +0200
commit2dd17dee314439fe85be80e67b390bc5280f1722 (patch)
tree2ab742f010fe14ff1f73962d2c31e32c85b9f971
parentUsing datetime filter in all templates. (diff)
downloadnewspipe-2dd17dee314439fe85be80e67b390bc5280f1722.tar.gz
newspipe-2dd17dee314439fe85be80e67b390bc5280f1722.tar.bz2
newspipe-2dd17dee314439fe85be80e67b390bc5280f1722.zip
Available time zonez are defined in conf.py.
-rw-r--r--conf.py5
-rw-r--r--pyaggr3g470r/__init__.py13
-rw-r--r--pyaggr3g470r/views.py4
3 files changed, 10 insertions, 12 deletions
diff --git a/conf.py b/conf.py
index 98bb03d9..74aa834b 100644
--- a/conf.py
+++ b/conf.py
@@ -17,6 +17,11 @@ LANGUAGES = {
'fr': 'French'
}
+TIME_ZONE = {
+ "en": "US/Eastern",
+ "fr": "Europe/Paris"
+}
+
ON_HEROKU = int(os.environ.get('HEROKU', 0)) == 1
if not ON_HEROKU:
diff --git a/pyaggr3g470r/__init__.py b/pyaggr3g470r/__init__.py
index 708598b1..e4023f37 100644
--- a/pyaggr3g470r/__init__.py
+++ b/pyaggr3g470r/__init__.py
@@ -5,6 +5,7 @@ import os
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.babel import Babel
+from flask.ext.babel import format_datetime
from flask.ext.gravatar import Gravatar
import conf
@@ -20,16 +21,6 @@ db = SQLAlchemy(app)
ALLOWED_EXTENSIONS = set(['xml', 'opml'])
-
-from flask.ext.babel import format_datetime
-app.jinja_env.filters['datetime'] = format_datetime
-
-TIME_ZONE = {
- "en": "US/Eastern",
- "fr": "Europe/Paris"
- }
-
-
def allowed_file(filename):
"""
Check if the uploaded file is allowed.
@@ -39,6 +30,8 @@ def allowed_file(filename):
babel = Babel(app)
+app.jinja_env.filters['datetime'] = format_datetime
+
# Gravatar
gravatar = Gravatar(app, size=100, rating='g', default='retro',
force_default=False, use_ssl=False, base_url=None)
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 1fb1658c..76343ead 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -42,7 +42,7 @@ import export
if not conf.ON_HEROKU:
import search as fastsearch
from forms import SigninForm, AddFeedForm, ProfileForm
-from pyaggr3g470r import app, db, allowed_file, babel, TIME_ZONE
+from pyaggr3g470r import app, db, allowed_file, babel
from pyaggr3g470r.models import User, Feed, Article, Role
from pyaggr3g470r.decorators import feed_access_required
@@ -122,7 +122,7 @@ def get_locale():
@babel.timezoneselector
def get_timezone():
- return TIME_ZONE[get_locale()]
+ return conf.TIME_ZONE[get_locale()]
#
# Views.
bgstack15