Opened 16 years ago
Closed 15 years ago
#4460 closed defect (fixed)
FullBlog broken with 0.12dev
Reported by: | Owned by: | osimons | |
---|---|---|---|
Priority: | normal | Component: | FullBlogPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.12 |
Description
Hi,
I tried to use FullBlog with current Trac trunk (0.12dev-7795) but it fails because it relies on a compatibility function, itemgetter
, that was marked for removal in 0.11 and removed in 0.12...
An easy workaround is to copy itemgetter
from 0.11 (trac/util/compat.py
) but a cleaner fix is probably needed...
Michel
Attachments (4)
Change History (14)
comment:1 follow-up: 4 Changed 16 years ago by
comment:2 follow-up: 3 Changed 16 years ago by
BTW, there is the same issue in FullBlogNotifier.
Michel
comment:3 Changed 16 years ago by
Replying to jouvin@lal.in2p3.fr:
BTW, there is the same issue in FullBlogNotificationPlugin.
And no doubt many others as well that depend on the compat that was yanked away from Trac trunk... That notification plugin isn't mine, so if you find issues with it then please report it in new tickets.
Changed 15 years ago by
Attachment: | 0.12compatibility.diff added |
---|
removes the compat imports that are not needed anymore in trac 0.12
Changed 15 years ago by
Attachment: | 0.12compatibility.2.diff added |
---|
removes the compat imports that are not needed anymore in trac 0.12
comment:5 Changed 15 years ago by
All that is really needed is to remove the imports and it works fine.
Regards
Changed 15 years ago by
Attachment: | 0.12compatibility.3.diff added |
---|
stupid error in forgetting to import the python builtin itemgetter
comment:6 Changed 15 years ago by
sorry for inconvinience, but the third attachment is the proper diff. The first two are the same, but won't work.
comment:7 Changed 15 years ago by
Sorry, can't use operator.itemgetter()
as that was added in Python 2.4 - Trac 0.11.x is still fully Python 2.3 compatible, and that compat fix would likely lead to all sorts of new issues. I'll happily apply any fix that works for Trac 0.11+ and Python 2.3+.
comment:8 Changed 15 years ago by
I'm not all that keen on branching the plugin for 0.12 yet - it increases maintenance for a long time. A workaround may be to try to do the import from trac.util.compat
and if they fail (ie. ImportError
with Trac 0.12) then proceed to import itemgetter
. That should make everyone happy, I think.
comment:9 Changed 15 years ago by
Could you perhaps try something this in the two files:
try: from trac.util.compat import itemgetter from trac.util.compat import sorted, set except ImportError: # 0.12 compat - sorted and set should already be part of Python 2.4 from operator import itemgetter
I'll also need to test that on 0.11 before committing, but I'll get that done when I'm back on my dev machine.
Changed 15 years ago by
Attachment: | 0.12compatibility.4.diff added |
---|
tried it, works, diff attached that works for 0.11 and 0.12
comment:10 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fix committed in [6158]. Thanks!
Seeing 0.12 marks the end-of-line for Python 2.3 support, this compat import is no longer needed - and should just import
itemgetter
directly likefrom operator import itemgetter
.I'll get around to making a 0.12 branch at some stage.