summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-05-25 03:02:12 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-05-25 03:02:12 +0000
commit78b75b9065bcb3e4a016e5a8a3cdd671b7742b63 (patch)
tree4cd51815035de70c1ee0c391cdf325246d8bdb84
parent5a396c8b1dd31e4ff28583865cccb668a48af682 (diff)
unicode: Merged from trunk up to [5333].
git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5337 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/contrib/admin/templatetags/admin_list.py6
-rw-r--r--django/core/serializers/json.py23
-rw-r--r--django/db/backends/mysql_old/base.py1
-rw-r--r--django/template/__init__.py2
4 files changed, 5 insertions, 27 deletions
diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
index 8429018318..206a453383 100644
--- a/django/contrib/admin/templatetags/admin_list.py
+++ b/django/contrib/admin/templatetags/admin_list.py
@@ -73,6 +73,7 @@ def result_headers(cl):
for i, field_name in enumerate(lookup_opts.admin.list_display):
try:
f = lookup_opts.get_field(field_name)
+ admin_order_field = None
except models.FieldDoesNotExist:
# For non-field list_display values, check for the function
# attribute "short_description". If that doesn't exist, fall back
@@ -89,7 +90,8 @@ def result_headers(cl):
header = field_name.replace('_', ' ')
# It is a non-field, but perhaps one that is sortable
- if not getattr(getattr(cl.model, field_name), "admin_order_field", None):
+ admin_order_field = getattr(getattr(cl.model, field_name), "admin_order_field", None)
+ if not admin_order_field:
yield {"text": header}
continue
@@ -104,7 +106,7 @@ def result_headers(cl):
th_classes = []
new_order_type = 'asc'
- if field_name == cl.order_field:
+ if field_name == cl.order_field or admin_order_field == cl.order_field:
th_classes.append('sorted %sending' % cl.order_type.lower())
new_order_type = {'asc': 'desc', 'desc': 'asc'}[cl.order_type.lower()]
diff --git a/django/core/serializers/json.py b/django/core/serializers/json.py
index 20adce798d..55804b8316 100644
--- a/django/core/serializers/json.py
+++ b/django/core/serializers/json.py
@@ -35,7 +35,6 @@ def Deserializer(stream_or_string, **options):
stream = StringIO(stream_or_string)
else:
stream = stream_or_string
- #for obj in PythonDeserializer(simplejson.load(stream, cls=DjangoJSONDecoder)):
for obj in PythonDeserializer(simplejson.load(stream)):
yield obj
@@ -62,25 +61,3 @@ class DjangoJSONEncoder(simplejson.JSONEncoder):
# Older, deprecated class name (for backwards compatibility purposes).
DateTimeAwareJSONEncoder = DjangoJSONEncoder
-## Our override for simplejson.JSONNumber, because we want to use decimals in
-## preference to floats (we can convert decimal -> float when they stored, if
-## needed, but cannot go the other way).
-#def DjangoNumber(match, context):
-# match = DjangoNumber.regex.match(match.string, *match.span())
-# integer, frac, exp = match.groups()
-# if exp:
-# res = float(integer + (frac or '') + (exp or ''))
-# elif frac:
-# res = decimal.Decimal(integer + frac)
-# else:
-# res = int(integer)
-# return res, None
-#decoder.pattern(r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?')(DjangoNumber)
-#
-#converters = decoder.ANYTHING[:]
-#converters[-1] = DjangoNumber
-#decoder.JSONScanner = decoder.Scanner(converters)
-#
-#class DjangoJSONDecoder(simplejson.JSONDecoder):
-# _scanner = decoder.Scanner(converters)
-#
diff --git a/django/db/backends/mysql_old/base.py b/django/db/backends/mysql_old/base.py
index bcd87457dd..87aed4520e 100644
--- a/django/db/backends/mysql_old/base.py
+++ b/django/db/backends/mysql_old/base.py
@@ -25,7 +25,6 @@ django_conversions.update({
FIELD_TYPE.DATE: util.typecast_date,
FIELD_TYPE.TIME: util.typecast_time,
FIELD_TYPE.DECIMAL: util.typecast_decimal,
- FIELD_TYPE.NEWDECIMAL: util.typecast_decimal,
})
# This should match the numerical portion of the version numbers (we can treat
diff --git a/django/template/__init__.py b/django/template/__init__.py
index a9e00a51af..5b8cdc3b1f 100644
--- a/django/template/__init__.py
+++ b/django/template/__init__.py
@@ -488,7 +488,7 @@ class TokenParser(object):
while i < len(subject) and subject[i] != c:
i += 1
if i >= len(subject):
- raise TemplateSyntaxError, "Searching for value. Unexpected end of string in column %d: %s" % subject
+ raise TemplateSyntaxError, "Searching for value. Unexpected end of string in column %d: %s" % (i, subject)
i += 1
s = subject[p:i]
while i < len(subject) and subject[i] in (' ', '\t'):