Author: batiste.bieler
Date: Mon Apr 20 04:38:43 2009
New Revision: 457
Modified:
trunk/pages/settings.py
trunk/pages/templatetags/pages_tags.py
Log:
Apply settings documentation patch from wiley kestner.
Modified: trunk/pages/settings.py
==============================================================================
--- trunk/pages/settings.py (original)
+++ trunk/pages/settings.py Mon Apr 20 04:38:43 2009
@@ -1,81 +1,143 @@
# -*- coding: utf-8 -*-
"""
-Convenience module for access of custom pages application settings,
-which enforces default settings when the main settings module does not
-contain the appropriate settings.
+Convenience module that provides access to custom settings for the
``pages``
+application. Provides default settings for the ``pages`` application when
the
+project ``settings`` module does not contain the appropriate settings.
+
"""
from os.path import join
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
-# Which template should be used.
+# The path to default template
DEFAULT_PAGE_TEMPLATE = getattr(settings, 'DEFAULT_PAGE_TEMPLATE', None)
if DEFAULT_PAGE_TEMPLATE is None:
- raise ImproperlyConfigured('Please make sure you specified a
DEFAULT_PAGE_TEMPLATE setting.')
+ raise ImproperlyConfigured('Please make sure you specified a '
+ 'DEFAULT_PAGE_TEMPLATE setting.')
-# Could be set to None if you don't need multiple templates.
+# PAGE_TEMPLATES is a list of tuples that specifies the which templates
+# are available in the ``pages`` admin. Templates should be assigned in
+# the following format:
+#
+# PAGE_TEMPLATES = (
+# ('pages/nice.html', 'nice one'),
+# ('pages/cool.html', 'cool one'),
+# )
PAGE_TEMPLATES = getattr(settings, 'PAGE_TEMPLATES', None)
if PAGE_TEMPLATES is None:
PAGE_TEMPLATES = ()
-# Whether to enable permissions.
+# Set ``PAGE_PERMISSION`` to ``False`` if you do not wish to enable
+# advanced hierarchic permissions on your pages.
PAGE_PERMISSION = getattr(settings, 'PAGE_PERMISSION', True)
-# Whether to enable tagging.
+# Set ``PAGE_TAGGING`` to ``False`` if you do not wish to use the
+# ``django-tagging`` application.
PAGE_TAGGING = getattr(settings, 'PAGE_TAGGING', True)
if PAGE_TAGGING and "tagging" not in getattr(settings, 'INSTALLED_APPS',
[]):
- raise ImproperlyConfigured("django-tagging could not be found.\nPlease
make sure you've installed it correctly or disable the tagging feature by
setting PAGE_TAGGING to False.")
+ raise ImproperlyConfigured('django-tagging could not be found.\n'
+ 'Please make sure you\'ve installed it '
+ 'correctly or disable the tagging feature
by '
+ 'setting PAGE_TAGGING to False.')
-# Whether to enable tinymce.
+# Set this to ``True`` if you wish to use the ``django-tinymce``
application.
PAGE_TINYMCE = getattr(settings, 'PAGE_TINYMCE', False)
if PAGE_TINYMCE and "tinymce" not in getattr(settings, 'INSTALLED_APPS',
[]):
- raise ImproperlyConfigured("django-tinymce could not be found.\nPlease
make sure you've installed it correctly or disable the tinymce feature by
setting PAGE_TINYMCE to False.")
-
-# Whether to only allow unique slugs.
-PAGE_UNIQUE_SLUG_REQUIRED = getattr(settings, 'PAGE_UNIQUE_SLUG_REQUIRED',
False)
+ raise ImproperlyConfigured('django-tinymce could not be found.\n'
+ 'Please make sure you\'ve installed it '
+ 'correctly or disable the tinymce feature
by '
+ 'setting PAGE_TINYMCE to False.')
+
+# Set ``PAGE_UNIQUE_SLUG_REQUIRED`` to ``True`` to enforce unique slug
names
+# for all pages.
+PAGE_UNIQUE_SLUG_REQUIRED = getattr(settings, 'PAGE_UNIQUE_SLUG_REQUIRED',
+ False)
-# Whether to enable revisions.
+# Set ``PAGE_CONTENT_REVISION`` to ``False`` to disable the recording of
+# revision information about made to pages in the database
PAGE_CONTENT_REVISION = getattr(settings, 'PAGE_CONTENT_REVISION', True)
-# Defines which languages should be offered.
+# A list tuples that defines the languages that pages can be translated
into.
+#
+# gettext_noop = lambda s: s
+#
+# PAGE_LANGUAGES = (
+# ('zh-cn', gettext_noop('Chinese Simplified')),
+# ('fr-ch', gettext_noop('Swiss french')),
+# ('en-us', gettext_noop('US English')),
+#)
PAGE_LANGUAGES = getattr(settings, 'PAGE_LANGUAGES', settings.LANGUAGES)
-# Defines which language should be used by default and falls back to
LANGUAGE_CODE
-PAGE_DEFAULT_LANGUAGE = getattr(settings, 'PAGE_DEFAULT_LANGUAGE',
settings.LANGUAGE_CODE)
-
-# Enable you to map client language code to another language code
+# Defines which language should be used by default. If
+# ``PAGE_DEFAULT_LANGUAGE`` not specified, then project
+# ``settings.LANGUAGE_CODE`` is used
+PAGE_DEFAULT_LANGUAGE = getattr(settings, 'PAGE_DEFAULT_LANGUAGE',
+ settings.LANGUAGE_CODE)
+
+# PAGE_LANGUAGE_MAPPING should be assigned a function that takes a single
+# argument, the language code of the incoming browser request. This
function
+# maps the incoming client language code to another language code,
presumably
+# one for which you have translation strings. This is most useful if your
+# project only has one set of translation strings for a language like
Chinese,
+# which has several variants like ``zh-cn``, ``zh-tw``, ``zh-hk`, etc., but
+# you want to provide your Chinese translations to all Chinese browsers,
not
+# just those with the exact ``zh-cn``
+# locale.
+#
+# Enable that behavior here by assigning the following function to the
+# PAGE_LANGUAGE_MAPPING variable.
+#
+# def language_mapping(lang):
+# if lang.startswith('zh'):
+# return 'zh-cn'
+# return lang
+# PAGE_LANGUAGE_MAPPING = language_mapping
PAGE_LANGUAGE_MAPPING = getattr(settings, 'PAGE_LANGUAGE_MAPPING', lambda
l: l)
-# Defines how long page content should be cached, including navigation and
admin menu.
-PAGE_CONTENT_CACHE_DURATION =
getattr(settings, 'PAGE_CONTENT_CACHE_DURATION', False)
-
-# The id of default Site instance to be used for multisite purposes.
+# Set SITE_ID to the id of the default ``Site`` instance to be used on
+# installations where content from a single installation is servedĀ on
+# multiple domains via the ``django.contrib.sites`` framework.
SITE_ID = getattr(settings, 'SITE_ID', 1)
-# Whether to enable the site framework
+# Set PAGE_USE_SITE_ID to ``True`` to make use of the
``django.contrib.sites``
+# framework
PAGE_USE_SITE_ID = getattr(settings, 'PAGE_USE_SITE_ID', False)
-# You can exclude some placeholder from the revision process
-PAGE_CONTENT_REVISION_EXCLUDE_LIST =
getattr(settings, 'PAGE_CONTENT_REVISION_EXCLUDE_LIST', ())
+# Assign a list of placeholders to PAGE_CONTENT_REVISION_EXCLUDE_LIST
+# to exclude them from the revision process.
+PAGE_CONTENT_REVISION_EXCLUDE_LIST = getattr(settings,
+
'PAGE_CONTENT_REVISION_EXCLUDE_LIST',
+ ())
-# Sanitize the user input with html5lib
+# Set ``PAGE_SANITIZE_USER_INPUT`` to ``True`` to sanitize the user input
with
+# ``html5lib``
PAGE_SANITIZE_USER_INPUT = getattr(settings, 'PAGE_SANITIZE_USER_INPUT',
False)
# URL that handles pages' media and uses <MEDIA_ROOT>/pages by default.
-PAGES_MEDIA_URL = getattr(settings, 'PAGES_MEDIA_URL',
join(settings.MEDIA_URL, 'pages/'))
+PAGES_MEDIA_URL = getattr(settings, 'PAGES_MEDIA_URL',
join(settings.MEDIA_URL,
+ 'pages/'))
-# Show the publication date field in the admin, allows for future dating
-# Changing this from True to False could cause some weirdness. If that is
required,
-# you should update your database to correct any future dated pages
+# Show the publication start date field in the admin. Allows for future
dating
+# Changing the ``PAGE_SHOW_START_DATE`` from ``True`` to ``False``
+# after adding data could cause some weirdness. If you must do this, you
+# should update your database to correct any future dated pages.
PAGE_SHOW_START_DATE = getattr(settings, 'PAGE_SHOW_START_DATE', False)
# Show the publication end date field in the admin, allows for page
expiration
-# Changing this from True to False could cause some weirdness. If that is
required,
-# you should update your database and null any pages with
publication_end_date set.
+# Changing ``PAGE_SHOW_END_DATE`` from ``True`` to ``False`` after adding
+# data could cause some weirdness. If you must do this, you should update
+# your database and null any pages with ``publication_end_date`` set.
PAGE_SHOW_END_DATE = getattr(settings, 'PAGE_SHOW_END_DATE', False)
-# You can specify a model and form for this model into your settings to get
-# an automatic form to create and directly link a new instance of this
model
-# with your page.
+# ``PAGE_CONNECTED_MODELS`` allows you to specify a model and form for this
+# model into your settings to get an automatic form to create and directly
link
+# a new instance of this model with your page in the admin.
+#
+# Here is an example:
+#
+# PAGE_CONNECTED_MODELS = [
+#
{'model':'documents.models.Document','form':'documents.models.DocumentForm'},
+# ]
+#
PAGE_CONNECTED_MODELS = getattr(settings, 'PAGE_CONNECTED_MODELS', False)
Modified: trunk/pages/templatetags/pages_tags.py
==============================================================================
--- trunk/pages/templatetags/pages_tags.py (original)
+++ trunk/pages/templatetags/pages_tags.py Mon Apr 20 04:38:43 2009
@@ -19,7 +19,6 @@
request = context['request']
site_id = None
children = page.get_children_for_frontend()
- PAGE_CONTENT_CACHE_DURATION = settings.PAGE_CONTENT_CACHE_DURATION
if 'current_page' in context:
current_page = context['current_page']
return locals()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---