Modify

Opened 3 years ago

Last modified 3 months ago

#8800 new defect

Support Trac 0.12 without ClearSilver

Reported by: helend Owned by: rjollos
Priority: normal Component: PeerReviewPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description (last modified by rjollos)

This plugin is wonderful. But It can not support Trac 0.12 without ClearSilver.

Current is there any plan to support Trac 0.12?

Thank you very much!

Attachments (1)

peerreviewplugin_dev2_2_diff_Trac_0_12_2.diff (10.1 KB) - added by trevor.w.ratliff@… 3 years ago.
diff for fixing peer review plugin for trac 0.12.2

Download all attachments as: .zip

Change History (7)

comment:1 Changed 3 years ago by helend

  • Trac Release changed from 0.11 to 0.12

comment:2 Changed 3 years ago by rjollos

Genshi is a requirement for Trac 0.11 and later, see t:TracInstall#MandatoryDependencies. Do you mean that ClearSilver is still required? That should not be the case, see #3187, but it is still possible.

comment:3 follow-up: Changed 3 years ago by trevor.w.ratliff@…

I was able to get this plugin to work from the 2.2-dev branch with the attached diff file (peerreviewplugin_dev2_2_diff_Trac_0_12_2.diff). I hacked this together because I really liked this plugin, and I needed it to work in Trac 0.12.2.

It still isn't perfect, it doesn't handle multiple repositories properly (it will only see the first repo in your repository list), but it does what we need it to do. There are also some issues with the Genshi templates and trying to import other templates - so I just copied the functions into the template I needed (not good for maintainability).

Changed 3 years ago by trevor.w.ratliff@…

diff for fixing peer review plugin for trac 0.12.2

comment:4 Changed 2 years ago by Peter Stephens <peter.a.stephens@…>

I got it to work on Fedora 16. Not professional. I have no Python experience, but it works. Note that I also had to get a clearsilver 'error.cs' file and put it at '/usr/lib/python2.7/site-packages/trac/templates/error.cs'.

Here is the code changes,

  • peerReviewPerform.py

    [hzqmrk@gazoo codereview]$ svn diff
     
    3030import string 
    3131 
    3232from genshi.builder import tag 
     33from trac.versioncontrol.api import RepositoryManager 
    3334 
    3435class UserbaseModule(Component): 
    3536    implements(INavigationContributor, IRequestHandler, ITemplateProvider, IHTMLPreviewAnnotator) 
     
    140141            return 'error.cs', None 
    141142 
    142143        #get the respository 
    143         repos = self.env.get_repository(req.authname) 
     144        #repos = self.env.get_repository(req.authname) 
     145        repos = RepositoryManager(self.env).get_repository('') 
    144146        #get the file attributes 
    145147        req.hdf['review.path'] = resultFile.Path 
    146148        req.hdf['review.version'] = resultFile.Version 
  • peerReviewBrowser.py

     
    2222from trac.web.chrome import add_link, add_stylesheet 
    2323from trac.wiki import wiki_to_html, wiki_to_oneliner, IWikiSyntaxProvider 
    2424from trac.versioncontrol.web_ui.util import * 
     25from trac.versioncontrol.api import RepositoryManager  
    2526 
    2627from genshi.builder import tag 
    2728 
     
    8485        path = req.args.get('path', '/') 
    8586        rev = req.args.get('rev') 
    8687 
    87         repos = self.env.get_repository(req.authname) 
     88        repos = RepositoryManager(self.env).get_repository('')  
    8889 
    8990        try: 
    9091            node = get_existing_node(self.env, repos, path, rev) 
    9192        except: 
    92             rev = repos.youngest_rev 
     93            rev = repos.get_youngest_rev() 
    9394            node = get_existing_node(self.env, repos, path, rev) 
    9495        
    9596        hidden_properties = [p.strip() for p 
     
    9899        req.hdf['title'] = path 
    99100        req.hdf['browser'] = { 
    100101            'path': path, 
    101             'revision': rev or repos.youngest_rev, 
     102            'revision': rev or repos.get_youngest_rev(), 
    102103            'props': dict([(util.escape(name), util.escape(value)) 
    103104                           for name, value in node.get_properties().items() 
    104105                           if not name in hidden_properties]), 
    105106            'href': util.escape(self.env.href.peerReviewBrowser(path, rev=rev or 
    106                                                       repos.youngest_rev)), 
     107                                                      repos.get_youngest_rev())), 
    107108            'log_href': util.escape(self.env.href.log(path, rev=rev or None)) 

comment:5 Changed 19 months ago by rjollos

  • Description modified (diff)
  • Owner changed from proofek to rjollos
  • Summary changed from Is there any progress to support Trac 0.12 without Genshi to Support Trac 0.12 without ClearSilver

comment:6 in reply to: ↑ 3 Changed 19 months ago by rjollos

Replying to trevor.w.ratliff@gmail.com:

There are also some issues with the Genshi templates and trying to import other templates - so I just copied the functions into the template I needed (not good for maintainability).

Could you describe this problem in more detail?

Add Comment

Modify Ticket

Action
as new .
Author


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

 
Note: See TracTickets for help on using tickets.