Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Renamed CMSRequest to DjangoRequest, and CMSContext to DjangoContext.…

… Old code will still work.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@57 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit f4c581158d489aba88f3cbb2c61dd44949ea0038 1 parent 960644a
@adrianholovaty adrianholovaty authored
View
2  django/contrib/comments/views/comments.py
@@ -1,7 +1,7 @@
from django.core import formfields, template_loader, validators
from django.core.mail import mail_admins, mail_managers
from django.core.exceptions import Http404, ObjectDoesNotExist
-from django.core.extensions import CMSContext as Context
+from django.core.extensions import DjangoContext as Context
from django.models.auth import sessions
from django.models.comments import comments, freecomments
from django.models.core import contenttypes
View
2  django/contrib/comments/views/karma.py
@@ -1,5 +1,5 @@
from django.core import template_loader
-from django.core.extensions import CMSContext as Context
+from django.core.extensions import DjangoContext as Context
from django.core.exceptions import Http404
from django.models.comments import comments, karma
from django.utils.httpwrappers import HttpResponse
View
2  django/contrib/comments/views/userflags.py
@@ -1,5 +1,5 @@
from django.core import template_loader
-from django.core.extensions import CMSContext as Context
+from django.core.extensions import DjangoContext as Context
from django.core.exceptions import Http404
from django.models.comments import comments, moderatordeletions, userflags
from django.views.decorators.auth import login_required
View
20 django/core/extensions.py
@@ -1,13 +1,15 @@
-"Specialized Context and ModPythonRequest classes for our CMS. Use these!"
+"Specialized Context and ModPythonRequest classes for Django. Use these!"
from django.core.template import Context
from django.utils.httpwrappers import ModPythonRequest
from django.conf.settings import DEBUG, INTERNAL_IPS
from pprint import pformat
-class CMSContext(Context):
- """This subclass of template.Context automatically populates 'user' and
- 'messages' in the context. Use this."""
+class DjangoContext(Context):
+ """
+ This subclass of template.Context automatically populates 'user' and
+ 'messages' in the context.
+ """
def __init__(self, request, dict={}):
Context.__init__(self, dict)
self['user'] = request.user
@@ -37,13 +39,13 @@ def __init__(self, user):
def __getitem__(self, module_name):
return PermLookupDict(self.user, module_name)
-class CMSRequest(ModPythonRequest):
- "A special version of ModPythonRequest with support for CMS sessions"
+class DjangoRequest(ModPythonRequest):
+ "A special version of ModPythonRequest with support for Django sessions."
def __init__(self, req):
ModPythonRequest.__init__(self, req)
def __repr__(self):
- return '<CMSRequest\npath:%s,\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s,\nuser:%s>' % \
+ return '<DjangoRequest\npath:%s,\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s,\nuser:%s>' % \
(self.path, pformat(self.GET), pformat(self.POST), pformat(self.COOKIES),
pformat(self.META), pformat(self.user))
@@ -77,3 +79,7 @@ def _set_user(self, user):
session = property(_get_session, _set_session)
user = property(_get_user, _set_user)
+
+# For legacy purposes.
+CMSContext = DjangoContext
+CMSRequest = DjangoRequest
View
4 django/core/handler.py
@@ -77,8 +77,8 @@ def load_middleware(self):
def get_request(self, req):
"Returns an HttpRequest object for the given mod_python req object"
- from django.core.extensions import CMSRequest
- return CMSRequest(req)
+ from django.core.extensions import DjangoRequest
+ return DjangoRequest(req)
def get_response(self, path, request):
"Returns an HttpResponse object for the given HttpRequest"
View
2  django/middleware/admin.py
@@ -1,6 +1,6 @@
from django.utils import httpwrappers
from django.core import template_loader
-from django.core.extensions import CMSContext as Context
+from django.core.extensions import DjangoContext as Context
from django.models.auth import sessions, users
from django.views.registration import passwords
import base64, md5
View
26 django/views/admin/doc.py
@@ -6,7 +6,7 @@
from django.conf import settings
from django.models.core import sites
from django.views.decorators.cache import cache_page
-from django.core.extensions import CMSContext as Context
+from django.core.extensions import DjangoContext as Context
from django.core.exceptions import Http404, ViewDoesNotExist
from django.utils.httpwrappers import HttpResponse, HttpResponseRedirect
from django.core import template, template_loader, defaulttags, defaultfilters, urlresolvers
@@ -14,18 +14,18 @@
from django.parts.admin import doc
except ImportError:
doc = None
-
+
# Exclude methods starting with these strings from documentation
MODEL_METHODS_EXCLUDE = ('_', 'add_', 'delete', 'save', 'set_')
def doc_index(request):
if not doc:
return missing_docutils_page(request)
-
+
t = template_loader.get_template('doc/index')
c = Context(request, {})
return HttpResponse(t.render(c))
-
+
def bookmarklets(request):
t = template_loader.get_template('doc/bookmarklets')
c = Context(request, {
@@ -36,10 +36,10 @@ def bookmarklets(request):
def template_tag_index(request):
if not doc:
return missing_docutils_page(request)
-
- # We have to jump through some hoops with registered_tags to make sure
+
+ # We have to jump through some hoops with registered_tags to make sure
# they don't get messed up by loading outside tagsets
- saved_tagset = template.registered_tags.copy(), template.registered_filters.copy()
+ saved_tagset = template.registered_tags.copy(), template.registered_filters.copy()
load_all_installed_template_libraries()
# Gather docs
@@ -76,8 +76,8 @@ def template_tag_index(request):
def template_filter_index(request):
if not doc:
return missing_docutils_page(request)
-
- saved_tagset = template.registered_tags.copy(), template.registered_filters.copy()
+
+ saved_tagset = template.registered_tags.copy(), template.registered_filters.copy()
load_all_installed_template_libraries()
filters = []
@@ -191,7 +191,7 @@ def model_detail(request, model):
except ImportError:
raise Http404
opts = model.Klass._meta
-
+
# Gather fields/field descriptions
fields = []
for field in opts.fields:
@@ -251,7 +251,7 @@ def load_all_installed_template_libraries():
reload(mod)
except ImportError:
pass
-
+
def get_return_data_type(func_name):
"""Return a somewhat-helpful data type given a function name"""
if func_name.startswith('get_'):
@@ -292,13 +292,13 @@ def get_return_data_type(func_name):
'XMLField' : 'XML text',
}
-def get_readable_field_data_type(field):
+def get_readable_field_data_type(field):
return DATA_TYPE_MAPPING[field.__class__.__name__] % field.__dict__
def extract_views_from_urlpatterns(urlpatterns, base=''):
"""
Return a list of views from a list of urlpatterns.
-
+
Each object in the returned list is a two-tuple: (view_func, regex)
"""
views = []
View
2  django/views/admin/main.py
@@ -2,7 +2,7 @@
from django.core import formfields, meta, template_loader
from django.core.exceptions import Http404, ObjectDoesNotExist, PermissionDenied
-from django.core.extensions import CMSContext as Context
+from django.core.extensions import DjangoContext as Context
from django.models.auth import log
from django.utils.html import strip_tags
from django.utils.httpwrappers import HttpResponse, HttpResponseRedirect
View
2  django/views/admin/template.py
@@ -1,6 +1,6 @@
from django.core import formfields, template_loader, validators
from django.core import template
-from django.core.extensions import CMSContext as Context
+from django.core.extensions import DjangoContext as Context
from django.utils.httpwrappers import HttpResponse
from django.models.core import sites
from django.conf import settings
View
2  django/views/auth/login.py
@@ -1,6 +1,6 @@
from django.parts.auth.formfields import AuthenticationForm
from django.core import formfields, template_loader
-from django.core.extensions import CMSContext as Context
+from django.core.extensions import DjangoContext as Context
from django.models.auth import sessions
from django.models.core import sites
from django.utils.httpwrappers import HttpResponse, HttpResponseRedirect
View
2  django/views/core/flatfiles.py
@@ -1,6 +1,6 @@
from django.core import template_loader
from django.core.exceptions import Http404
-from django.core.extensions import CMSContext as Context
+from django.core.extensions import DjangoContext as Context
from django.models.core import flatfiles
from django.utils.httpwrappers import HttpResponse
from django.conf.settings import SITE_ID
View
2  django/views/defaults.py
@@ -1,6 +1,6 @@
from django.core import template_loader
from django.core.exceptions import Http404, ObjectDoesNotExist
-from django.core.extensions import CMSContext as Context
+from django.core.extensions import DjangoContext as Context
from django.models.core import sites
from django.utils import httpwrappers
View
2  django/views/generic/date_based.py
@@ -1,6 +1,6 @@
from django.core import template_loader
from django.core.exceptions import Http404, ObjectDoesNotExist
-from django.core.extensions import CMSContext as Context
+from django.core.extensions import DjangoContext as Context
from django.core.xheaders import populate_xheaders
from django.models import get_module
from django.utils.httpwrappers import HttpResponse
View
2  django/views/generic/list_detail.py
@@ -2,7 +2,7 @@
from django.core import template_loader
from django.utils.httpwrappers import HttpResponse
from django.core.xheaders import populate_xheaders
-from django.core.extensions import CMSContext as Context
+from django.core.extensions import DjangoContext as Context
from django.core.paginator import ObjectPaginator, InvalidPage
from django.core.exceptions import Http404, ObjectDoesNotExist
View
2  django/views/registration/passwords.py
@@ -1,5 +1,5 @@
from django.core import formfields, template_loader, validators
-from django.core.extensions import CMSContext as Context
+from django.core.extensions import DjangoContext as Context
from django.models.auth import users
from django.views.decorators.auth import login_required
from django.utils.httpwrappers import HttpResponse, HttpResponseRedirect
Please sign in to comment.
Something went wrong with that request. Please try again.