summaryrefslogtreecommitdiffstats
path: root/askbot/patches
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-08-07 00:22:22 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-08-07 00:22:22 -0400
commit1e93bebba2bd521587015418a67adbc2a134820f (patch)
tree12adecf9a7aa31055993a244f30caa0311e30df0 /askbot/patches
parent13c4c8687933812313f2b7bced2b60b9f2ff5a28 (diff)
downloadaskbot-1e93bebba2bd521587015418a67adbc2a134820f.tar.gz
askbot-1e93bebba2bd521587015418a67adbc2a134820f.tar.bz2
askbot-1e93bebba2bd521587015418a67adbc2a134820f.zip
askbot works on Django 1.1 again
Diffstat (limited to 'askbot/patches')
-rw-r--r--askbot/patches/__init__.py1
-rw-r--r--askbot/patches/django_patches.py14
2 files changed, 15 insertions, 0 deletions
diff --git a/askbot/patches/__init__.py b/askbot/patches/__init__.py
index 3c5e0d28..ebaeabac 100644
--- a/askbot/patches/__init__.py
+++ b/askbot/patches/__init__.py
@@ -15,6 +15,7 @@ def patch_django():
if major == 1 and minor < 2:
django_patches.add_import_library_function()
django_patches.add_csrf_protection()
+ django_patches.add_available_attrs_decorator()
def patch_coffin():
"""coffin before version 0.3.4
diff --git a/askbot/patches/django_patches.py b/askbot/patches/django_patches.py
index baab64af..e28c88ba 100644
--- a/askbot/patches/django_patches.py
+++ b/askbot/patches/django_patches.py
@@ -5,6 +5,10 @@ import sys
from django.utils.safestring import mark_safe
from django.utils.functional import lazy
from django.template import Node
+try:
+ from functools import WRAPPER_ASSIGNMENTS
+except ImportError:
+ from django.utils.functional import WRAPPER_ASSIGNMENTS
def module_has_submodule(package, module_name):
"""See if 'module' is in 'package'."""
@@ -325,3 +329,13 @@ def add_csrf_protection():
import django.views.decorators
django.views.decorators.csrf = imp.new_module('csrf')
django.views.decorators.csrf.csrf_protect = csrf_protect
+
+def add_available_attrs_decorator():
+ def available_attrs(fn):
+ """
+ Return the list of functools-wrappable attributes on a callable.
+ This is required as a workaround for http://bugs.python.org/issue3445.
+ """
+ return tuple(a for a in WRAPPER_ASSIGNMENTS if hasattr(fn, a))
+ import django.utils.decorators
+ django.utils.decorators.available_attrs = available_attrs