Modify ↓
#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): 424 424 return _('%(kind)s %(id)s%(at_version)s%(in_repo)s', 425 425 kind=kind, id=id, at_version=version, in_repo=in_repo) 426 426 elif resource.realm == 'repository': 427 if not resource.id: 428 return _("Default repository") 427 429 return _("Repository %(repo)s", repo=resource.id) 428 430 429 431 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): 424 424 return _('%(kind)s %(id)s%(at_version)s%(in_repo)s', 425 425 kind=kind, id=id, at_version=version, in_repo=in_repo) 426 426 elif resource.realm == 'repository': 427 return _("Repository %(repo)s", repo=resource.id )427 return _("Repository %(repo)s", repo=resource.id or _("(default)")) 428 428 429 429 def get_resource_url(self, resource, href, **kwargs): 430 430 if resource.realm == 'changeset':
I like the former.
Attachments (0)
Change History (3)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Milestone: | next-stable-1.0.x → 1.0.2 |
---|---|
Release Notes: | modified (diff) |
Resolution: | → fixed |
Status: | new → closed |
comment:3 by , 10 years ago
Owner: | set to |
---|
Note:
See TracTickets
for help on using tickets.
Replying to jomae:
I like the former as well.