Opened 8 years ago

Closed 8 years ago

# Add support for Trac 1.1.3dev to the VotePlugin

Reported by: Owned by: Christian Boos Ryan J Ollos normal VotePlugin normal Steffen Hoffmann

### Description

While upgrading t.e.o to 1.1.3dev, I hit a few incompatibilities due to the removal of backward compatibility code (#T11494).

Here's a refresh of the plugin code (trunk).

### Changed 8 years ago by Christian Boos

removal of get_db_cnx mainly

See #11948.

### comment:2 follow-up:  4 Changed 8 years ago by Christian Boos

Thanks for the pointer... looks like I completely overlooked that. However my patch is in the trunk style only while Jun's is probably more compatible across Trac versions (0.12.x -> 1.1.x?). I'd suggest branching a 1.0 version for #11948 and have mine on trunk.

But it's up to @hasienda...

• ## tracvote/__init__.py

 """Return a tuple of (body_text, title_text) describing the votes on a resource. """ negative, total, positive = resource and \ self.get_vote_counts(resource) or (0,0,0) negative, total, positive = self.get_vote_counts(resource) if resource \ else (0,0,0) count_detail = ['%+i' % i for i in (positive, negative) if i] if count_detail: count_detail = ' (%s)' % ', '.join(count_detail) else: count_detail = '' return ('%+i' % total, 'Vote count%s' % count_detail) return ('%+i' % total, 'VOTE2 count%s' % count_detail) def _get_tables(self, dburi, cursor): """Code from TracMigratePlugin by Jun Omae (see tracmigrate.admin)."""

Please explain the second change in this last chunk for __init__.py. Anything else looks clear to me so far.

### comment:4 in reply to:  2 Changed 8 years ago by Steffen Hoffmann

Thanks for the pointer... looks like I completely overlooked that. However my patch is in the trunk style only while Jun's is probably more compatible across Trac versions (0.12.x -> 1.1.x?). I'd suggest branching a 1.0 version for #11948 and have mine on trunk.

But it's up to @hasienda...

Jun really made elaborated attempts on maintaining 0.11 backwards-compatibility based on the 0.12 Trac db API, and not only for this plugin.

I did favor this notion for a long time myself. But I do not feel, that

1. I'm up for the task of maintaining 0.11 backwards-compatibility any longer
2. its still worth to keep 0.11, effectively reducing pressure to upgrade
3. its sensible in terms of maintenance effort to do an intermediate step instead of moving forwards to current (1.0) Trac db API right-away

So while I do highly appreciate that contribution, I'll only apply changes from #11948 for a last, tagged plugin release dedicated to 0.11. That strategy fits with recent conclusions for Trac core development, that declared 0.11 dead maintenance-wise.

An immediate move of trunk right up to 1.0 for tracvotes-0.3 using your contribution should follow. Neither is 0.12 worth adopting that late - while we're already heading for Trac 1.2, nor do I have skills and time to maintain that intermediate db API version, that is, now depreciated as well. So IMHO this is the only way of keeping maintenance effort at a reasonable level for the future.

### comment:5 in reply to:  3 ; follow-up:  6 Changed 8 years ago by Christian Boos

-        return ('%+i' % total, 'Vote count%s' % count_detail)
+        return ('%+i' % total, 'VOTE2 count%s' % count_detail)


Please explain the second change in this last chunk for __init__.py. Anything else looks clear to me so far.

Oops, "debugging" changes I forgot to remove...

### comment:6 in reply to:  5 Changed 8 years ago by Steffen Hoffmann

Please explain the second change in this last chunk for __init__.py. Anything else looks clear to me so far.

Oops, "debugging" changes I forgot to remove...

I see, so will clear that before applying.

Just another thought: Do you see a reason to prefer the threefold query on votes table (total, positive and negative count) over calculating vote count total as sum of the other two? If that calculation would be sufficient, removing the corresponding db query would be one of the next improvements on trunk for tracvote-0.3dev.

### comment:7 Changed 8 years ago by Ryan J Ollos

The patch looks good to me. As for supporting Trac 0.11, I really don't feel it is worth our collective valuable and limited time. The final maintenance release was almost 5 years ago, and it was declared dead maintenance-wise around that time. I vote for just applying this patch so that we can get VotePlugin reinstalled on t-h.o.

### comment:8 Changed 8 years ago by Ryan J Ollos

In 14318:

Create 0.11 branch for supporting Trac < 1.0. Trunk will support Trac 1.0 and later. Refs #11948, #12048.

### comment:9 Changed 8 years ago by Ryan J Ollos

I branched the trunk to voteplugin/branches/0.11 so we could release a version compatible with Trac 0.11 without holding up progress on the version compatible with Trac 1.0 and later. I'm eager to move forward with a Trac 1.0+ compatible version since we are moving towards the release of Trac 1.2, likely within the next 6 months.

Last edited 8 years ago by Ryan J Ollos (previous) (diff)

### comment:10 Changed 8 years ago by Ryan J Ollos

Resolution: → fixed new → closed

In 14319:

0.3dev: Adapted to Trac 1.0 database API. The trunk now supports Trac 1.0 and later. Fixes #12048.

Patch by Christian Boos.

### comment:11 Changed 7 years ago by Ryan J Ollos

In 14591:

0.3dev: Remove compatibility code for Trac < 1.0.

• The trunk doesn't support Trac < 1.0 since [14319]. Refs #12048.
• Also, avoid unnecessary list creation in function calls that accept a generator.

### Modify Ticket

Change Properties