Modify

Opened 12 years ago

Last modified 9 years ago

#10169 new enhancement

[PATCH] improve compatibility with Trac 0.12 / 1.0

Reported by: Genie Owned by:
Priority: high Component: TracMetrixPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

Hi~, This is patch for Trac 0.12 / 1.0 compatibility.

  • tracmetrixplugin/web_ui.py

     
    2828from trac.util.datefmt import to_datetime, utc
    2929from trac.web import IRequestFilter, IRequestHandler, ITemplateStreamFilter
    3030from trac.web.chrome import add_stylesheet, INavigationContributor, ITemplateProvider
     31from trac import __version__
    3132
    3233from tracmetrixplugin.model import ChangesetsStats, TicketGroupMetrics
    3334
     
    8687        milestoneName = u"".join(e[1] for e in self.buffer.events)
    8788        title = "Go to TracMetrix for %s" % milestoneName
    8889        href = self.baseHref.mdashboard(milestoneName)
     90        func = ( __version__ < '1.0') and tag.dd or tag.span # Trac >= 1.0dev
    8991
    90         return iter(tag.dd('[', tag.a('TracMetrix', href=href, title=title), ']'))
     92        return iter( func('[', tag.a('TracMetrix', href=href, title=title), ']'))
    9193
    9294
    9395
     
    104106
    105107        if filename in ('roadmap.html', ):
    106108
     109            tag = ( __version__ < '0.12.1') and 'li' or 'div' # Trac >= 0.12.1
     110            cls = ( __version__ < '1.0') and ''   or ' trac-progress'     # Trac >= 1.0dev
     111            obj = ( __version__ < '1.0') and 'dl' or 'p[@class="legend"]' # Trac >= 1.0dev
     112
    107113            buffer = StreamBuffer()
    108             t = Transformer('//li[@class="milestone"]/div[@class="info"]/h2/a/em/text()')
     114            t = Transformer('//'+ tag +'[@class="milestone"]/div[@class="info'+ cls +'"]/h2/a/em/text()')
    109115            t = t.copy(buffer).end()
    110             t = t.select('//li[@class="milestone"]/div[@class="info"]/dl')
     116            t = t.select('//'+ tag +'[@class="milestone"]/div[@class="info'+ cls +'"]/'+ obj)
    111117            t = t.append(GenerateMetrixLink(buffer, req.href))
    112118            stream |= t
    113119
     
    125131
    126132        if filename in ('milestone_view.html', ):
    127133
     134            cls = ( __version__ < '1.0') and ''   or ' trac-progress'     # Trac >= 1.0dev
     135            obj = ( __version__ < '1.0') and 'dl' or 'p[@class="legend"]' # Trac >= 1.0dev
     136
    128137            buffer = StreamBuffer()
    129138            t = Transformer('//div[@class="milestone"]/h1/text()[2]')
    130139            t = t.copy(buffer).end()
    131             t = t.select('//div[@class="milestone"]/div[@class="info"]/dl')
     140            t = t.select('//div[@class="milestone"]/div[@class="info'+ cls +'"]/'+ obj)
    132141            t = t.append(GenerateMetrixLink(buffer, req.href))
    133142            stream |= t

Attachments (0)

Change History (6)

comment:1 Changed 12 years ago by Ryan J Ollos

Thanks for the patch! Could you give a brief explanation of what the patch accomplishes or the changes in 0.12/1.0 that you are trying to address?

comment:2 Changed 12 years ago by Genie

Roadmap(Milestone) view Layout has changed.

Trac >= 0.12.1:

. roadmap.html ( li[@class="milestone"] -> div[@class="milestone"] )

r9662

comment:3 Changed 12 years ago by Genie

Trac >= 1.0dev (0.13dev):

. roadmap.html ( div[@class="info" -> div[@class="info trac-progress" )

. milestone_view.html ( div[@class="info" -> div[@class="info trac-progress" )

r10751

. progress_bar.html ( dl -> p[@class="legend"] )

r10662

comment:4 Changed 12 years ago by Ryan J Ollos

Priority: normalhigh
Status: newassigned

comment:5 Changed 11 years ago by Ryan J Ollos

Status: assignednew

comment:6 Changed 9 years ago by Ryan J Ollos

Owner: Ryan J Ollos deleted

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.

Add Comment


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

 
Note: See TracTickets for help on using tickets.