1
0
mirror of https://github.com/django/django.git synced 2025-10-26 23:26:08 +00:00

newforms-admin: Merged to [4425]

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@4426 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty
2007-01-25 02:15:39 +00:00
parent 668671561d
commit 75a3617d79
40 changed files with 210 additions and 206 deletions

View File

@@ -1,5 +1,6 @@
from django.conf import settings
from django.contrib.sessions.models import Session
from django.core.exceptions import SuspiciousOperation
from django.utils.cache import patch_vary_headers
import datetime
@@ -55,7 +56,7 @@ class SessionWrapper(object):
s = Session.objects.get(session_key=self.session_key,
expire_date__gt=datetime.datetime.now())
self._session_cache = s.get_decoded()
except Session.DoesNotExist:
except (Session.DoesNotExist, SuspiciousOperation):
self._session_cache = {}
# Set the session_key to None to force creation of a new
# key, for extra security.

View File

@@ -25,7 +25,7 @@ APP_ARGS = '[appname ...]'
# which has been installed.
PROJECT_TEMPLATE_DIR = os.path.join(django.__path__[0], 'conf', '%s_template')
INVALID_PROJECT_NAMES = ('django', 'test')
INVALID_PROJECT_NAMES = ('django', 'site', 'test')
# Set up the terminal color scheme.
class dummy: pass
@@ -708,7 +708,7 @@ def startproject(project_name, directory):
"Creates a Django project for the given project_name in the given directory."
from random import choice
if project_name in INVALID_PROJECT_NAMES:
sys.stderr.write(style.ERROR("Error: %r isn't a valid project name. Please try another.\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)
_start_helper('project', project_name, directory)
# Create a random SECRET_KEY hash, and put it in the main settings.

View File

@@ -958,7 +958,9 @@ class USStateField(TextField):
raise validators.CriticalValidationError, e.messages
def html2python(data):
return data.upper() # Should always be stored in upper case
if data:
return data.upper() # Should always be stored in upper case
return data
html2python = staticmethod(html2python)
class CommaSeparatedIntegerField(TextField):