Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

renamed cms.utils.conf.get_setting to get_cms_setting

  • Loading branch information...
commit 1cba5ee6fe7a5c0c3dc9a22abae547789fe318e9 1 parent 606fb53
@ojii ojii authored
Showing with 160 additions and 160 deletions.
  1. +3 −3 cms/admin/change_list.py
  2. +2 −2 cms/admin/dialog/views.py
  3. +3 −3 cms/admin/forms.py
  4. +28 −28 cms/admin/pageadmin.py
  5. +2 −2 cms/admin/permissionadmin.py
  6. +4 −4 cms/admin/placeholderadmin.py
  7. +2 −2 cms/admin/useradmin.py
  8. +4 −4 cms/api.py
  9. +2 −2 cms/apphook_pool.py
  10. +3 −3 cms/cache/permissions.py
  11. +2 −2 cms/cms_toolbar.py
  12. +2 −2 cms/context_processors.py
  13. +5 −5 cms/forms/utils.py
  14. +3 −3 cms/menu.py
  15. +2 −2 cms/models/managers.py
  16. +10 −10 cms/models/pagemodel.py
  17. +2 −2 cms/models/pluginmodel.py
  18. +3 −3 cms/models/query.py
  19. +2 −2 cms/plugin_base.py
  20. +3 −3 cms/plugin_rendering.py
  21. +2 −2 cms/plugins/text/widgets/tinymce_widget.py
  22. +3 −3 cms/signals.py
  23. +2 −2 cms/templatetags/cms_admin.py
  24. +3 −3 cms/templatetags/cms_tags.py
  25. +2 −2 cms/test_utils/project/noadmin_urls.py
  26. +2 −2 cms/test_utils/project/nonroot_urls.py
  27. +2 −2 cms/test_utils/project/second_urls_for_apphook_tests.py
  28. +2 −2 cms/test_utils/project/urls.py
  29. +2 −2 cms/test_utils/project/urls_for_apphook_tests.py
  30. +5 −5 cms/tests/admin.py
  31. +2 −2 cms/tests/menu.py
  32. +4 −4 cms/tests/multilingual.py
  33. +4 −4 cms/tests/page.py
  34. +2 −2 cms/tests/templatetags.py
  35. +3 −3 cms/tests/toolbar.py
  36. +5 −5 cms/utils/__init__.py
  37. +5 −5 cms/utils/admin.py
  38. +2 −2 cms/utils/check.py
  39. +6 −6 cms/utils/conf.py
  40. +5 −5 cms/utils/i18n.py
  41. +2 −2 cms/utils/permissions.py
  42. +2 −2 cms/utils/placeholder.py
  43. +4 −4 docs/upgrade/2.4.rst
  44. +2 −2 menus/menu_pool.py
