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)

24boilerplate.patch (63.2 KB ) - added by Jonas H. 14 years ago.

Download all attachments as: .zip

Change History (10)

by Jonas H., 14 years ago

Attachment: 24boilerplate.patch added

comment:1 by Jonas H., 14 years ago

Forgot to mention that this passes all tests for me (using the SQLite backend configuration provided in test_sqlite.py).

Last edited 14 years ago by Jonas H. (previous) (diff)

comment:2 by Russell Keith-Magee, 14 years ago

Component: UncategorizedCore framework
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

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:3 by Adrian Holovaty, 14 years ago

In [15926]:

Removed a bunch of Python 2.4 workarounds now that we don't support it. Refs #15702 -- thanks to jonash for the patch. Splitting this over muliple commits to make it more manageable.

comment:4 by Adrian Holovaty, 14 years ago

In [15927]:

Removed a bunch more Python 2.4 workarounds now that we don't support that version. Refs #15702 -- thanks to jonash for the patch.

comment:5 by Adrian Holovaty, 14 years ago

Resolution: fixed
Status: newclosed

This is fixed as of [15926] and [15927]. Note that I found four more uses of django.utils.hashcompat that weren't included in the patch. I also didn't touch the stuff in django.utils.unittest per Russell's comment. Thanks, jonash!

comment:6 by Matthias Kestenholz, 14 years ago

Resolution: fixed
Status: closedreopened

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 Matthias Kestenholz, 14 years ago

Patch needs improvement: unset
Triage Stage: AcceptedReady 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 Matthias Kestenholz, 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.

comment:9 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: reopenedclosed

In [15937]:

Fixed #15702 -- Corrected problem in test suite introduced by Python 2.4 changes from r15927. Thanks to mk for the report and patch.

Note: See TracTickets for help on using tickets.
Back to Top