summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorJeremy Dunck <jdunck@gmail.com>2007-03-23 16:35:57 +0000
committerJeremy Dunck <jdunck@gmail.com>2007-03-23 16:35:57 +0000
commitfa3ed6e1341f7c8b468e2267b3fafddeb58cdac2 (patch)
tree6d8bf65854f8431355e2d91cbc61a37ab6f23d9a /django/utils
parent8b279b63bef5c1348cc27c50633fc2d5ef09d7c1 (diff)
gis: Merged revisions 4669-4785 via svnmerge from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@4786 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/datastructures.py7
-rw-r--r--django/utils/dateformat.py13
-rw-r--r--django/utils/text.py2
3 files changed, 15 insertions, 7 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index 94ab76c483..7b7fa2b0f0 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -92,6 +92,13 @@ class SortedDict(dict):
"Returns the value of the item at the given zero-based index."
return self[self.keyOrder[index]]
+ def copy(self):
+ "Returns a copy of this object."
+ # This way of initializing the copy means it works for subclasses, too.
+ obj = self.__class__(self)
+ obj.keyOrder = self.keyOrder
+ return obj
+
class MultiValueDictKeyError(KeyError):
pass
diff --git a/django/utils/dateformat.py b/django/utils/dateformat.py
index e3712175af..a558e3a69f 100644
--- a/django/utils/dateformat.py
+++ b/django/utils/dateformat.py
@@ -13,6 +13,7 @@ Usage:
from django.utils.dates import MONTHS, MONTHS_3, MONTHS_AP, WEEKDAYS
from django.utils.tzinfo import LocalTimezone
+from django.utils.translation import gettext as _
from calendar import isleap, monthrange
import re, time
@@ -36,14 +37,14 @@ class TimeFormat(Formatter):
def a(self):
"'a.m.' or 'p.m.'"
if self.data.hour > 11:
- return 'p.m.'
- return 'a.m.'
+ return _('p.m.')
+ return _('a.m.')
def A(self):
"'AM' or 'PM'"
if self.data.hour > 11:
- return 'PM'
- return 'AM'
+ return _('PM')
+ return _('AM')
def B(self):
"Swatch Internet time"
@@ -91,9 +92,9 @@ class TimeFormat(Formatter):
Proprietary extension.
"""
if self.data.minute == 0 and self.data.hour == 0:
- return 'midnight'
+ return _('midnight')
if self.data.minute == 0 and self.data.hour == 12:
- return 'noon'
+ return _('noon')
return '%s %s' % (self.f(), self.a())
def s(self):
diff --git a/django/utils/text.py b/django/utils/text.py
index 1c1c456e2d..faf8705fa9 100644
--- a/django/utils/text.py
+++ b/django/utils/text.py
@@ -17,7 +17,7 @@ def wrap(text, width):
pos = len(word) - word.rfind('\n') - 1
for word in it:
if "\n" in word:
- lines = word.splitlines()
+ lines = word.split('\n')
else:
lines = (word,)
pos += len(lines[0]) + 1