View
6 cms/admin/change_list.py
@@ -3,7 +3,7 @@
from collections import defaultdict
from cms.exceptions import NoHomeFound
from cms.models import Title, Page, PageModeratorState
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from cms.utils.permissions import get_user_sites_queryset
from django.conf import settings
from django.contrib.admin.views.main import ChangeList, ALL_VAR, IS_POPUP_VAR, \
@@ -146,7 +146,7 @@ def set_items(self, request):
# using the ids dictionary means this check is constant time
page.root_node = page.parent_id not in ids
- if get_setting('PERMISSION'):
+ if get_cms_setting('PERMISSION'):
# caching the permissions
page.permission_edit_cache = perm_edit_ids == Page.permissions.GRANT_ALL or page.pk in perm_edit_ids
page.permission_publish_cache = perm_publish_ids == Page.permissions.GRANT_ALL or page.pk in perm_publish_ids
@@ -205,7 +205,7 @@ def set_sites(self, request):
"""Sets sites property to current instance - used in tree view for
sites combo.
"""
- if get_setting('PERMISSION'):
+ if get_cms_setting('PERMISSION'):
self.sites = get_user_sites_queryset(request.user)
else:
self.sites = Site.objects.all()
View
4 cms/admin/dialog/views.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from cms.admin.dialog.forms import PermissionForm
from cms.models import Page
-from cms.utils import get_setting
+from cms.utils import get_cms_setting
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.http import Http404, HttpResponse
@@ -9,7 +9,7 @@
@staff_member_required
def get_copy_dialog(request, page_id):
- if not get_setting('PERMISSION'):
+ if not get_cms_setting('PERMISSION'):
return HttpResponse('')
page = get_object_or_404(Page, pk=page_id)
View
6 cms/admin/forms.py
@@ -4,7 +4,7 @@
from cms.forms.widgets import UserSelectAdminWidget
from cms.models import (Page, PagePermission, PageUser, ACCESS_PAGE,
PageUserGroup)
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from cms.utils.i18n import get_language_tuple, get_language_list
from cms.utils.mail import mail_page_user_change
from cms.utils.page import is_valid_page_slug
@@ -81,8 +81,8 @@ def __init__(self, *args, **kwargs):
if not self.fields['language'].initial:
self.fields['language'].initial = get_language()
if (self.fields['parent'].initial and
- get_setting('TEMPLATE_INHERITANCE') in
- [name for name, value in get_setting('TEMPLATES')]):
+ get_cms_setting('TEMPLATE_INHERITANCE') in
+ [name for name, value in get_cms_setting('TEMPLATES')]):
# non-root pages default to inheriting their template
self.fields['template'].initial = constants.TEMPLATE_INHERITANCE_MAGIC
View
56 cms/admin/pageadmin.py
@@ -2,7 +2,7 @@
from copy import deepcopy
from distutils.version import LooseVersion
from urllib2 import unquote
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
import django
from django.conf import settings
@@ -74,7 +74,7 @@ def get_prepopulated_fields(self, request):
def contribute_fieldsets(cls):
- if get_setting('MENU_TITLE_OVERWRITE'):
+ if get_cms_setting('MENU_TITLE_OVERWRITE'):
general_fields = [('title', 'menu_title')]
else:
general_fields = ['title']
@@ -84,19 +84,19 @@ def contribute_fieldsets(cls):
template_fields = ['template']
hidden_fields = ['site', 'parent']
seo_fields = []
- if get_setting('SOFTROOT'):
+ if get_cms_setting('SOFTROOT'):
advanced_fields.append('soft_root')
- if get_setting('SHOW_START_DATE') and get_setting('SHOW_END_DATE'):
+ if get_cms_setting('SHOW_START_DATE') and get_cms_setting('SHOW_END_DATE'):
general_fields.append(('publication_date', 'publication_end_date'))
- elif get_setting('SHOW_START_DATE'):
+ elif get_cms_setting('SHOW_START_DATE'):
general_fields.append('publication_date')
- elif get_setting('SHOW_END_DATE'):
+ elif get_cms_setting('SHOW_END_DATE'):
general_fields.append('publication_end_date')
- if get_setting('SEO_FIELDS'):
+ if get_cms_setting('SEO_FIELDS'):
seo_fields = ['page_title', 'meta_description', 'meta_keywords']
- if not get_setting('URL_OVERWRITE'):
+ if not get_cms_setting('URL_OVERWRITE'):
advanced_fields.remove("overwrite_url")
- if not get_setting('REDIRECTS'):
+ if not get_cms_setting('REDIRECTS'):
advanced_fields.remove('redirect')
if menu_pool.get_menus_by_attribute("cms_enabled", True):
advanced_fields.append("navigation_extenders")
@@ -123,7 +123,7 @@ def contribute_fieldsets(cls):
}),
]
- if get_setting('SEO_FIELDS'):
+ if get_cms_setting('SEO_FIELDS'):
fieldsets.append((_("SEO Settings"), {
'fields': seo_fields,
'classes': ('collapse',),
@@ -139,7 +139,7 @@ def contribute_fieldsets(cls):
def contribute_list_filter(cls):
list_filter = ['published', 'in_navigation', 'template', 'changed_by']
- if get_setting('SOFTROOT'):
+ if get_cms_setting('SOFTROOT'):
list_filter.append('soft_root')
setattr(cls, 'list_filter', list_filter)
@@ -304,7 +304,7 @@ def get_fieldsets(self, request, obj=None):
advanced = given_fieldsets.pop(3)
if obj.has_advanced_settings_permission(request):
given_fieldsets.append(advanced)
- if get_setting('SEO_FIELDS'):
+ if get_cms_setting('SEO_FIELDS'):
seo = given_fieldsets.pop(3)
given_fieldsets.append(seo)
else: # new page
@@ -330,7 +330,7 @@ def get_form(self, request, obj=None, **kwargs):
elif 'published' in self.exclude:
self.exclude.remove('published')
- if not get_setting('SOFTROOT') and 'soft_root' in self.exclude:
+ if not get_cms_setting('SOFTROOT') and 'soft_root' in self.exclude:
self.exclude.remove('soft_root')
form = super(PageAdmin, self).get_form(request, obj, **kwargs)
@@ -359,9 +359,9 @@ def get_form(self, request, obj=None, **kwargs):
form.base_fields['overwrite_url'].initial = title_obj.path
else:
form.base_fields['overwrite_url'].initial = ""
- if get_setting('TEMPLATES'):
+ if get_cms_setting('TEMPLATES'):
selected_template = get_template_from_request(request, obj)
- template_choices = list(get_setting('TEMPLATES'))
+ template_choices = list(get_cms_setting('TEMPLATES'))
form.base_fields['template'].choices = template_choices
form.base_fields['template'].initial = force_unicode(selected_template)
@@ -440,13 +440,13 @@ def get_form(self, request, obj=None, **kwargs):
form.base_fields[name].initial = u''
form.base_fields['parent'].initial = request.GET.get('target', None)
form.base_fields['site'].initial = request.session.get('cms_admin_site', None)
- form.base_fields['template'].initial = get_setting('TEMPLATES')[0][0]
+ form.base_fields['template'].initial = get_cms_setting('TEMPLATES')[0][0]
return form
def get_inline_instances(self, request):
inlines = super(PageAdmin, self).get_inline_instances(request)
- if get_setting('PERMISSION') and hasattr(self, '_current_page')\
+ if get_cms_setting('PERMISSION') and hasattr(self, '_current_page')\
and self._current_page:
filtered_inlines = []
for inline in inlines:
@@ -487,7 +487,7 @@ def change_view(self, request, object_id, extra_context=None):
context = {
'placeholders': self.get_fieldset_placeholders(selected_template),
'page': obj,
- 'CMS_PERMISSION': get_setting('PERMISSION'),
+ 'CMS_PERMISSION': get_cms_setting('PERMISSION'),
'ADMIN_MEDIA_URL': settings.STATIC_URL,
'can_change': obj.has_change_permission(request),
'can_change_permissions': obj.has_change_permissions_permission(request),
@@ -554,7 +554,7 @@ def has_add_permission(self, request):
"""
Return true if the current user has permission to add a new page.
"""
- if get_setting('PERMISSION'):
+ if get_cms_setting('PERMISSION'):
return permissions.has_page_add_permission(request)
return super(PageAdmin, self).has_add_permission(request)
@@ -563,7 +563,7 @@ def has_change_permission(self, request, obj=None):
Return true if the current user has permission on the page.
Return the string 'All' if the user has all rights.
"""
- if get_setting('PERMISSION'):
+ if get_cms_setting('PERMISSION'):
if obj:
return obj.has_change_permission(request)
else:
@@ -576,7 +576,7 @@ def has_delete_permission(self, request, obj=None):
Django model instance. If CMS_PERMISSION are in use also takes look to
object permissions.
"""
- if get_setting('PERMISSION') and obj is not None:
+ if get_cms_setting('PERMISSION') and obj is not None:
return obj.has_delete_permission(request)
return super(PageAdmin, self).has_delete_permission(request, obj)
@@ -645,10 +645,10 @@ def changelist_view(self, request, extra_context=None):
'has_add_permission': self.has_add_permission(request),
'root_path': reverse('admin:index'),
'app_label': app_label,
- 'CMS_MEDIA_URL': get_setting('MEDIA_URL'),
- 'CMS_SHOW_END_DATE': get_setting('SHOW_END_DATE'),
- 'softroot': get_setting('SOFTROOT'),
- 'CMS_PERMISSION': get_setting('PERMISSION'),
+ 'CMS_MEDIA_URL': get_cms_setting('MEDIA_URL'),
+ 'CMS_SHOW_END_DATE': get_cms_setting('SHOW_END_DATE'),
+ 'softroot': get_cms_setting('SOFTROOT'),
+ 'CMS_PERMISSION': get_cms_setting('PERMISSION'),
'DEBUG': settings.DEBUG,
'site_languages': languages,
'open_menu_trees': open_menu_trees,
@@ -713,7 +713,7 @@ def change_template(self, request, object_id):
return HttpResponseForbidden(_("You do not have permission to change the template"))
to_template = request.POST.get("template", None)
- if to_template not in dict(get_setting('TEMPLATES')):
+ if to_template not in dict(get_cms_setting('TEMPLATES')):
return HttpResponseBadRequest(_("Template not valid"))
page.template = to_template
@@ -1271,7 +1271,7 @@ def edit_plugin(self, request, plugin_id):
if request.POST.get("_cancel", False):
# cancel button was clicked
context = {
- 'CMS_MEDIA_URL': get_setting('MEDIA_URL'),
+ 'CMS_MEDIA_URL': get_cms_setting('MEDIA_URL'),
'plugin': cms_plugin,
'is_popup': True,
'name': unicode(cms_plugin),
@@ -1318,7 +1318,7 @@ def edit_plugin(self, request, plugin_id):
saved_object = plugin_admin.saved_object
context = {
- 'CMS_MEDIA_URL': get_setting('MEDIA_URL'),
+ 'CMS_MEDIA_URL': get_cms_setting('MEDIA_URL'),
'plugin': saved_object,
'is_popup': True,
'name': unicode(saved_object),
View
4 cms/admin/permissionadmin.py
@@ -3,7 +3,7 @@
PagePermissionInlineAdminForm, ViewRestrictionInlineAdminForm)
from cms.exceptions import NoPermissionsException
from cms.models import Page, PagePermission, GlobalPagePermission, PageUser
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from cms.utils.permissions import get_user_permission_level
from copy import deepcopy
from distutils.version import LooseVersion
@@ -181,7 +181,7 @@ def has_change_permission(self, request, obj=None):
super(self.__class__, self).has_change_permission(request, obj)
-if get_setting('PERMISSION'):
+if get_cms_setting('PERMISSION'):
admin.site.register(GlobalPagePermission, GlobalPagePermissionAdmin)
PAGE_ADMIN_INLINES.extend([
ViewRestrictionInlineAdmin,
View
8 cms/admin/placeholderadmin.py
@@ -4,7 +4,7 @@
from cms.models.placeholdermodel import Placeholder
from cms.models.pluginmodel import CMSPlugin
from cms.plugin_pool import plugin_pool
-from cms.utils import get_language_from_request, cms_static_url, get_setting
+from cms.utils import get_language_from_request, cms_static_url, get_cms_setting
from cms.utils.permissions import has_plugin_permission
from copy import deepcopy
from django.conf import settings
@@ -151,7 +151,7 @@ def add_plugin(self, request):
return HttpResponseForbidden(_("You don't have permission to add content here."))
# check the limits defined in CMS_PLACEHOLDER_CONF for this placeholder
- limits = get_setting('PLACEHOLDER_CONF').get(placeholder.slot, {}).get('limits', None)
+ limits = get_cms_setting('PLACEHOLDER_CONF').get(placeholder.slot, {}).get('limits', None)
if limits:
count = placeholder.cmsplugin_set.count()
global_limit = limits.get("global", None)
@@ -206,7 +206,7 @@ def edit_plugin(self, request, plugin_id):
if request.POST.get("_cancel", False):
# cancel button was clicked
context = {
- 'CMS_MEDIA_URL': get_setting('MEDIA_URL'),
+ 'CMS_MEDIA_URL': get_cms_setting('MEDIA_URL'),
'plugin': cms_plugin,
'is_popup': True,
'name': unicode(cms_plugin),
@@ -241,7 +241,7 @@ def edit_plugin(self, request, plugin_id):
saved_object = plugin_admin.saved_object
context = {
- 'CMS_MEDIA_URL': get_setting('MEDIA_URL'),
+ 'CMS_MEDIA_URL': get_cms_setting('MEDIA_URL'),
'plugin': saved_object,
'is_popup': True,
'name': unicode(saved_object),
View
4 cms/admin/useradmin.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from django.conf import settings
from django.utils.translation import ugettext as _
@@ -59,6 +59,6 @@ class PageUserGroupAdmin(admin.ModelAdmin, GenericCmsPermissionAdmin):
def get_fieldsets(self, request, obj=None):
return self.update_permission_fieldsets(request, obj)
-if get_setting('PERMISSION'):
+if get_cms_setting('PERMISSION'):
admin.site.register(PageUser, PageUserAdmin)
admin.site.register(PageUserGroup, PageUserGroupAdmin)
View
8 cms/api.py
@@ -7,7 +7,7 @@
calling these methods!
"""
import datetime
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from django.core.exceptions import PermissionDenied
from cms.utils.i18n import get_language_list
@@ -125,7 +125,7 @@ def create_page(title, template, language, menu_title=None, slug=None,
_thread_locals.user = None
# validate template
- assert template in [tpl[0] for tpl in get_setting('TEMPLATES')]
+ assert template in [tpl[0] for tpl in get_cms_setting('TEMPLATES')]
# validate site
if not site:
@@ -134,7 +134,7 @@ def create_page(title, template, language, menu_title=None, slug=None,
assert isinstance(site, Site)
# validate language:
- assert language in get_language_list(site), get_setting('LANGUAGES').get(site.pk)
+ assert language in get_language_list(site), get_cms_setting('LANGUAGES').get(site.pk)
# set default slug:
if not slug:
@@ -159,7 +159,7 @@ def create_page(title, template, language, menu_title=None, slug=None,
assert isinstance(publication_end_date, datetime.date)
# validate softroot
- assert get_setting('SOFTROOT') or not soft_root
+ assert get_cms_setting('SOFTROOT') or not soft_root
if navigation_extenders:
raw_menus = menu_pool.get_menus_by_attribute("cms_enabled", True)
View
4 cms/apphook_pool.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from cms.exceptions import AppAlreadyRegistered
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from cms.utils.django_load import load, iterload_objects
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
@@ -16,7 +16,7 @@ def discover_apps(self):
if self.discovered:
return
#import all the modules
- apphooks = get_setting('APPHOOKS')
+ apphooks = get_cms_setting('APPHOOKS')
if apphooks:
self.block_register = True
for cls in iterload_objects(apphooks):
View
6 cms/cache/permissions.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from cms.utils import get_setting
+from cms.utils import get_cms_setting
from django.conf import settings
from django.core.cache import cache
@@ -14,7 +14,7 @@
def get_cache_key(user, key):
return "%s:permission:%s:%s" % (
- get_setting('CACHE_PREFIX'), user.username, key)
+ get_cms_setting('CACHE_PREFIX'), user.username, key)
def get_permission_cache(user, key):
@@ -31,7 +31,7 @@ def set_permission_cache(user, key, value):
"""
# store this key, so we can clean it when required
cache_key = get_cache_key(user, key)
- cache.set(cache_key, value, get_setting('CACHE_DURATIONS')['permissions'])
+ cache.set(cache_key, value, get_cms_setting('CACHE_DURATIONS')['permissions'])
def clear_user_permission_cache(user):
View
4 cms/cms_toolbar.py
@@ -5,7 +5,7 @@
from cms.toolbar.items import (Anchor, Switcher, TemplateHTML, ListItem, List,
GetButton)
from cms.utils import cms_static_url
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from cms.utils.permissions import has_page_change_permission
from django import forms
from django.conf import settings
@@ -160,7 +160,7 @@ def get_template_menu(self, context, can_change, is_staff):
menu_items = []
page = self.request.current_page.get_draft_object()
url = reverse('admin:cms_page_change_template', args=(page.pk,))
- for path, name in get_setting('TEMPLATES'):
+ for path, name in get_cms_setting('TEMPLATES'):
args = urllib.urlencode({'template': path})
css = 'template'
if page.get_template() == path:
View
4 cms/context_processors.py
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from django.conf import settings
def media(request):
"""
Adds media-related context variables to the context.
"""
- return {'CMS_MEDIA_URL': get_setting('MEDIA_URL')}
+ return {'CMS_MEDIA_URL': get_cms_setting('MEDIA_URL')}
View
10 cms/forms/utils.py
@@ -3,7 +3,7 @@
from cms.models.titlemodels import Title
from cms.utils import i18n
from collections import defaultdict
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.cache import cache
@@ -75,10 +75,10 @@ def _get_key(prefix, lang):
return "%s-%s" % (prefix, lang)
def get_site_cache_key(lang):
- return _get_key(get_setting('SITE_CHOICES_CACHE_KEY'), lang)
+ return _get_key(get_cms_setting('SITE_CHOICES_CACHE_KEY'), lang)
def get_page_cache_key(lang):
- return _get_key(get_setting('PAGE_CHOICES_CACHE_KEY'), lang)
+ return _get_key(get_cms_setting('PAGE_CHOICES_CACHE_KEY'), lang)
def _clean_many(prefix):
keys = []
@@ -87,10 +87,10 @@ def _clean_many(prefix):
cache.delete_many(keys)
def clean_site_choices_cache(sender, **kwargs):
- _clean_many(get_setting('SITE_CHOICES_CACHE_KEY'))
+ _clean_many(get_cms_setting('SITE_CHOICES_CACHE_KEY'))
def clean_page_choices_cache(sender, **kwargs):
- _clean_many(get_setting('PAGE_CHOICES_CACHE_KEY'))
+ _clean_many(get_cms_setting('PAGE_CHOICES_CACHE_KEY'))
post_save.connect(clean_page_choices_cache, sender=Page)
post_save.connect(clean_site_choices_cache, sender=Site)
View
6 cms/menu.py
@@ -6,7 +6,7 @@
from cms.models.permissionmodels import PagePermission, GlobalPagePermission
from cms.models.titlemodels import Title
from cms.utils import get_language_from_request
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from cms.utils.i18n import get_fallback_languages, hide_untranslated
from cms.utils.page_resolver import get_page_queryset
from cms.utils.moderator import get_title_queryset
@@ -28,7 +28,7 @@ def get_visible_pages(request, pages, site=None):
check if there is ANY restriction
that needs a permission page visibility calculation
"""
- public_for = get_setting('PUBLIC_FOR')
+ public_for = get_cms_setting('PUBLIC_FOR')
is_setting_public_all = public_for == 'all'
is_setting_public_staff = public_for == 'staff'
is_auth_user = request.user.is_authenticated()
@@ -405,7 +405,7 @@ class SoftRootCutter(Modifier):
"""
def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
# only apply this modifier if we're pre-cut (since what we do is cut)
- if post_cut or not get_setting('SOFTROOT'):
+ if post_cut or not get_cms_setting('SOFTROOT'):
return nodes
selected = None
root_nodes = []
View
4 cms/models/managers.py
@@ -3,7 +3,7 @@
from cms.exceptions import NoPermissionsException
from cms.models.query import PageQuerySet
from cms.publisher import PublisherManager
-from cms.utils import get_setting
+from cms.utils import get_cms_setting
from cms.utils.i18n import get_fallback_languages
from django.conf import settings
from django.contrib.sites.models import Site
@@ -451,7 +451,7 @@ def __get_id_list(self, user, site, attr):
if attr != "can_view":
if not user.is_authenticated() or not user.is_staff:
return []
- if user.is_superuser or not get_setting('PERMISSION'):
+ if user.is_superuser or not get_cms_setting('PERMISSION'):
# got superuser, or permissions aren't enabled? just return grant
# all mark
return PagePermissionsPermissionManager.GRANT_ALL
View
20 cms/models/pagemodel.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from cms import constants
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from django.core.exceptions import PermissionDenied
from cms.exceptions import NoHomeFound, PublicIsUnmodifiable
from cms.models.managers import PageManager, PagePermissionsPermissionManager
@@ -41,7 +41,7 @@ class Page(MPTTModel):
# Page was marked published, but some of page parents are not.
PUBLISHER_STATE_PENDING = 4
- template_choices = [(x, _(y)) for x, y in get_setting('TEMPLATES')]
+ template_choices = [(x, _(y)) for x, y in get_cms_setting('TEMPLATES')]
created_by = models.CharField(_("created by"), max_length=70, editable=False)
changed_by = models.CharField(_("changed by"), max_length=70, editable=False)
@@ -271,7 +271,7 @@ def copy_page(self, target, site, position='first-child',
page.save()
# copy permissions if necessary
- if get_setting('PERMISSION') and copy_permissions:
+ if get_cms_setting('PERMISSION') and copy_permissions:
from cms.models.permissionmodels import PagePermission
for permission in PagePermission.objects.filter(page__id=origin_id):
permission.pk = None
@@ -729,18 +729,18 @@ def get_template(self):
except IndexError:
pass
if not template:
- template = get_setting('TEMPLATES')[0][0]
+ template = get_cms_setting('TEMPLATES')[0][0]
self._template_cache = template
return template
def get_template_name(self):
"""
- get the textual name (2nd parameter in get_setting('TEMPLATES'))
+ get the textual name (2nd parameter in get_cms_setting('TEMPLATES'))
of the template of this page or of the nearest
ancestor. failing to find that, return the name of the default template.
"""
template = self.get_template()
- for t in get_setting('TEMPLATES'):
+ for t in get_cms_setting('TEMPLATES'):
if t[0] == template:
return t[1]
return _("default")
@@ -767,8 +767,8 @@ def has_view_permission(self, request):
return True
elif not is_restricted:
- if ((get_setting('PUBLIC_FOR') == 'all') or
- (get_setting('PUBLIC_FOR') == 'staff' and
+ if ((get_cms_setting('PUBLIC_FOR') == 'all') or
+ (get_cms_setting('PUBLIC_FOR') == 'staff' and
request.user.is_staff)):
return True
@@ -782,7 +782,7 @@ def has_view_permission(self, request):
else:
#anonymous user
- if is_restricted or not get_setting('PUBLIC_FOR') == 'all':
+ if is_restricted or not get_cms_setting('PUBLIC_FOR') == 'all':
# anyonymous user, page has restriction and global access is permitted
return False
else:
@@ -889,7 +889,7 @@ def get_media_path(self, filename):
This location can be customised using the CMS_PAGE_MEDIA_PATH setting
"""
- return join(get_setting('PAGE_MEDIA_PATH'), "%d" % self.id, filename)
+ return join(get_cms_setting('PAGE_MEDIA_PATH'), "%d" % self.id, filename)
def last_page_states(self):
"""Returns last five page states, if they exist, optimized, calls sql
View
4 cms/models/pluginmodel.py
@@ -14,7 +14,7 @@
from cms.models.placeholdermodel import Placeholder
from cms.plugin_rendering import PluginContext, render_plugin
from cms.utils.helpers import reversion_register
-from cms.utils import timezone, get_setting
+from cms.utils import timezone, get_cms_setting
from mptt.models import MPTTModel, MPTTModelBase
@@ -187,7 +187,7 @@ def get_media_path(self, filename):
return pages[0].get_media_path(filename)
else: # django 1.0.2 compatibility
today = date.today()
- return os.path.join(get_setting('PAGE_MEDIA_PATH'),
+ return os.path.join(get_cms_setting('PAGE_MEDIA_PATH'),
str(today.year), str(today.month), str(today.day), filename)
@property
View
6 cms/models/query.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from datetime import datetime
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from django.db.models import Q
from django.contrib.sites.models import Site
from cms.publisher.query import PublisherQuerySet
@@ -51,13 +51,13 @@ def valid_targets(self, page_id, request, perms, page=None):
def published(self, site=None):
pub = self.on_site(site).filter(published=True)
- if get_setting('SHOW_START_DATE'):
+ if get_cms_setting('SHOW_START_DATE'):
pub = pub.filter(
Q(publication_date__lt=timezone.now()) |
Q(publication_date__isnull=True)
)
- if get_setting('SHOW_END_DATE'):
+ if get_cms_setting('SHOW_END_DATE'):
pub = pub.filter(
Q(publication_end_date__gte=timezone.now()) |
Q(publication_end_date__isnull=True)
View
4 cms/plugin_base.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from cms.utils import get_setting
+from cms.utils import get_cms_setting
import re
from cms.exceptions import SubClassNeededError, Deprecated
from cms.models import CMSPlugin
@@ -131,7 +131,7 @@ def render_change_form(self, request, context, add=False, change=False, form_url
'preview': not "no_preview" in request.GET,
'is_popup': True,
'plugin': self.cms_plugin_instance,
- 'CMS_MEDIA_URL': get_setting('MEDIA_URL'),
+ 'CMS_MEDIA_URL': get_cms_setting('MEDIA_URL'),
})
return super(CMSPluginBase, self).render_change_form(request, context, add, change, form_url, obj)
View
6 cms/plugin_rendering.py
@@ -3,7 +3,7 @@
from cms.plugin_processors import (plugin_meta_context_processor,
mark_safe_plugin_processor)
from cms.utils import get_language_from_request
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from cms.utils.django_load import iterload_objects
from cms.utils.placeholder import get_placeholder_conf
from django.conf import settings
@@ -36,7 +36,7 @@ def __init__(self, dict, instance, placeholder, processors=None, current_app=Non
processors = []
for processor in DEFAULT_PLUGIN_CONTEXT_PROCESSORS:
self.update(processor(instance, placeholder))
- for processor in iterload_objects(get_setting('PLUGIN_CONTEXT_PROCESSORS')):
+ for processor in iterload_objects(get_cms_setting('PLUGIN_CONTEXT_PROCESSORS')):
self.update(processor(instance, placeholder))
for processor in processors:
self.update(processor(instance, placeholder))
@@ -55,7 +55,7 @@ def render_plugin(context, instance, placeholder, template, processors=None,
content = template.render(context)
else:
content = ''
- for processor in iterload_objects(get_setting('PLUGIN_PROCESSORS')):
+ for processor in iterload_objects(get_cms_setting('PLUGIN_PROCESSORS')):
content = processor(instance, placeholder, content, context)
for processor in processors:
content = processor(instance, placeholder, content, context)
View
4 cms/plugins/text/widgets/tinymce_widget.py
@@ -1,5 +1,5 @@
from cms.utils import cms_static_url
-from django.conf import settings
+from cms.utils.conf import get_cms_setting
from django.forms.widgets import flatatt
from django.template.defaultfilters import escape
from django.template.loader import render_to_string
@@ -22,7 +22,7 @@ def render_additions(self, name, value, attrs=None):
context = {
'name': name,
'language': language,
- 'CMS_MEDIA_URL': get_setting('MEDIA_URL'),
+ 'CMS_MEDIA_URL': get_cms_setting('MEDIA_URL'),
'installed_plugins': self.installed_plugins,
}
return mark_safe(render_to_string(
View
6 cms/signals.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import signals
@@ -160,7 +160,7 @@ def post_save_user_group(instance, raw, created, **kwargs):
page_user.__dict__.update(instance.__dict__)
page_user.save()
-if get_setting('PERMISSION'):
+if get_cms_setting('PERMISSION'):
# only if permissions are in use
from django.contrib.auth.models import User, Group
# register signals to user related models
@@ -247,7 +247,7 @@ def pre_delete_globalpagepermission(instance, **kwargs):
def pre_save_delete_page(instance, **kwargs):
clear_permission_cache()
-if get_setting('PERMISSION'):
+if get_cms_setting('PERMISSION'):
signals.pre_save.connect(pre_save_user, sender=User)
signals.pre_delete.connect(pre_delete_user, sender=User)
View
4 cms/templatetags/cms_admin.py
@@ -3,7 +3,7 @@
from classytags.core import Options, Tag
from classytags.helpers import InclusionTag
from cms.models import MASK_PAGE, MASK_CHILDREN, MASK_DESCENDANTS
-from cms.utils import get_setting
+from cms.utils import get_cms_setting
from cms.utils.admin import get_admin_menu_item_context
from cms.utils.i18n import get_language_object
from cms.utils.permissions import get_any_page_view_permissions
@@ -122,7 +122,7 @@ def boolean_icon(value):
@register.filter
def is_restricted(page, request):
- if get_setting('PERMISSION'):
+ if get_cms_setting('PERMISSION'):
all_perms = list(get_any_page_view_permissions(request, page))
icon = boolean_icon(bool(all_perms))
return mark_safe(
View
6 cms/templatetags/cms_tags.py
@@ -6,7 +6,7 @@
from cms.models import Page, Placeholder as PlaceholderModel
from cms.plugin_rendering import render_placeholder
from cms.plugins.utils import get_plugins, assign_plugins
-from cms.utils import get_language_from_request, get_setting
+from cms.utils import get_language_from_request, get_cms_setting
from cms.utils.page_resolver import get_page_queryset
from cms.utils.placeholder import validate_placeholder_name
from django import template
@@ -119,7 +119,7 @@ def get_context(self, context, page_lookup, lang, site):
page = _get_page_by_untyped_arg(page_lookup, request, site_id)
if page:
url = page.get_absolute_url(language=lang)
- cache.set(cache_key, url, get_setting('CACHE_DURATIONS')['content'])
+ cache.set(cache_key, url, get_cms_setting('CACHE_DURATIONS')['content'])
if url:
return {'content': url}
return {'content': ''}
@@ -408,7 +408,7 @@ def _show_placeholder_for_page(context, placeholder_name, page_lookup, lang=None
return {'content': ''}
content = render_placeholder(placeholder, context, placeholder_name)
if cache_result:
- cache.set(cache_key, content, get_setting('CACHE_DURATIONS')['content'])
+ cache.set(cache_key, content, get_cms_setting('CACHE_DURATIONS')['content'])
if content:
return {'content': mark_safe(content)}
View
4 cms/test_utils/project/noadmin_urls.py
@@ -1,4 +1,4 @@
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from django.conf import settings
from django.conf.urls.defaults import handler500, handler404, patterns, include, \
url
@@ -7,7 +7,7 @@
urlpatterns = patterns('',
url(r'^jsi18n/(?P<packages>\S+?)/$', 'django.views.i18n.javascript_catalog'),
url(r'^media/cms/(?P<path>.*)$', 'django.views.static.serve',
- {'document_root': get_setting('MEDIA_ROOT'), 'show_indexes': True}),
+ {'document_root': get_cms_setting('MEDIA_ROOT'), 'show_indexes': True}),
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
url(r'^', include('cms.urls')),
View
4 cms/test_utils/project/nonroot_urls.py
@@ -1,4 +1,4 @@
-from cms.utils import get_setting
+from cms.utils import get_cms_setting
from django.conf import settings
from django.conf.urls.defaults import handler500, handler404, patterns, include, \
url
@@ -12,7 +12,7 @@
urlpatterns = patterns('',
(r'^jsi18n/(?P<packages>\S+?)/$', 'django.views.i18n.javascript_catalog'),
- url(r'^media/cms/(?P<path>.*)$', 'django.views.static.serve', {'document_root': get_setting('MEDIA_ROOT'), 'show_indexes': True}),
+ url(r'^media/cms/(?P<path>.*)$', 'django.views.static.serve', {'document_root': get_cms_setting('MEDIA_ROOT'), 'show_indexes': True}),
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
)
View
4 cms/test_utils/project/second_urls_for_apphook_tests.py
@@ -1,4 +1,4 @@
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from django.conf import settings
from django.conf.urls.defaults import handler500, handler404, patterns, include, \
url
@@ -14,7 +14,7 @@
url(r'^admin/', include(admin.site.urls)),
url(r'^jsi18n/(?P<packages>\S+?)/$', 'django.views.i18n.javascript_catalog'),
url(r'^media/cms/(?P<path>.*)$', 'django.views.static.serve',
- {'document_root': get_setting('MEDIA_ROOT'), 'show_indexes': True}),
+ {'document_root': get_cms_setting('MEDIA_ROOT'), 'show_indexes': True}),
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
)
View
4 cms/test_utils/project/urls.py
@@ -1,4 +1,4 @@
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from django.conf import settings
from django.conf.urls.defaults import handler500, handler404, patterns, include, \
url
@@ -17,7 +17,7 @@
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
url(r'^media/cms/(?P<path>.*)$', 'django.views.static.serve',
- {'document_root': get_setting('MEDIA_ROOT'), 'show_indexes': True}),
+ {'document_root': get_cms_setting('MEDIA_ROOT'), 'show_indexes': True}),
url(r'^jsi18n/(?P<packages>\S+?)/$', 'django.views.i18n.javascript_catalog'),
)
View
4 cms/test_utils/project/urls_for_apphook_tests.py
@@ -1,4 +1,4 @@
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from django.conf import settings
from django.conf.urls.defaults import handler500, handler404, patterns, include, \
url
@@ -14,7 +14,7 @@
url(r'^admin/', include(admin.site.urls)),
url(r'^jsi18n/(?P<packages>\S+?)/$', 'django.views.i18n.javascript_catalog'),
url(r'^media/cms/(?P<path>.*)$', 'django.views.static.serve',
- {'document_root': get_setting('MEDIA_ROOT'), 'show_indexes': True}),
+ {'document_root': get_cms_setting('MEDIA_ROOT'), 'show_indexes': True}),
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
View
10 cms/tests/admin.py
@@ -17,7 +17,7 @@
URL_CMS_PAGE, URL_CMS_TRANSLATION_DELETE)
from cms.test_utils.util.context_managers import SettingsOverride
from cms.test_utils.util.mock import AttributeObject
-from cms.utils import get_setting
+from cms.utils import get_cms_setting
from django.conf import settings
from django.contrib import admin
from django.contrib.admin.sites import site
@@ -288,7 +288,7 @@ def test_change_template(self):
with self.login_user_context(admin):
response = self.client.post(url, {'template': 'doesntexist'})
self.assertEqual(response.status_code, 400)
- response = self.client.post(url, {'template': get_setting('TEMPLATES')[0][0]})
+ response = self.client.post(url, {'template': get_cms_setting('TEMPLATES')[0][0]})
self.assertEqual(response.status_code, 200)
def test_get_permissions(self):
@@ -978,7 +978,7 @@ def test_clean_overwrite_url(self):
'language': 'en',
'overwrite_url': '/overwrite/url/',
'site': Site.objects.get_current().pk,
- 'template': get_setting('TEMPLATES')[0][0],
+ 'template': get_cms_setting('TEMPLATES')[0][0],
'published': True
}
@@ -1003,7 +1003,7 @@ def test_missmatching_site_parent_dotsite(self):
'slug': 'slug',
'language': 'en',
'site': site1.pk,
- 'template': get_setting('TEMPLATES')[0][0],
+ 'template': get_cms_setting('TEMPLATES')[0][0],
'reverse_id': '',
'parent': parent_page.pk,
}
@@ -1025,7 +1025,7 @@ def test_reverse_id_error_location(self):
'slug': 'page-2',
'language': 'en',
'site': site.pk,
- 'template': get_setting('TEMPLATES')[0][0],
+ 'template': get_cms_setting('TEMPLATES')[0][0],
'reverse_id': dupe_id,
}
form = PageForm(data=page2_data, files=None)
View
4 cms/tests/menu.py
@@ -11,7 +11,7 @@
from cms.test_utils.util.context_managers import (SettingsOverride,
LanguageOverride)
from cms.test_utils.util.mock import AttributeObject
-from cms.utils import get_setting
+from cms.utils import get_cms_setting
from cms.utils.i18n import force_language
from django.conf import settings
from django.contrib.auth.models import AnonymousUser, User, Permission, Group
@@ -269,7 +269,7 @@ def test_show_breadcrumb(self):
def test_language_chooser(self):
# test simple language chooser with default args
- lang_settings = copy.deepcopy(get_setting('LANGUAGES'))
+ lang_settings = copy.deepcopy(get_cms_setting('LANGUAGES'))
lang_settings[1][0]['public'] = False
with SettingsOverride(CMS_LANGUAGES=lang_settings):
context = self.get_context(path=self.get_page(3).get_absolute_url())
View
8 cms/tests/multilingual.py
@@ -5,7 +5,7 @@
from cms.test_utils.testcases import SettingsOverrideTestCase
from cms.test_utils.util.context_managers import SettingsOverride
from cms.test_utils.util.mock import AttributeObject
-from cms.utils import get_setting
+from cms.utils import get_cms_setting
from django.conf import settings
from django.contrib.auth.models import User
@@ -39,7 +39,7 @@ def test_multilingual_page(self):
self.assertEqual(placeholder.cmsplugin_set.filter(language='en').count(), 1)
def test_frontend_lang(self):
- lang_settings = copy.deepcopy(get_setting('LANGUAGES'))
+ lang_settings = copy.deepcopy(get_cms_setting('LANGUAGES'))
lang_settings[1][0]['public'] = False
with SettingsOverride(CMS_LANGUAGES=lang_settings, LANGUAGE_CODE="en"):
page = create_page("page1", "nav_playground.html", "en")
@@ -134,13 +134,13 @@ def test_language_fallback(self):
response = details(request, p1.get_path())
self.assertEqual(response.status_code, 302)
self.assertEqual(response['Location'], '/en/')
- lang_settings = copy.deepcopy(get_setting('LANGUAGES'))
+ lang_settings = copy.deepcopy(get_cms_setting('LANGUAGES'))
lang_settings[1][0]['fallbacks'] = []
lang_settings[1][1]['fallbacks'] = []
with SettingsOverride(CMS_LANGUAGES=lang_settings):
response = self.client.get("/de/")
self.assertEquals(response.status_code, 404)
- lang_settings = copy.deepcopy(get_setting('LANGUAGES'))
+ lang_settings = copy.deepcopy(get_cms_setting('LANGUAGES'))
lang_settings[1][0]['redirect_on_fallback'] = False
lang_settings[1][1]['redirect_on_fallback'] = False
with SettingsOverride(CMS_LANGUAGES=lang_settings):
View
8 cms/tests/page.py
@@ -25,7 +25,7 @@
from cms.test_utils.util.context_managers import (LanguageOverride,
SettingsOverride)
from cms.utils.page_resolver import get_page_from_request, is_valid_url
-from cms.utils import timezone, get_setting
+from cms.utils import timezone, get_cms_setting
from cms.utils.page import is_valid_page_slug
class PagesTestCase(CMSTestCase):
@@ -430,7 +430,7 @@ def test_edit_page_other_site_and_language(self):
page_data['site'] = site.pk
page_data['title'] = 'changed title'
self.assertEqual(site.pk, 2)
- TESTLANG = get_setting('LANGUAGES')[site.pk][0]['code']
+ TESTLANG = get_cms_setting('LANGUAGES')[site.pk][0]['code']
page_data['language'] = TESTLANG
superuser = self.get_superuser()
with self.login_user_context(superuser):
@@ -466,8 +466,8 @@ def test_templates(self):
parent.template = constants.TEMPLATE_INHERITANCE_MAGIC
parent.save()
self.assertEqual(parent.template, constants.TEMPLATE_INHERITANCE_MAGIC)
- self.assertEqual(parent.get_template(), get_setting('TEMPLATES')[0][0])
- self.assertEqual(parent.get_template_name(), get_setting('TEMPLATES')[0][1])
+ self.assertEqual(parent.get_template(), get_cms_setting('TEMPLATES')[0][0])
+ self.assertEqual(parent.get_template_name(), get_cms_setting('TEMPLATES')[0][1])
def test_delete_with_plugins(self):
"""
View
4 cms/tests/templatetags.py
@@ -7,7 +7,7 @@
from cms.test_utils.fixtures.templatetags import TwoPagesFixture
from cms.test_utils.testcases import SettingsOverrideTestCase
from cms.test_utils.util.context_managers import SettingsOverride
-from cms.utils import get_setting
+from cms.utils import get_cms_setting
from cms.utils.plugins import get_placeholders
from django.conf import settings
from django.contrib.sites.models import Site
@@ -162,7 +162,7 @@ def test_untranslated_language_url(self):
page_3 = create_page('Page 3', 'nav_playground.html', 'en', page_2, published=True,
in_navigation=True, reverse_id='page3')
tpl = Template("{% load menu_tags %}{% page_language_url 'de' %}")
- lang_settings = copy.deepcopy(get_setting('LANGUAGES'))
+ lang_settings = copy.deepcopy(get_cms_setting('LANGUAGES'))
lang_settings[1][1]['hide_untranslated'] = False
with SettingsOverride(CMS_LANGUAGES=lang_settings):
context = self.get_context(page_2.get_absolute_url())
View
6 cms/tests/toolbar.py
@@ -5,7 +5,7 @@
from cms.test_utils.util.context_managers import SettingsOverride
from cms.toolbar.items import (Anchor, TemplateHTML, Switcher, List, ListItem,
GetButton)
-from cms.utils import get_setting
+from cms.utils import get_cms_setting
from django.conf import settings
from django.contrib.auth.models import AnonymousUser, User, Permission
from django.core.urlresolvers import reverse
@@ -198,9 +198,9 @@ def test_toolbar_staff(self):
# check templates
templates = items[2]
self.assertIsInstance(templates, List)
- self.assertEqual(len(templates.raw_items), len(get_setting('TEMPLATES')))
+ self.assertEqual(len(templates.raw_items), len(get_cms_setting('TEMPLATES')))
base = reverse('admin:cms_page_change_template', args=(page.pk,))
- for item, template in zip(templates.raw_items, get_setting('TEMPLATES')):
+ for item, template in zip(templates.raw_items, get_cms_setting('TEMPLATES')):
self.assertEqual(item.url, '%s?template=%s' % (base, template[0]))
# check page menu
View
10 cms/utils/__init__.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# TODO: this is just stuff from utils.py - should be splitted / moved
from cms import constants
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from cms.utils.i18n import get_default_language, get_language_list
from distutils.version import LooseVersion
from django.conf import settings
@@ -22,8 +22,8 @@ def get_template_from_request(request, obj=None, no_current_page=False):
template.
"""
template = None
- if len(get_setting('TEMPLATES')) == 1:
- return get_setting('TEMPLATES')[0][0]
+ if len(get_cms_setting('TEMPLATES')) == 1:
+ return get_cms_setting('TEMPLATES')[0][0]
if "template" in request.REQUEST:
template = request.REQUEST['template']
if not template and obj is not None:
@@ -32,13 +32,13 @@ def get_template_from_request(request, obj=None, no_current_page=False):
current_page = request.current_page
if hasattr(current_page, "get_template"):
template = current_page.get_template()
- if template is not None and template in dict(get_setting('TEMPLATES')).keys():
+ if template is not None and template in dict(get_cms_setting('TEMPLATES')).keys():
if template == constants.TEMPLATE_INHERITANCE_MAGIC and obj:
# Happens on admin's request when changing the template for a page
# to "inherit".
return obj.get_template()
return template
- return get_setting('TEMPLATES')[0][0]
+ return get_cms_setting('TEMPLATES')[0][0]
def get_language_from_request(request, current_page=None):
View
10 cms/utils/admin.py
@@ -7,7 +7,7 @@
from django.contrib.sites.models import Site
from cms.models import Page
-from cms.utils import permissions, moderator, get_language_from_request, get_language_list, get_setting
+from cms.utils import permissions, moderator, get_language_from_request, get_language_list, get_cms_setting
from cms.utils.permissions import has_global_page_permission
NOT_FOUND_RESPONSE = "NotFound"
@@ -38,7 +38,7 @@ def get_admin_menu_item_context(request, page, filtered=False):
lang = get_language_from_request(request)
#slug = page.get_slug(language=lang, fallback=True) # why was this here ??
metadata = ""
- if get_setting('PERMISSION'):
+ if get_cms_setting('PERMISSION'):
# jstree metadata generator
md = []
@@ -53,7 +53,7 @@ def get_admin_menu_item_context(request, page, filtered=False):
has_add_on_same_level_permission = False
opts = Page._meta
- if get_setting('PERMISSION'):
+ if get_cms_setting('PERMISSION'):
perms = has_global_page_permission(request, page.site_id, can_add=True)
if (request.user.has_perm(opts.app_label + '.' + opts.get_add_permission()) and perms):
has_add_on_same_level_permission = True
@@ -82,8 +82,8 @@ def get_admin_menu_item_context(request, page, filtered=False):
'has_move_page_permission': has_move_page_permission,
'has_add_page_permission': has_add_page_permission,
'has_add_on_same_level_permission': has_add_on_same_level_permission,
- 'CMS_PERMISSION': get_setting('PERMISSION'),
- 'CMS_SHOW_END_DATE': get_setting('SHOW_END_DATE'),
+ 'CMS_PERMISSION': get_cms_setting('PERMISSION'),
+ 'CMS_SHOW_END_DATE': get_cms_setting('SHOW_END_DATE'),
}
return context
View
4 cms/utils/check.py
@@ -2,7 +2,7 @@
from __future__ import with_statement
from contextlib import contextmanager
from cms import constants
-from cms.utils import get_setting
+from cms.utils import get_cms_setting
from django.conf import settings
from django.utils.decorators import method_decorator
from django.utils.termcolors import colorize
@@ -163,7 +163,7 @@ def check_sekizai(output):
else:
section.error("Sekizai template context processor is not install, could not find 'sekizai.context_processors.sekizai' in TEMPLATE_CONTEXT_PROCESSORS")
- for template, _ in get_setting('TEMPLATES'):
+ for template, _ in get_cms_setting('TEMPLATES'):
if template == constants.TEMPLATE_INHERITANCE_MAGIC:
continue
if validate_template(template, ['js', 'css']):
View
12 cms/utils/conf.py
@@ -11,7 +11,7 @@
import warnings
-__all__ = ['get_setting']
+__all__ = ['get_cms_setting']
class VERIFIED: pass # need a unique identifier for CMS_LANGUAGES
@@ -55,17 +55,17 @@ def wrapper():
def get_cache_durations():
return {
'menus': getattr(settings, 'MENU_CACHE_DURATION', 60 * 60),
- 'content': get_setting('CONTENT_CACHE_DURATION'),
+ 'content': get_cms_setting('CONTENT_CACHE_DURATION'),
'permissions': 60 * 60,
}
@default('CMS_MEDIA_ROOT')
def get_media_root():
- return os.path.join(settings.MEDIA_ROOT, get_setting('MEDIA_PATH'))
+ return os.path.join(settings.MEDIA_ROOT, get_cms_setting('MEDIA_PATH'))
@default('CMS_MEDIA_ROOT')
def get_media_url():
- return urlparse.urljoin(settings.MEDIA_URL, get_setting('MEDIA_PATH'))
+ return urlparse.urljoin(settings.MEDIA_URL, get_cms_setting('MEDIA_PATH'))
@default('PLACEHOLDER_FRONTEND_EDITING')
def get_placeholder_frontend_editing():
@@ -73,7 +73,7 @@ def get_placeholder_frontend_editing():
def get_templates():
templates = list(getattr(settings, 'CMS_TEMPLATES', []))
- if get_setting('TEMPLATE_INHERITANCE'):
+ if get_cms_setting('TEMPLATE_INHERITANCE'):
templates.append((constants.TEMPLATE_INHERITANCE_MAGIC, _('Inherit the template of the nearest ancestor')))
return templates
@@ -198,7 +198,7 @@ def get_languages():
'LANGUAGES': get_languages,
}
-def get_setting(name):
+def get_cms_setting(name):
if name in COMPLEX:
return COMPLEX[name]()
else:
View
10 cms/utils/i18n.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from contextlib import contextmanager
from cms.exceptions import LanguageError
-from cms.utils.conf import get_setting
+from cms.utils.conf import get_cms_setting
from django.conf import settings
from django.utils import translation
from django.utils.translation import ugettext_lazy as _
@@ -18,15 +18,15 @@ def force_language(new_lang):
def get_languages(site_id=None):
site_id = get_site(site_id)
- result = get_setting('LANGUAGES').get(site_id)
+ result = get_cms_setting('LANGUAGES').get(site_id)
if not result:
result = []
- defaults = get_setting('LANGUAGES').get('default', {})
+ defaults = get_cms_setting('LANGUAGES').get('default', {})
for code, name in settings.LANGUAGES:
lang = {'code': code, 'name': _(name)}
lang.update(defaults)
result.append(lang)
- get_setting('LANGUAGES')[site_id] = result
+ get_cms_setting('LANGUAGES')[site_id] = result
return result
@@ -102,7 +102,7 @@ def get_language_objects(site_id=None):
def get_default_language(language_code=None, site_id=None):
"""
Returns default language depending on settings.LANGUAGE_CODE merged with
- best match from get_setting('LANGUAGES')
+ best match from get_cms_setting('LANGUAGES')
Returns: language_code
"""
View
4 cms/utils/permissions.py
@@ -2,7 +2,7 @@
from cms.exceptions import NoPermissionsException
from cms.models import Page, PagePermission, GlobalPagePermission
from cms.plugin_pool import plugin_pool
-from cms.utils import get_setting
+from cms.utils import get_cms_setting
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.contrib.sites.models import Site
@@ -94,7 +94,7 @@ def has_page_change_permission(request):
return request.user.is_superuser or (
request.user.has_perm(opts.app_label + '.' + opts.get_change_permission())
and (
- not get_setting('PERMISSION') or
+ not get_cms_setting('PERMISSION') or
has_global_page_permission(request, current_site(request),
can_change=True) or
has_any_page_change_permissions(request)))
View
4 cms/utils/placeholder.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from cms.utils import get_setting
+from cms.utils import get_cms_setting
from django.conf import settings
from django.core.exceptions import MultipleObjectsReturned, ImproperlyConfigured
from django.db.models.query_utils import Q
@@ -20,7 +20,7 @@ def get_placeholder_conf(setting, placeholder, template=None, default=None):
keys.append("%s %s" % (template, placeholder))
keys.append(placeholder)
for key in keys:
- conf = get_setting('PLACEHOLDER_CONF').get(key)
+ conf = get_cms_setting('PLACEHOLDER_CONF').get(key)
if not conf:
continue
value = conf.get(setting)
View
8 docs/upgrade/2.4.rst
@@ -290,7 +290,7 @@ If you have code that needs to access django CMS settings (settings prefixed
with ``CMS_`` or ``PLACEHOLDER_``) you would have used for example
``from django.conf import settings; settings.CMS_TEMPLATES``. This will no
longer guarantee to return sane values, instead you should use
-``django.utils.conf.get_setting`` which takes the name of the setting
+``django.utils.conf.get_cms_setting`` which takes the name of the setting
**without** the ``CMS_`` prefix as argument and returns the setting.
Example of old, now deprecated style::
@@ -302,10 +302,10 @@ Example of old, now deprecated style::
Should be replaced with the new API::
- from cms.utils.conf import get_setting
+ from cms.utils.conf import get_cms_setting
- get_setting('TEMPLATES')
- get_setting('PLACEHOLDER_FRONTEND_EDITING')
+ get_cms_setting('TEMPLATES')
+ get_cms_setting('PLACEHOLDER_FRONTEND_EDITING')
******************************
View
4 menus/menu_pool.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from cms.utils import get_setting
+from cms.utils import get_cms_setting
from cms.utils.django_load import load
from django.conf import settings
from django.contrib.sites.models import Site
@@ -135,7 +135,7 @@ def _build_nodes(self, request, site_id):
nodes = self.menus[menu_class_name].get_nodes(request)
# nodes is a list of navigation nodes (page tree in cms + others)
final_nodes += _build_nodes_inner_for_one_menu(nodes, menu_class_name)
- cache.set(key, final_nodes, get_setting('CACHE_DURATIONS')['menus'])
+ cache.set(key, final_nodes, get_cms_setting('CACHE_DURATIONS')['menus'])
# We need to have a list of the cache keys for languages and sites that
# span several processes - so we follow the Django way and share through
# the database. It's still cheaper than recomputing every time!
Please sign in to comment.
Something went wrong with that request. Please try again.