mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
unicode: Merged from trunk up to [5600].
git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5601 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
1feda14c8e
commit
c4b260a4b6
1
AUTHORS
1
AUTHORS
@ -237,6 +237,7 @@ answer newbie questions, and generally made Django that much better:
|
|||||||
Joe Topjian <http://joe.terrarum.net/geek/code/python/django/>
|
Joe Topjian <http://joe.terrarum.net/geek/code/python/django/>
|
||||||
torne-django@wolfpuppy.org.uk
|
torne-django@wolfpuppy.org.uk
|
||||||
Karen Tracey <graybark@bellsouth.net>
|
Karen Tracey <graybark@bellsouth.net>
|
||||||
|
tstromberg@google.com
|
||||||
Makoto Tsuyuki <mtsuyuki@gmail.com>
|
Makoto Tsuyuki <mtsuyuki@gmail.com>
|
||||||
tt@gurgle.no
|
tt@gurgle.no
|
||||||
Amit Upadhyay
|
Amit Upadhyay
|
||||||
|
@ -37,6 +37,7 @@ class SessionWrapper(object):
|
|||||||
return self._session.get(key, default)
|
return self._session.get(key, default)
|
||||||
|
|
||||||
def pop(self, key, *args):
|
def pop(self, key, *args):
|
||||||
|
self.modified = self.modified or key in self._session
|
||||||
return self._session.pop(key, *args)
|
return self._session.pop(key, *args)
|
||||||
|
|
||||||
def set_test_cookie(self):
|
def set_test_cookie(self):
|
||||||
|
@ -5,8 +5,24 @@ Inject data into the session cache.
|
|||||||
>>> s._session_cache = {}
|
>>> s._session_cache = {}
|
||||||
>>> s._session_cache['some key'] = 'exists'
|
>>> s._session_cache['some key'] = 'exists'
|
||||||
|
|
||||||
|
>>> s.accessed
|
||||||
|
False
|
||||||
|
>>> s.modified
|
||||||
|
False
|
||||||
|
|
||||||
|
>>> s.pop('non existant key', 'does not exist')
|
||||||
|
'does not exist'
|
||||||
|
>>> s.accessed
|
||||||
|
True
|
||||||
|
>>> s.modified
|
||||||
|
False
|
||||||
|
|
||||||
>>> s.pop('some key')
|
>>> s.pop('some key')
|
||||||
'exists'
|
'exists'
|
||||||
|
>>> s.accessed
|
||||||
|
True
|
||||||
|
>>> s.modified
|
||||||
|
True
|
||||||
|
|
||||||
>>> s.pop('some key', 'does not exist')
|
>>> s.pop('some key', 'does not exist')
|
||||||
'does not exist'
|
'does not exist'
|
||||||
|
@ -832,9 +832,15 @@ def startproject(project_name, directory):
|
|||||||
sys.stderr.write(style.ERROR("Error: '%r' conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name.\n" % project_name))
|
sys.stderr.write(style.ERROR("Error: '%r' conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name.\n" % project_name))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
_start_helper('project', project_name, directory)
|
_start_helper('project', project_name, directory)
|
||||||
|
|
||||||
# Create a random SECRET_KEY hash, and put it in the main settings.
|
# Create a random SECRET_KEY hash, and put it in the main settings.
|
||||||
main_settings_file = os.path.join(directory, project_name, 'settings.py')
|
main_settings_file = os.path.join(directory, project_name, 'settings.py')
|
||||||
settings_contents = open(main_settings_file, 'r').read()
|
settings_contents = open(main_settings_file, 'r').read()
|
||||||
|
|
||||||
|
# If settings.py was copied from a read-only source, make it writeable.
|
||||||
|
if not os.access(main_settings_file, os.W_OK):
|
||||||
|
os.chmod(main_settings_file, 0600)
|
||||||
|
|
||||||
fp = open(main_settings_file, 'w')
|
fp = open(main_settings_file, 'w')
|
||||||
secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)])
|
secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)])
|
||||||
settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
|
settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
|
||||||
|
@ -21,7 +21,7 @@ def shortcut(request, content_type_id, object_id):
|
|||||||
# if necessary.
|
# if necessary.
|
||||||
|
|
||||||
# If the object actually defines a domain, we're done.
|
# If the object actually defines a domain, we're done.
|
||||||
if absurl.startswith('http://'):
|
if absurl.startswith('http://') or absurl.startswith('https://'):
|
||||||
return http.HttpResponseRedirect(absurl)
|
return http.HttpResponseRedirect(absurl)
|
||||||
|
|
||||||
object_domain = None
|
object_domain = None
|
||||||
@ -61,7 +61,8 @@ def shortcut(request, content_type_id, object_id):
|
|||||||
# If all that malarkey found an object domain, use it; otherwise fall back
|
# If all that malarkey found an object domain, use it; otherwise fall back
|
||||||
# to whatever get_absolute_url() returned.
|
# to whatever get_absolute_url() returned.
|
||||||
if object_domain is not None:
|
if object_domain is not None:
|
||||||
return http.HttpResponseRedirect('http://%s%s' % (object_domain, absurl))
|
protocol = request.is_secure() and 'https' or 'http'
|
||||||
|
return http.HttpResponseRedirect('%s://%s%s' % (protocol, object_domain, absurl))
|
||||||
else:
|
else:
|
||||||
return http.HttpResponseRedirect(absurl)
|
return http.HttpResponseRedirect(absurl)
|
||||||
|
|
||||||
|
@ -311,9 +311,10 @@ optional, third positional argument, ``processors``. In this example, the
|
|||||||
|
|
||||||
def some_view(request):
|
def some_view(request):
|
||||||
# ...
|
# ...
|
||||||
return RequestContext(request, {
|
c = RequestContext(request, {
|
||||||
'foo': 'bar',
|
'foo': 'bar',
|
||||||
}, [ip_address_processor])
|
}, [ip_address_processor])
|
||||||
|
return t.render(c)
|
||||||
|
|
||||||
Note::
|
Note::
|
||||||
If you're using Django's ``render_to_response()`` shortcut to populate a
|
If you're using Django's ``render_to_response()`` shortcut to populate a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user