Modify

Opened 16 years ago

Closed 15 years ago

#4460 closed defect (fixed)

FullBlog broken with 0.12dev

Reported by: jouvin@… 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)

0.12compatibility.diff (1.0 KB) - added by shookie@… 15 years ago.
removes the compat imports that are not needed anymore in trac 0.12
0.12compatibility.2.diff (1.0 KB) - added by shookie@… 15 years ago.
removes the compat imports that are not needed anymore in trac 0.12
0.12compatibility.3.diff (1.2 KB) - added by shookie 15 years ago.
stupid error in forgetting to import the python builtin itemgetter
0.12compatibility.4.diff (1.6 KB) - added by shookie@… 15 years ago.
tried it, works, diff attached that works for 0.11 and 0.12

Download all attachments as: .zip

Change History (14)

comment:1 Changed 16 years ago by osimons

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 like from operator import itemgetter.

I'll get around to making a 0.12 branch at some stage.

comment:2 Changed 16 years ago by jouvin@…

BTW, there is the same issue in FullBlogNotifier.

Michel

comment:3 in reply to:  2 Changed 16 years ago by osimons

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.

comment:4 in reply to:  1 Changed 16 years ago by anonymous

it works fine! THX.

Changed 15 years ago by shookie@…

Attachment: 0.12compatibility.diff added

removes the compat imports that are not needed anymore in trac 0.12

Changed 15 years ago by shookie@…

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 shookie@…

All that is really needed is to remove the imports and it works fine.

Regards

Changed 15 years ago by shookie

Attachment: 0.12compatibility.3.diff added

stupid error in forgetting to import the python builtin itemgetter

comment:6 Changed 15 years ago by shookie@…

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 osimons

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 osimons

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 osimons

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 shookie@…

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 osimons

Resolution: fixed
Status: newclosed

Fix committed in [6158]. Thanks!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain osimons.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.