summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2007-12-03 17:37:33 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2007-12-03 17:37:33 +0000
commitc68f751f8c376a1dbcb51760e3b475392af7adba (patch)
tree06b672fe11a885e346c4a1b7c0594e2bbc93c34b /django/utils
parent22aa9db4a22d848011775af7007d3c1f8772e056 (diff)
newforms-admin: Merged changes from trunk up to [6863].
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@6864 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/datastructures.py6
-rw-r--r--django/utils/html.py2
-rw-r--r--django/utils/maxlength.py2
-rw-r--r--django/utils/safestring.py21
4 files changed, 14 insertions, 17 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index ee156b11d0..25e9421575 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -1,6 +1,6 @@
class MergeDict(object):
"""
- A simple class for creating new "virtual" dictionaries that actualy look
+ A simple class for creating new "virtual" dictionaries that actually look
up values in more than one dictionary, passed in the constructor.
"""
def __init__(self, *dicts):
@@ -215,7 +215,7 @@ class MultiValueDict(dict):
def get(self, key, default=None):
"""
- Returns the last data value for the passed key. If key doesn't exist
+ Returns the last data value for the passed key. If key doesn't exist
or value is an empty list, then default is returned.
"""
try:
@@ -228,7 +228,7 @@ class MultiValueDict(dict):
def getlist(self, key):
"""
- Returns the list of values for the passed key. If key doesn't exist,
+ Returns the list of values for the passed key. If key doesn't exist,
then an empty list is returned.
"""
try:
diff --git a/django/utils/html.py b/django/utils/html.py
index cb786db1e4..34bbf7357f 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -100,7 +100,7 @@ def urlize(text, trim_url_limit=None, nofollow=False, autoescape=False):
if safe_input:
middle = mark_safe(middle)
if middle.startswith('www.') or ('@' not in middle and not middle.startswith('http://') and \
- len(middle) > 0 and middle[0] in string.letters + string.digits and \
+ len(middle) > 0 and middle[0] in string.ascii_letters + string.digits and \
(middle.endswith('.org') or middle.endswith('.net') or middle.endswith('.com'))):
middle = '<a href="http://%s"%s>%s</a>' % (
urlquote(middle, safe='/&=:;#?+'), nofollow_attr,
diff --git a/django/utils/maxlength.py b/django/utils/maxlength.py
index 9216fe1c3a..1df6a3e93e 100644
--- a/django/utils/maxlength.py
+++ b/django/utils/maxlength.py
@@ -21,7 +21,7 @@ def legacy_maxlength(max_length, maxlength):
"""
if maxlength is not None:
warn("maxlength is deprecated, use max_length instead.",
- PendingDeprecationWarning,
+ DeprecationWarning,
stacklevel=3)
if max_length is not None:
raise TypeError("field can not take both the max_length"
diff --git a/django/utils/safestring.py b/django/utils/safestring.py
index f6f4c1eb2f..2e31c23676 100644
--- a/django/utils/safestring.py
+++ b/django/utils/safestring.py
@@ -34,16 +34,13 @@ class SafeString(str, SafeData):
Concatenating a safe string with another safe string or safe unicode
object is safe. Otherwise, the result is no longer safe.
"""
+ t = super(SafeString, self).__add__(rhs)
if isinstance(rhs, SafeUnicode):
- return SafeUnicode(self + rhs)
+ return SafeUnicode(t)
elif isinstance(rhs, SafeString):
- return SafeString(self + rhs)
- else:
- return super(SafeString, self).__add__(rhs)
-
- def __str__(self):
- return self
-
+ return SafeString(t)
+ return t
+
def _proxy_method(self, *args, **kwargs):
"""
Wrap a call to a normal unicode method up so that we return safe
@@ -69,11 +66,11 @@ class SafeUnicode(unicode, SafeData):
Concatenating a safe unicode object with another safe string or safe
unicode object is safe. Otherwise, the result is no longer safe.
"""
+ t = super(SafeUnicode, self).__add__(rhs)
if isinstance(rhs, SafeData):
- return SafeUnicode(self + rhs)
- else:
- return super(SafeUnicode, self).__add__(rhs)
-
+ return SafeUnicode(t)
+ return t
+
def _proxy_method(self, *args, **kwargs):
"""
Wrap a call to a normal unicode method up so that we return safe