Modify ↓
Opened 11 years ago
Last modified 15 months ago
#11547 new defect
Inconsistent results from get_resource_summary
Reported by: | Ryan J Ollos | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | next-stable-1.6.x |
Component: | general | Version: | 1.0-stable |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
trac.resource.get_resource_summary
is inconsistent when resource.id
is None
:
>>> from trac.resource import Resource, get_resource_summary >>> from trac.env import Environment >>> env = Environment('/home/user/Workspace/tracdev/tracdev') >>> r1 = Resource('wiki', 'WikiStart') >>> print get_resource_summary(env, r1) WikiStart >>> r2 = Resource('wiki') >>> print get_resource_summary(env, r2) None >>> r3 = Resource('ticket', 1) >>> print get_resource_summary(env, r3) u'defect: Ticket One (new)' >>> r4 = Resource('ticket') >>> print get_resource_summary(env, r4) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "trac/resource.py", line 347, in get_resource_summary return get_resource_description(env, resource, 'summary') File "trac/resource.py", line 333, in get_resource_description return manager.get_resource_description(resource, format, **kwargs) File "trac/ticket/api.py", line 548, in get_resource_description return self.format_summary(*args) File "trac/ticket/api.py", line 554, in format_summary summary = type + ': ' + summary TypeError: coercing to Unicode: need string or buffer, NoneType found >>> r5 = Resource('milestone', 'milestone1') >>> print get_resource_summary(env, r5) Milestone milestone1 >>> r6 = Resource('milestone') >>> print get_resource_summary(env, r6) Milestone None >>> r7 = Resource('changeset', 1) >>> print get_resource_summary(env, r7) Changeset 1 >>> r8 = Resource('changeset') >>> print get_resource_summary(env, r8) Changeset None >>> r9 = Resource('attachment', 'SearchResults.png', parent=Resource('ticket', 1)) >>> print get_resource_summary(env, r9) >>> r10 = Resource('attachment', parent=Resource('ticket', 1)) >>> print get_resource_summary(env, r10) None
We should fix the case of Resource('ticket')
so that it returns None
rather than raising an exception.
Attachments (0)
Change History (6)
comment:1 by , 11 years ago
Milestone: | next-stable-1.0.x → 1.0.3 |
---|
comment:2 by , 10 years ago
Status: | new → assigned |
---|
comment:3 by , 10 years ago
Milestone: | 1.0.3 → next-stable-1.0.x |
---|---|
Owner: | removed |
Status: | assigned → new |
comment:4 by , 8 years ago
Milestone: | next-stable-1.0.x → next-stable-1.2.x |
---|
comment:5 by , 5 years ago
Milestone: | next-stable-1.2.x → next-stable-1.4.x |
---|
Note:
See TracTickets
for help on using tickets.
Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.