-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debian squeeze python/django version dependancies #59
Comments
Was brain dead when I supplied that patch, the e variable isn't even used, so it should be possible to have to work it with any recent python version: --- a/django_tables2/columns.py
+++ b/django_tables2/columns.py
@@ -276,7 +276,7 @@ class LinkColumn(Column):
# and use that to decide whether to render a link or just the default
try:
raw = bound_column.accessor.resolve(record)
- except (TypeError, AttributeError, KeyError, ValueError) as e:
+ except (TypeError, AttributeError, KeyError, ValueError):
raw = None
if raw is None:
return self.default Also suggest something like this to remove the dependancy on Django 1.3, unless code uses the as_html() function: --- a/django_tables2/tables.py
+++ b/django_tables2/tables.py
@@ -6,7 +6,6 @@ from django.http import Http404
from django.utils.datastructures import SortedDict
from django.template import RequestContext
from django.template.loader import get_template
-from django.test.client import RequestFactory
from django.utils.encoding import StrAndUnicode
import sys
from .utils import Accessor, AttributeDict, OrderBy, OrderByTuple, Sequence
@@ -285,6 +284,7 @@ class Table(StrAndUnicode):
generated will clobber the querystring of the request. Use the
``{% render_table %}`` template tag instead.
"""
+ from django.test.client import RequestFactory
request = RequestFactory().get('/')
template = get_template(self.template)
return template.render(RequestContext(request, {'table': self})) |
Thanks for this! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Unfortunately Debian stable only has Python 2.6. Fortunately, the solution is a one line change:
Unfortunately this might break Python 3.x compatibility if that is desired.
django-tables2, unfortunately requires django >= 1.3, at least there is a backport available for Debian stable. This is required for django.test.client.RequestFactory
I see that django.test.client.RequestFactory is only required for one method; a method I don't use - would it be possible to make this import optional?
The text was updated successfully, but these errors were encountered: