Skip to content

Instantly share code, notes, and snippets.

View claudep's full-sized avatar

Claude Paroz claudep

View GitHub Profile
diff --git a/django/core/management/base.py b/django/core/management/base.py
index 6e06991..c78e880 100644
--- a/django/core/management/base.py
+++ b/django/core/management/base.py
@@ -97,8 +97,9 @@ class BaseCommand(object):
output and, if the command is intended to produce a block of
SQL statements, will be wrapped in ``BEGIN`` and ``COMMIT``.
- 4. If ``handle()`` raised a ``CommandError``, ``execute()`` will
- instead print an error message to ``stderr``.
diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py
index 7a2e514..1398b43 100644
--- a/django/contrib/humanize/templatetags/humanize.py
+++ b/django/contrib/humanize/templatetags/humanize.py
@@ -184,7 +184,7 @@ def naturaltime(value):
if delta.days != 0:
return pgettext(
'naturaltime', '%(delta)s ago'
- ) % {'delta': defaultfilters.timesince(value)}
+ ) % {'delta': defaultfilters.timesince(value, now)}
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index 0880079..29a5146 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -38,7 +38,7 @@ DatabaseError = Database.DatabaseError
IntegrityError = Database.IntegrityError
def parse_datetime_with_timezone_support(value):
- dt = parse_datetime(value)
+ dt = parse_datetime(value.decode('utf-8'))
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index 0880079..8c300ff 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -11,6 +11,7 @@ import decimal
import warnings
import re
import sys
+from functools import partial
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index 0880079..1302ca0 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -11,6 +11,7 @@ import decimal
import warnings
import re
import sys
+from functools import partial
from functools import wraps
def reverse_lazy(*args, **kwargs):
@wraps(reverse)
def wrapper(*args, **kw):
proxy = lazy(reverse, str)(*args, **kw)
# Needed in Python 3 to pass the _coerce_args function in urlparse
proxy.decode = lambda x, y: str(x)
return proxy
return wrapper(*args, **kwargs)
diff --git a/django/utils/encoding.py b/django/utils/encoding.py
index 7b80f13..25d4574 100644
--- a/django/utils/encoding.py
+++ b/django/utils/encoding.py
@@ -94,7 +94,7 @@ def force_text(s, encoding='utf-8', strings_only=False, errors='strict'):
if strings_only and is_protected_type(s):
return s
try:
- if not isinstance(s, six.string_types):
+ if not isinstance(s, (bytes, six.string_types)):
diff --git a/django/contrib/admin/util.py b/django/contrib/admin/util.py
index ff90e1d..889f692 100644
--- a/django/contrib/admin/util.py
+++ b/django/contrib/admin/util.py
@@ -12,7 +12,7 @@ from django.utils import formats
from django.utils.html import format_html
from django.utils.text import capfirst
from django.utils import timezone
-from django.utils.encoding import force_text, smart_text, smart_bytes
+from django.utils.encoding import force_str, force_text, smart_text
$ PYTHONPATH=.. python -Wall ./runtests.py --settings=test_sqlite file_storage
/usr/lib/python2.6/pkgutil.py:186: ImportWarning: Not importing directory '/usr/local/lib/python2.6/dist-packages/virtualenvwrapper': missing __init__.py
file, filename, etc = imp.find_module(subname, path)
Creating test database for alias 'default'...
Creating test database for alias 'other'...
.............................................../home/claude/checkouts/django-git/django/core/files/images.py:67: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
if e.message.startswith("Error -5"):
/home/claude/checkouts/django-git/django/core/files/images.py:67: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
if e.message.startswith("Error -5"):
/home/claude/checkouts/django-git/django/core/files/images.py:67: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
import datetime
import yaml
class Obj1(object):
def __init__(self, dt):
self.dt = dt
dt = datetime.datetime(2011, 9, 1, 13, 20, 30, 405060)
o1 = Obj1(dt)