Edgewall Software
Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#11629 closed defect (fixed)

Resource description of default repository is not good

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.0.2
Component: version control Version: 0.12.5
Severity: normal Keywords: resource
Cc: Branch:
Release Notes:

Improve resource description of default repository which the name is empty.

API Changes:
Internal Changes:

Description

I noticed that get_resource_description with default repository returns u'Repository ' while working #10961. That result is not good….

>>> from trac.resource import Resource, get_resource_description
>>> from trac.test import EnvironmentStub
>>> resource = Resource('repository', id='')
>>> env = EnvironmentStub()
>>> get_resource_description(env, resource)
u'Repository '
>>> from trac.perm import PermissionError
>>> e = PermissionError('BROWSER_VIEW', resource, env)
>>> unicode(e)
u"BROWSER_VIEW privileges are required to perform this operation on Repository . You don't have the required permissions."

I think it should be u'Default repository' or u'Repository (default)'.

  • trac/versioncontrol/api.py

    diff --git a/trac/versioncontrol/api.py b/trac/versioncontrol/api.py
    index 6a37a67..faf2d52 100644
    a b class RepositoryManager(Component):  
    424424            return _('%(kind)s %(id)s%(at_version)s%(in_repo)s',
    425425                     kind=kind, id=id, at_version=version, in_repo=in_repo)
    426426        elif resource.realm == 'repository':
     427            if not resource.id:
     428                return _("Default repository")
    427429            return _("Repository %(repo)s", repo=resource.id)
    428430
    429431    def get_resource_url(self, resource, href, **kwargs):

Or

  • trac/versioncontrol/api.py

    diff --git a/trac/versioncontrol/api.py b/trac/versioncontrol/api.py
    index 6a37a67..9e6f676 100644
    a b class RepositoryManager(Component):  
    424424            return _('%(kind)s %(id)s%(at_version)s%(in_repo)s',
    425425                     kind=kind, id=id, at_version=version, in_repo=in_repo)
    426426        elif resource.realm == 'repository':
    427             return _("Repository %(repo)s", repo=resource.id)
     427            return _("Repository %(repo)s", repo=resource.id or _("(default)"))
    428428
    429429    def get_resource_url(self, resource, href, **kwargs):
    430430        if resource.realm == 'changeset':

I like the former.

Attachments (0)

Change History (3)

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

Replying to jomae:

I like the former.

I like the former as well.

comment:2 by Jun Omae, 6 years ago

Milestone: next-stable-1.0.x1.0.2
Release Notes: modified (diff)
Resolution: fixed
Status: newclosed

Thanks. Committed in [12821] and merged to trunk in [12822].

comment:3 by Jun Omae, 6 years ago

Owner: set to Jun Omae

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae 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.