Permalink
Browse files

renamed cms.utils.conf.get_setting to get_cms_setting

  • Loading branch information...
1 parent 606fb53 commit 1cba5ee6fe7a5c0c3dc9a22abae547789fe318e9 @ojii ojii committed Jan 16, 2013
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
@@ -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()
@@ -1,15 +1,15 @@
# -*- 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
from django.shortcuts import render_to_response, get_object_or_404
@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
@@ -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
@@ -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),
@@ -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,
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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):
Oops, something went wrong.

0 comments on commit 1cba5ee

Please sign in to comment.