Opened 14 years ago
Closed 14 years ago
#15702 closed (fixed)
Drop 2.4 compatibility boilerplate code
Reported by: | Jonas H. | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | 2.4 | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Here's a patch that removes some 2.4 compatibility boiler plate code. Mostly easy changes like removing/replacing imports.
Note that we can't drop django.utils.functional.curry
entirely because functools.partial
returns a non-function which can't be used as a proper method.
Attachments (1)
Change History (10)
by , 14 years ago
Attachment: | 24boilerplate.patch added |
---|
comment:2 by , 14 years ago
Component: | Uncategorized → Core framework |
---|---|
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Accepted |
Thanks for that.
One thing I've noticed from a quick inspection of the patch; you've removed the Python 2.4 compatibility stuff from django.utils.unittest. That module is a direct copy of the public unittest project, so we're not going to introduce any variations, even if they are surplus to our internal requirements.
There are also some tests for context managers that were added in 1.3 (for transaction context managers and the SQL statement counter in the test framework). These were conditionally included tests for Python 2.4; they now can be integrated into the main suite.
comment:5 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:6 by , 14 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
There is a grave bug since r15927 in Django: The decorator in django/db/transaction.py is missing a return statement, which causes testsuites and everything decorated with any transaction decorator to fail, f.e. with a 'NoneType' object has no attribute 'set_cookie' error.
The fix is so simple that I won't attach a patch for it:
diff --git a/django/db/transaction.py b/django/db/transaction.py index cf7350c..6cbe39f 100644 --- a/django/db/transaction.py +++ b/django/db/transaction.py @@ -207,7 +207,7 @@ class Transaction(object): @wraps(func) def inner(*args, **kwargs): with self: - func(*args, **kwargs) + return func(*args, **kwargs) return inner def _transaction_func(entering, exiting, using):
comment:7 by , 14 years ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Not adding a test either -- the current test suite is sufficient for testing this particular piece of code. And it fails with current SVN trunk.
comment:8 by , 14 years ago
Sorry for the comment spam -- patch is already attached; the patch by jonash contains the return statement, the committed version does not.
Forgot to mention that this passes all tests for me (using the SQLite backend configuration providedin
test_sqlite.py
).