Edgewall Software
Modify

Opened 8 years ago

Closed 8 years ago

#12313 closed defect (fixed)

trac.versioncontrol.admin.RepositoryAdminPanel depends on trac.versioncontrol.web_ui.main.VersionControlUI

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.10
Component: general Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fixed Version Control: Repositories admin template not available if trac.versioncontrol.web_ui.* = disabled not followed by trac.versioncontrol.web_ui.main.* = enabled.

API Changes:
Internal Changes:

Description

When using trac-github integration the components trac.versioncontrol.web_ui.* are disabled. With trac.versioncontrol.web_ui.* = disabled the repository admin panel (trac.versioncontrol.admin.RepositoryAdminPanel) shows an error because the template is not available.

The problem is that admin_repositories.html template will only be available if trac.versioncontrol.web_ui.main is enabled. The following configuration will work, but it's not very obvious to the user:

trac.versioncontrol.web_ui.* = disabled
trac.versioncontrol.web_ui.main.* = enabled

Maybe there's a better solution than having a dedicated Component for implementing ITemplateProvider: tags/trac-1.0.9/trac/versioncontrol/web_ui/main.py.

I propose to move the ITemplateProvider implementation to RepositoryManager.

Attachments (0)

Change History (9)

comment:1 by Ryan J Ollos, 8 years ago

There is a circular import in initial changes:

Traceback (most recent call last):
  File "./trac/test.py", line 33, in <module>
    import trac.db.mysql_backend
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/db/mysql_backend.py", line 29, in <module>
    from trac.env import IEnvironmentSetupParticipant
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/env.py", line 42, in <module>
    from trac.versioncontrol.api import RepositoryManager
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/versioncontrol/__init__.py", line 14, in <module>
    from trac.versioncontrol.api import *
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/versioncontrol/api.py", line 30, in <module>
    from trac.web.chrome import ITemplateProvider
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/web/chrome.py", line 48, in <module>
    from trac.env import IEnvironmentSetupParticipant, ISystemInfoProvider
ImportError: cannot import name IEnvironmentSetupParticipant
make: *** [unit-test] Error 1

Let me know if you see a cleaner way to resolve the issue than proposed changes in log:rjollos.git:t12313_versioncontrol_itemplateprovider.

comment:2 by Ryan J Ollos, 8 years ago

In this case the issue might not occur if we separated the Interfaces from the Environment class, by having them in separate modules. I haven't tested out that idea though.

comment:3 by Christian Boos, 8 years ago

Incidentally, while working on #12310 I came across the Environment.shutdown() method and remembered that I wanted to add an "environment life-cycle" interface (#5010 IIRC, yes, getting back in shape ;-) ). I think that as a side-effect it would also address the circular ref issue.

comment:4 by Ryan J Ollos, 8 years ago

#5010 looks interesting. Should we go ahead and implement the fix in this ticket with the thought that at least one of the local imports will be removed when #5010 is implemented?

in reply to:  4 ; comment:5 by Christian Boos, 8 years ago

Replying to Ryan J Ollos:

#5010 looks interesting. Should we go ahead and implement the fix in this ticket with the thought that at least one of the local imports will be removed when #5010 is implemented?

Fine by me, and the other local import is in a backward compat method that we could deprecate.

in reply to:  5 ; comment:6 by Ryan J Ollos, 8 years ago

Replying to Christian Boos:

Fine by me, and the other local import is in a backward compat method that we could deprecate.

Yeah, I would like the remove get_repository in 1.3.1 (#11901). I'll plan to mark it as deprecated if no one else objects. We previously touched on this in comment:32:ticket:11605.

comment:7 by Ryan J Ollos, 8 years ago

Owner: set to Ryan J Ollos
Release Notes: modified (diff)
Status: newassigned

in reply to:  6 comment:8 by Ryan J Ollos, 8 years ago

Replying to Ryan J Ollos:

Yeah, I would like the remove get_repository in 1.3.1 (#11901). I'll plan to mark it as deprecated if no one else objects. We previously touched on this in comment:32:ticket:11605.

Added notice in [14435].

comment:9 by Ryan J Ollos, 8 years ago

Resolution: fixed
Status: assignedclosed

Committed to 1.0-stable in [14447], merged to trunk in [14448].

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'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.