summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-01-25 02:15:39 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-01-25 02:15:39 +0000
commit75a3617d7941ca9484bccab09221dcc51762701a (patch)
tree8d0816562b29528f7d487b2a0ab461de70eebfab /django
parent668671561dab5efa68f575997bf9d655174ee686 (diff)
newforms-admin: Merged to [4425]
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@4426 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/contrib/sessions/middleware.py3
-rw-r--r--django/core/management.py4
-rw-r--r--django/oldforms/__init__.py4
3 files changed, 7 insertions, 4 deletions
diff --git a/django/contrib/sessions/middleware.py b/django/contrib/sessions/middleware.py
index 2337ad8a61..728caa7e19 100644
--- a/django/contrib/sessions/middleware.py
+++ b/django/contrib/sessions/middleware.py
@@ -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.
diff --git a/django/core/management.py b/django/core/management.py
index cbea3bafbc..885a1c10bc 100644
--- a/django/core/management.py
+++ b/django/core/management.py
@@ -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.
diff --git a/django/oldforms/__init__.py b/django/oldforms/__init__.py
index b437109596..decf0f7064 100644
--- a/django/oldforms/__init__.py
+++ b/django/oldforms/__init__.py
@@ -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):