Modify

Opened 2 years ago

Last modified 2 years ago

#10468 reopened enhancement

[patch] Compatibility with 0.11

Reported by: ChrisNelson Owned by: thomasd
Priority: high Component: GroupTicketFieldsPlugin
Severity: normal Keywords:
Cc: rjollos, falkb Trac Release: 0.11

Description

As for SimpleMultiProject, add_script_data() is the major obstacle to using this plugin in 0.11.

Attachments (2)

add_script_data.patch (2.7 KB) - added by ChrisNelson 2 years ago.
Patch to add add_script-data() to 0.11.6
Trac0.11.6.patch (761 bytes) - added by ChrisNelson 2 years ago.
Patch to plugin to work with Trac 0.11.6

Download all attachments as: .zip

Change History (15)

comment:1 Changed 2 years ago by ChrisNelson

  • Type changed from defect to enhancement

There are several levels to this issue:

  • ticket.py in this plugin attempts to import add_script_data() from chrome but it was added in 0.12.
  • add_script_data() relies data handling in layout.html which is not present in 0.11
  • The data handling in layout.html relies on to_json from presentation.py which is not present in 0.11.
  • chrome.py must expose to_json to the template

The attached patch solves all of these problems with small, safe point fixes to several core files.

Changed 2 years ago by ChrisNelson

Patch to add add_script-data() to 0.11.6

comment:2 Changed 2 years ago by ChrisNelson

With the attached patch applied to 0.11.6 and my Trac configured with:

[group-ticket-fields]
relationships = Relationships
relationships.fields = parents,blockedby,blocking
group_order = relationships,main

I get a "Relationships" frame on my ticket form and the label for parents moves to it but group_ticket_fields.js goes out to lunch at line 58 trying to find the parents field. At that point, my Relationships frame looks like:

<fieldset class="property_group" id="properties_relationships"><legend>Relationships</legend><table id="table_relationships"><tbody><tr><th style="display: table-cell;" class="col1">
                  <label for="field-parents">Parent Ticket:</label>
                </th></tr></tbody></table></fieldset>

and my main field set contains:

...
<tr>
  <td style="d!splay: table-cell;" class="col1">
    <input class="" id="field-parents" name="field_parents" 
     value="232" type="text">
  </td>
</tr>

(I can't give you more context without running into T-H's spam filter.)

comment:3 Changed 2 years ago by ChrisNelson

http://api.jquery.com/category/selectors/ tells me that the line:

var value_td = $('td').has('#' + field_id);                     // get the <td>

Is looking for something with the ID in field_id. It's not clear to me if that's a child of the TD or a TD with that ID. Clearly from the HTML above the TD doesn't have an ID.

comment:4 Changed 2 years ago by rjollos

Are you planning to patch Trac or is that just for experimentation purposes? I would suggest that the better approach is to add all of the functionality to the plugin, rather than have the plugin rely on a patched instance of Trac.

Changed 2 years ago by ChrisNelson

Patch to plugin to work with Trac 0.11.6

comment:5 Changed 2 years ago by ChrisNelson

  • Resolution set to fixed
  • Status changed from new to closed
  • Summary changed from Compatibility with 0.11 to [patch] Compatibility with 0.11

I don't know enough jQuery to know why the attached patch makes a difference but it works for me.

Full disclosure, I'm using Trac 0.11.6 on Ubuntu 10.04 and viewing with Firefox 16.0. Firebug reveals jQuery 1.2.6. I assume that comes with Trac and may be updated in later versions. Hopefully my patch works in later versions of Trac, also.

comment:6 follow-up: Changed 2 years ago by rjollos

I see. I thought you were trying to make the plugin compatible with Trac 0.11, not just patch your local version. jQuery is provided by Trac. The version in Trac 0.12 is 1.4.x. The version didn't change in Trac 0.11.7 from 0.11.6.

comment:7 in reply to: ↑ 6 ; follow-up: Changed 2 years ago by ChrisNelson

Replying to rjollos:

Are you planning to patch Trac or is that just for experimentation purposes? I would suggest that the better approach is to add all of the functionality to the plugin, rather than have the plugin rely on a patched instance of Trac.

For my purposes, yes, I'm going to patch the Trac core. We have quite a few patches and managing one more isn't a big deal.

If someone wants to cram this compatibility shim into the plugin, they are welcome to the concepts and code for whatever good it does. I don't quite know how you'd do that but I suppose it could all be done by handling the template in the plugin but I'm uninspired to do that. Sorry. (I might note that patching the core will allow SimpleMultiProject to work, too, and maybe others.)

comment:8 in reply to: ↑ 7 Changed 2 years ago by rjollos

Replying to ChrisNelson:

For my purposes, yes, I'm going to patch the Trac core. We have quite a few patches and managing one more isn't a big deal.

Pretty soon you will have patched your way to Trac 1.0. I guess there are multiple ways to get there ;)

I had, for some time, tried to get as many possible plugins working with Trac 0.11. It is becoming less interesting to me though, since there are so many other things to work on, and hopefully people will start moving away from 0.11 now. I'm starting to focus more on 0.12+ compatibility, which is far less challenging.

comment:9 Changed 2 years ago by ChrisNelson

  • Resolution fixed deleted
  • Status changed from closed to reopened

I guess this patch won't show up in the list of tickets if it is closed so others won't be able to find it.

comment:10 Changed 2 years ago by rjollos

Sometimes people make a note on the main wiki page describing compatibility patches and pointing to closed tickets, but plugin authors seem to like to handle the issue in various ways, depending on how aggressive they are in managing the list of tickets.

comment:11 Changed 2 years ago by falkb

  • Cc falkb added

Thanks very much so far. We just install/update_to the latest Bitnami Trac stack (and this just takes 10 minutes for a new system) and its Trac core is just an .egg file, so a plugin patch is what we need. Well, thomasd and me are very busy atm, but although I was hoping for a plugin patch I think these patches are a good start point for it anyway...

comment:12 Changed 2 years ago by rjollos

falkb: I made a little change so that you'd always get CC'ed (at least when the ticket is created starting from the project wiki page #9959): wiki/GroupTicketFieldsPlugin. Hopefully that is what you want ;)

comment:13 Changed 2 years ago by falkb

Very good... well, I didn't noticed that because my private email isn't registered here :)

Add Comment

Modify Ticket

Action
as reopened .
Author


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

 
Note: See TracTickets for help on using tickets.