Skip to content
Browse files

Add some optimizations.

  • Loading branch information...
1 parent 453619f commit aacc697e313631cc038e8d751d179a578775ccc6 @adaptivelogic adaptivelogic committed Nov 29, 2012
Showing with 4 additions and 12 deletions.
  1. +3 −11 cms/utils/i18n.py
  2. +1 −1 setup.py
View
14 cms/utils/i18n.py
@@ -85,7 +85,6 @@ def get_language_object(language_code, site_id=None):
:param language_code: RFC5646 language code
:return: the language object filled up by defaults
"""
- site_id = get_site(site_id)
for language in get_languages(site_id):
if language['code'] == language_code:
return language
@@ -96,11 +95,7 @@ def get_language_objects(site_id=None):
"""
returns list of all language objects filled up by default values
"""
- site_id = get_site(site_id)
- languages = []
- for language in get_languages(site_id):
- languages.append(get_language_object(language['code'], site_id))
- return languages
+ return list(get_languages(site_id))
def get_default_language(language_code=None):
@@ -133,7 +128,6 @@ def get_fallback_languages(language, site_id=None):
"""
returns a list of fallback languages for the given language
"""
- site_id = get_site(site_id)
language = get_language_object(language, site_id)
return language.get('fallbacks', [])
@@ -144,7 +138,6 @@ def get_redirect_on_fallback(language, site_id=None):
:param site_id:
:return: Boolean
"""
- site_id = get_site(site_id)
language = get_language_object(language, site_id)
return language.get('redirect_on_fallback', True)
@@ -155,6 +148,5 @@ def hide_untranslated(language, site_id=None):
:param site_id:
:return: A Boolean
"""
- site_id = get_site(site_id)
- language = get_language_object(language, site_id)
- return language.get('hide_untranslated', True)
+ obj = get_language_object(language, site_id)
+ return obj.get('hide_untranslated', True)
View
2 setup.py
@@ -36,7 +36,7 @@
'django-sekizai>=0.6.1',
],
tests_require=[
- 'django-reversion==1.6',
+ 'django-reversion>=1.6',
'Pillow==1.7.7',
'Sphinx==1.1.3',
'Jinja2==2.6',

0 comments on commit aacc697

Please sign in to comment.
Something went wrong with that request. Please try again.