Modify

Opened 14 years ago

Closed 9 years ago

Last modified 7 years ago

#8800 closed defect (fixed)

Support Trac 0.12 without ClearSilver

Reported by: Bangyou Zheng Owned by: Ryan J Ollos
Priority: normal Component: PeerReviewPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description (last modified by Ryan J Ollos)

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@… 13 years ago.
diff for fixing peer review plugin for trac 0.12.2

Download all attachments as: .zip

Change History (10)

comment:1 Changed 14 years ago by Bangyou Zheng

Trac Release: 0.110.12

comment:2 Changed 14 years ago by Ryan J Ollos

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 Changed 13 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 13 years ago by trevor.w.ratliff@…

diff for fixing peer review plugin for trac 0.12.2

comment:4 Changed 13 years ago by Peter 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 12 years ago by Ryan J Ollos

Description: modified (diff)
Owner: changed from Sebastian Marek to Ryan J Ollos
Summary: Is there any progress to support Trac 0.12 without GenshiSupport Trac 0.12 without ClearSilver

comment:6 in reply to:  3 Changed 12 years ago by Ryan J Ollos

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?

comment:7 Changed 9 years ago by Cinc-th

In 15173:

Preparation for multiple repos.

  • Use RepositoryManager.get_repository()' instead of env.get_repository().
  • Use get_youngest_rev() instead of youngest_rev

Refs #8800

comment:8 in reply to:  7 Changed 9 years ago by Cinc-th

Replying to Cinc-th:

In 15173:

Preparation for multiple repos.

  • Use RepositoryManager.get_repository()' instead of env.get_repository().
  • Use get_youngest_rev() instead of youngest_rev

Refs #8800

This is not related to Clearsilver but makes the source more 0.12 like. Adds the patch from comment:4.

Last edited 9 years ago by Cinc-th (previous) (diff)

comment:9 Changed 9 years ago by Cinc-th

Resolution: fixed
Status: newclosed

The current trunk [15204] works for me with 0.12.3.

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.