Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#12048 closed defect (fixed)

Add support for Trac 1.1.3dev to the VotePlugin

Reported by: Christian Boos Owned by: Ryan J Ollos
Priority: normal Component: VotePlugin
Severity: normal Keywords:
Cc: Steffen Hoffmann Trac Release:

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).

Attachments (1)

voteplugin-trunk-r13209.diff (29.8 KB) - added by Christian Boos 10 years ago.
removal of get_db_cnx mainly

Download all attachments as: .zip

Change History (12)

Changed 10 years ago by Christian Boos

removal of get_db_cnx mainly

comment:1 Changed 10 years ago by Dirk Stöcker

See #11948.

comment:2 Changed 10 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...

comment:3 Changed 10 years ago by Steffen Hoffmann

  • tracvote/__init__.py

     
    676658        """Return a tuple of (body_text, title_text) describing the votes on a
    677659        resource.
    678660        """
    679         negative, total, positive = resource and \
    680                                     self.get_vote_counts(resource) or (0,0,0)
     661        negative, total, positive = self.get_vote_counts(resource) if resource \
     662            else (0,0,0)
    681663        count_detail = ['%+i' % i for i in (positive, negative) if i]
    682664        if count_detail:
    683665            count_detail = ' (%s)' % ', '.join(count_detail)
    684666        else:
    685667            count_detail = ''
    686         return ('%+i' % total, 'Vote count%s' % count_detail)
     668        return ('%+i' % total, 'VOTE2 count%s' % count_detail)
    687669
    688670    def _get_tables(self, dburi, cursor):
    689671        """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 10 years ago by Steffen Hoffmann

Replying to cboos:

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 ; Changed 10 years ago by Christian Boos

Replying to hasienda:

-        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 10 years ago by Steffen Hoffmann

Replying to cboos:

Replying to hasienda:

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 10 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 10 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 10 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 10 years ago by Ryan J Ollos (previous) (diff)

comment:10 Changed 10 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

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 10 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
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
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.