Ticket #10918 (closed defect: fixed)

Opened 3 months ago

Last modified 2 months ago

Version and Roadmap views shows error when version has at least one defined milestone associated

Reported by: dawuid@gmail.com Assigned to: rjollos
Priority: normal Component: ExtendedVersionPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

Environment:

  • Trac: 1.0.1
  • ExtendedVersion: revision 12688
  • Milestone associated with a version

Steps to reproduce:

  • If there is no milestone associated with a version:
    1. Assure ExtendedVersion has property roadmap_navigation in false (this is only to assure to get a binding relationship between milestone and version due to Admin View not having capability to do that binding).
    2. In Roadmap View select a Milestone
    3. Select edit and in Milestone Edit View, associate the milestone with a available version
  1. Go to Versions view -> crash with pile:
    XXXX-XX-XX XX:XX:XX,XXX Trac[main] ERROR: Internal Server Error: 
    Traceback (most recent call last):
      File "XXX\Trac-1.0.1-py2.7-win32.egg.tmp\trac\web\main.py", line 497, in _dispatch_request
        dispatcher.dispatch(req)
      File "XXX\Trac-1.0.1-py2.7-win32.egg.tmp\trac\web\main.py", line 214, in dispatch
        resp = chosen_handler.process_request(req)
      File "XXX\site-packages\extendedversiontracplugin-0.1dev-py2.7.egg\extendedversion\version.py", line 147, in process_request
        return self._render_view(req, db, version)
      File "XXX\site-packages\extendedversiontracplugin-0.1dev-py2.7.egg\extendedversion\version.py", line 315, in _render_view
        milestone._from_database(row)
    AttributeError: 'Milestone' object has no attribute '_from_database'
    

I think the problem comes for last changes in 1.0.1 version of Trac (ticket 10879). Revisions related with that ticket (especially changeset 11523) changes Milestone class (from 1.1.x branch).

ExtendedVersion plugin uses Milestone in the old way (<= 1.0), with _from_database method. With this changes of 1.1.x in 1.0.x, MilestoneCache must be used (fecth or factory) to make ExtendedVersion plugin work. Also due and complete fields of milestone has to be converted with from_utimestamp method if they are recovered directly from database.

The patch attached to ticket is a simple solution, not the best approach, but it's working.

Attachments

patch.patch (1.8 kB) - added by dawuid@gmail.com on 03/08/13 14:01:05.
Patch to change use of Milestone to MilestoneCache?
patch.2.patch (1.8 kB) - added by dawuid@gmail.com on 03/08/13 14:04:17.
Patch to change use of Milestone to MilestoneCache? (corrected)

Change History

03/08/13 14:01:05 changed by dawuid@gmail.com

  • attachment patch.patch added.

Patch to change use of Milestone to MilestoneCache?

03/08/13 14:04:17 changed by dawuid@gmail.com

  • attachment patch.2.patch added.

Patch to change use of Milestone to MilestoneCache? (corrected)

03/08/13 14:07:22 changed by dawuid@gmail.com

Patch patch.patch was ill defined. patch.2.patch is the valid patch. Sorry.

03/09/13 15:21:18 changed by rjollos

  • owner changed from mestudd to rjollos.
  • status changed from new to assigned.

Thank you for the patch!

03/09/13 17:55:40 changed by rjollos

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [12696]) Fixes #10918: Fetch milestone through its public interface by passing a name parameter to the constructor, to avoid needing to access the private member _from_database, which was removed in Trac 1.0.1. Thanks to dawuid@gmail.com for reporting the issue.

(in reply to: ↑ description ) 03/09/13 17:59:44 changed by rjollos

Replying to dawuid@gmail.com:

ExtendedVersion plugin uses Milestone in the old way (<= 1.0), with _from_database method. With this changes of 1.1.x in 1.0.x, MilestoneCache must be used (fecth or factory) to make ExtendedVersion plugin work. Also due and complete fields of milestone has to be converted with from_utimestamp method if they are recovered directly from database.

The plugin shouldn't have been accessing the private member _from_database. The milestone object can be fully populated by passing the name parameter to the constructor, which prevents us from needing to directly access a MilestoneCache object that was added in 1.0.1, and avoid any backward compatibility issues for the ExtendedVersionPlugin codebase.

03/10/13 10:59:25 changed by dawuid@gmail.com

Thank you for your quick response and for a perfect patch! Installed and working :-)

03/18/13 20:56:42 changed by rjollos

  • summary changed from Version and Roadmap views shows error in when almoste one defined version has a milestone associated to Version and Roadmap views shows error when version has at least one defined milestone associated.

Add/Change #10918 (Version and Roadmap views shows error when version has at least one defined milestone associated)




Change Properties
Action