Skip to content

Instantly share code, notes, and snippets.

View claudep's full-sized avatar

Claude Paroz claudep

View GitHub Profile
hooks.po-directories:
=====================
beagle: beagle/po
gimp: po po-tips po-script-fu po-libgimp po-python po-plug-ins po-tags
gnumeric: po po-functions
gtk+: po po-properties
libgweather: po po-locations
glom: po examples/po_files/example_film_manager examples/po_files/example_lesson_planner examples/po_files/example_music_collection examples/po_files/example_project_manager examples/po_files/example_smallbusiness
gnome-web-www: translations/dynamic translations/static
@claudep
claudep / gist:c234e546eab00ff9fdbf
Last active August 29, 2015 14:09
Register as_<vendor>
diff --git a/django/contrib/gis/db/backends/postgis/operations.py b/django/contrib/gis/db/backends/postgis/operations.py
index 690194f..2a7e1f6 100644
--- a/django/contrib/gis/db/backends/postgis/operations.py
+++ b/django/contrib/gis/db/backends/postgis/operations.py
@@ -4,6 +4,7 @@ from django.conf import settings
from django.contrib.gis.db.backends.base import BaseSpatialOperations
from django.contrib.gis.db.backends.postgis.adapter import PostGISAdapter
from django.contrib.gis.db.backends.utils import SpatialOperator
+from django.contrib.gis.db.models.sql import aggregates # .sql should disappear with 14030
from django.contrib.gis.geometry.backend import Geometry
WSGIDaemonProcess localehelper python-path=/var/www/localehelper:/var/www/virtualenvs/localehelper/lib/python2.7/site-packages display-name=%{GROUP}
WSGIProcessGroup localehelper
WSGIScriptAlias / /var/www/localehelper/common/wsgi.py
diff --git a/django/db/models/base.py b/django/db/models/base.py
index c2f711e..dedfbee 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -1659,6 +1659,8 @@ def model_unpickle(model_id, attrs, factory):
Used to unpickle Model subclasses with deferred fields.
"""
if isinstance(model_id, tuple):
+ if not apps.ready:
+ apps.populate(settings.INSTALLED_APPS)
class BDNMiddleware(object):
def process_exception(self, request, exception):
"""include authenticated user email in request.META"""
if request.user.is_authenticated():
request.META['USER_EMAIL'] = request.user.email
@claudep
claudep / gist:455819983e3eb63649ca
Created August 17, 2015 18:09
Removed some imports
diff --git a/translate/storage/placeables/__init__.py b/translate/storage/placeables/__init__.py
index fd062c5..094e513 100644
--- a/translate/storage/placeables/__init__.py
+++ b/translate/storage/placeables/__init__.py
@@ -45,16 +45,6 @@ The placeables model follows the XLIFF standard's list of placeables.
Please refer to the XLIFF specification to get a better understanding.
"""
-from . import base
-from . import interfaces
@claudep
claudep / gist:aa1edac079866a482510
Created September 25, 2015 18:21
Patch for #19631
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index c2c4d84..bdce73b 100644
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
import copy
import operator
from collections import OrderedDict
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'))