Modify

Opened 10 years ago

Closed 10 years ago

#12109 closed defect (fixed)

Not working RoadMap in Trac 1.1.2 - obsolete db API

Reported by: vaclav.cejka@… Owned by: falkb
Priority: normal Component: SimpleMultiProjectPlugin
Severity: major Keywords: RoadMap, get_db_cnx
Cc: Trac Release: 1.2

Description

Because of the change in database API - obsolete function get_db_cnx() is now not supported - plugin fails to show roadmap. Other procedures seem to work. Most of the source code is already fixed, but Version.py was not updated yet, so it might be the reason of the bug. Direct copy of if VERSION statement from updated files to Version.py did not help, but I'm not python coder.

Attachments (0)

Change History (9)

comment:1 Changed 10 years ago by falkb

Status: newaccepted

Thanks for your report!

What happens if you apply this patch?:

  • simplemultiprojectplugin/trunk/simplemultiproject/version.py

     
    9999        version_id = req.args.get('id')
    100100        version_project = req.args.get('project', '')
    101101
    102         db = self.env.get_db_cnx() # TODO: db can be removed
     102        if VERSION < '0.12':
     103            db = self.env.get_db_cnx()
     104        else:
     105            db = self.env.get_read_db()
    103106        action = req.args.get('action', 'view')
    104107        try:
    105108            version = Version(self.env, version_id, db)
     
    449452           
    450453    def _versions_and_stats(self, req, filter_projects):
    451454        req.perm.require('MILESTONE_VIEW')
    452         db = self.env.get_db_cnx()
     455        if VERSION < '0.12':
     456            db = self.env.get_db_cnx()
     457        else:
     458            db = self.env.get_read_db()
    453459       
    454460        versions = Version.select(self.env, db)

comment:2 Changed 10 years ago by falkb

Hint: After changing the code you must call 'python setup.py bdist_egg' in the plugin source directory where setup.py is (in a Trac environment command line shell). Then copy the .egg file from the 'dist' directory to Trac's plugin directory, and restart the Trac server application.

comment:3 Changed 10 years ago by vaclav.cejka@…

Thank you for reaction. I have taken your update from SVN and built it. Unfortunatelly now it says:

TypeError: select() takes exactly 2 arguments (3 given)

in:

File "build/bdist.win32/egg/simplemultiproject/version.py", line 171, in post_process_request
  versions, version_stats = self._versions_and_stats(req, filter_projects)
File "build/bdist.win32/egg/simplemultiproject/version.py", line 460, in _versions_and_stats
  versions = Version.select(self.env, db = db)

It is far beyond my understanding, because Version.select command in code takes 2 arguments

comment:4 Changed 10 years ago by falkb

Methods of classes internally pass the self-Pointer of the calling object as additional "invisible" parameter also. You said in the ticket header you have Trac-1.2, right? Maybe they have changed the API, not sure... (?) ... at the moment I cannot find docs explaining the Version class API... :-( ... maybe someone can help here?

comment:5 Changed 10 years ago by Ryan J Ollos

db parameter has been deprecated since Trac 1.0 and was removed in 1.1.2. Most likely you don't need to pass the parameter even in earlier versions of Trac. It is optional and only needed for transaction nesting.

comment:6 Changed 10 years ago by falkb

In 14337:

see #12109: another try to get plugin compatibility to Trac 1.0.2

comment:7 Changed 10 years ago by falkb

Thanks, Ryan for the hint. Vaclav, please test my blind commit, it works with 1.0.1, anyway.

comment:8 Changed 10 years ago by vaclav.cejka@…

Great, thank you, now it works!

comment:9 Changed 10 years ago by falkb

Resolution: fixed
Status: acceptedclosed

Like++

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain falkb.
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.