diff --git a/CHANGES b/CHANGES
index 2678877..ae0c249 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,7 @@ Version 0.7.3
* Added support for the Azure translation API, replacing the BING API. (Issue #86, thanks @davidkuchar and @maikelwever)
* Removed support for the signed_cookies SESSION_ENGINE + SessionRosettaStorage in Django 1.6, because serialization of POFiles would fail
* Simplified the group membership test (Issue #90 - Thanks @dotsbb)
+* Dropped Django 1.3 support
Version 0.7.2
-------------
diff --git a/MANIFEST.in b/MANIFEST.in
index d07c984..4591a1a 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -4,6 +4,7 @@ exclude *.pyc
exclude *.sh
recursive-include rosetta/locale *
recursive-include rosetta/tests *
+recursive-include rosetta/utils *
recursive-include rosetta/templates *
prune testproject
prune rosetta/tests/__pycache__
diff --git a/rosetta/templates/rosetta/base.html b/rosetta/templates/rosetta/base.html
index 79a5085..4906bc1 100644
--- a/rosetta/templates/rosetta/base.html
+++ b/rosetta/templates/rosetta/base.html
@@ -1,12 +1,12 @@
-{% load url from future %}
+{% load url from future %}{% load admin_static %}
{% block pagetitle %}Rosetta{% endblock %}
-
-
-
+
+
+
diff --git a/rosetta/views.py b/rosetta/views.py
index 8e47a1d..543b21f 100644
--- a/rosetta/views.py
+++ b/rosetta/views.py
@@ -156,7 +156,7 @@ def home(request):
post_save.send(sender=None, language_code=rosetta_i18n_lang_code, request=request)
# Try auto-reloading via the WSGI daemon mode reload mechanism
- if rosetta_settings.WSGI_AUTO_RELOAD and \
+ if rosetta_settings.WSGI_AUTO_RELOAD and \
'mod_wsgi.process_group' in request.environ and \
request.environ.get('mod_wsgi.process_group', None) and \
'SCRIPT_FILENAME' in request.environ and \
@@ -338,7 +338,7 @@ def list_languages(request, do_session_warn=False):
languages.append(
(language[0],
_(language[1]),
- sorted([(get_app_name(l), os.path.realpath(l), pofile(l)) for l in pos], key=lambda app: app[0]),
+ sorted([(get_app_name(l), os.path.realpath(l), pofile(l)) for l in pos], key=lambda app: app[0]),
)
)
try:
@@ -382,7 +382,7 @@ def lang_sel(request, langid, idx):
storage.set('rosetta_i18n_lang_code', langid)
storage.set('rosetta_i18n_lang_name', six.text_type([l[1] for l in settings.LANGUAGES if l[0] == langid][0]))
- storage.set('rosetta_i18n_fn', file_)
+ storage.set('rosetta_i18n_fn', file_)
po = pofile(file_)
for entry in po:
entry.md5hash = hashlib.new('md5',
@@ -400,13 +400,15 @@ def lang_sel(request, langid, idx):
return HttpResponseRedirect(reverse('rosetta-home'))
+
+@user_passes_test(lambda user: can_translate(user), settings.LOGIN_URL)
def translate_text(request):
language_from = request.GET.get('from', None)
language_to = request.GET.get('to', None)
text = request.GET.get('text', None)
if language_from == language_to:
- data = { 'success' : True, 'translation' : text }
+ data = {'success': True, 'translation': text}
else:
# run the translation:
AZURE_CLIENT_ID = getattr(settings, 'AZURE_CLIENT_ID', None)
@@ -416,8 +418,8 @@ def translate_text(request):
try:
translated_text = translator.translate(text, language_to)
- data = { 'success' : True, 'translation' : translated_text }
+ data = {'success': True, 'translation': translated_text}
except TranslateApiException as e:
- data = { 'success' : False, 'error' : "Translation API Exception: {0}".format(e.message) }
+ data = {'success': False, 'error': "Translation API Exception: {0}".format(e.message)}
return HttpResponse(json.dumps(data), mimetype='application/json')
diff --git a/runtests_multi_venv.sh b/runtests_multi_venv.sh
index febfd82..302e01e 100755
--- a/runtests_multi_venv.sh
+++ b/runtests_multi_venv.sh
@@ -1,12 +1,5 @@
#!/bin/bash
-if [ ! -d .venv_13 ]
-then
- virtualenv --no-site-packages --distribute --python=python2 .venv_13
- . .venv_13/bin/activate
- pip install --use-mirrors Django==1.3 coverage python-memcached six requests==2.1.0
- deactivate
-fi
if [ ! -d .venv_14 ]
then
virtualenv --no-site-packages --distribute --python=python2 .venv_14
@@ -43,14 +36,6 @@ then
deactivate
fi
-. .venv_13/bin/activate
-cd testproject
-python manage.py --version
-python --version
-python manage.py test rosetta
-cd ..
-deactivate
-
. .venv_14/bin/activate
cd testproject
python manage.py --version