Modify

Opened 11 years ago

Closed 11 years ago

#11302 closed defect (fixed)

AttributeError: 'unicode' object has no attribute 'id'

Reported by: bormotov@… Owned by: Steffen Hoffmann
Priority: normal Component: TagsPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

How to Reproduce

While doing a GET operation on /tags/icm, Trac issued an internal error.

trac.ini:

[tags]
ignore_closed_tickets = true
ticket_fields = keywords

icm - keyword from tickets.

On wiki pages and fullblog tags work fine.

Request parameters:

{'blog': u'on', 'ticket': u'on', 'wiki': u'on'}

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0

System Information

Trac 1.0.1
Trac 1.0.1
Docutils 0.6
FullBlog 0.1.1-r12111
Genshi 0.7 (with speedups)
mod_wsgi 3.3 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL})
Pygments 1.6
pysqlite 2.3.3
Python 2.5.1 (r251:54863, Jul 18 2008, 20:21:35)
[GCC 4.3.0 20080428 (ASPLinux 4.3.0-8)]
Python 2.5.1 (r251:54863, Jul 18 2008, 20:21:35)
[GCC 4.3.0 20080428 (ASPLinux 4.3.0-8)]
pytz 2009r
pytz 2009r
setuptools 0.6c9
setuptools 0.6c9
SQLite 3.6.12
Subversion 1.5.6 (r36142)
jQuery 1.7.2

Enabled Plugins

ColorMacro r7355
Customer r2
PrivateWikis 1.0.0
timingandestimationplugin 1.3.7
TracAnnouncer 1.0dev-r12503
TracFullBlogPlugin 0.1.1-r12111
TracIncludeMacro 3.0.0dev-r12030
TracTags 0.7dev-r13304

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 214, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.5/site-packages/tractags/web_ui.py", line 134, in process_request
    macros.expand_macro(formatter, macro, args) \
  File "/usr/lib/python2.5/site-packages/tractags/macros.py", line 231, in expand_macro
    results = sorted(query_result, key=lambda r: \
  File "/usr/lib/python2.5/site-packages/tractags/api.py", line 218, in query
    query_tags) or []:
  File "/usr/lib/python2.5/site-packages/tractags/ticket.py", line 92, in get_tagged_resources
    self._check_permission(req, name, 'view'):
  File "/usr/lib/python2.5/site-packages/tractags/ticket.py", line 61, in _check_permission
    if self.fast_permcheck or not (resource and resource.id):
AttributeError: 'unicode' object has no attribute 'id'

Attachments (0)

Change History (8)

comment:1 Changed 11 years ago by Steffen Hoffmann

I see. It is connected to the permission checking.

Just for completeness:

  • 'icm' is a tag from one or more open tickets?
  • In that request you follow the tag link from the tag cloud?
  • Your 'tags' section option list is complete?
  • You don't have a custom 'permission_policies' setting in your 'trac' section in trac.ini, it is just at the default value?

comment:2 in reply to:  1 Changed 11 years ago by anonymous

Replying to hasienda:

I see. It is connected to the permission checking.

Just for completeness:

  • 'icm' is a tag from one or more open tickets?

121 open tickets with 'icm' in keywords field

  • In that request you follow the tag link from the tag cloud?

yes, from cloud at /trac/tags

url looks like /trac/tags/icm?wiki=on&blog=on&ticket=on

request /trac/tags/icm?wiki=on and /trac/tags/icm?blog=on return correct results - list wiki pages and no blog records

  • Your 'tags' section option list is complete?

yes. But values 'component' or 'milestone' (or combination) on 'ticket_fields' give the same result

  • You don't have a custom 'permission_policies' setting in your 'trac' section in trac.ini, it is just at the default value?

no,

permission_policies = InternalTicketsPolicy, PrivateWikiSystem, DefaultPermissionPolicy, LegacyAttachmentPolicy
Last edited 11 years ago by Ryan J Ollos (previous) (diff)

comment:3 Changed 11 years ago by Steffen Hoffmann

In 13379:

TagsPlugin: Fix an issue with TicketTagProvider's get_tagged_resources method, refs #11302.

This flaw, introduced in [13166], hits only for configurations that require
fine-grained permission checks. Another unit test reproduces the issue too
for all affected revisions before this one.

comment:4 Changed 11 years ago by bormotov <bormotov@…>

Resolution: fixed
Status: newclosed

it's work! thanks

comment:5 in reply to:  4 Changed 11 years ago by Steffen Hoffmann

Resolution: fixed
Status: closedreopened

Replying to bormotov <bormotov@…>:

it's work! thanks

You're welcome. I appreciate your instant test feedback, but leave general ticket processing to me, please. There are different approaches, I know. I found it helpful to keep tickets open until the fix went into a stable release. A good portion of Trac users and admins like to stick to stable revisions, so I use to close tickets at release time. In this case the issue will officially marked as resolved by the upcoming tags-0.7 release. Thank you for taking care.

comment:6 Changed 11 years ago by Steffen Hoffmann

Status: reopenednew

comment:7 Changed 11 years ago by Steffen Hoffmann

In 13712:

TagsPlugin: Return all tags for matching tickets, refs #4503, #11226 and #11302.

When moving ticket tags to normalized storage in [13165], my adapted db query
did no longer retrieve all tags for matching tickets in ticket tag provider
method get_tagged_resources().

Using this method in TagSystem.replace_tag() consequently caused
reproducible loss of all ticket tags other than the new tag.
Corresponding unit test covers ticket with multiple tags now as well.

comment:8 Changed 11 years ago by Steffen Hoffmann

Resolution: fixed
Status: newclosed

In 13815:

TagsPlugin: Completing preparation for v0.7 release.

Availability of that code as stable, tagged release
closes #2429, #3359, #3610, #3624, #3677, #3754, #3864, #3947, #3983, #4078, #4277, #4503, #4799, #5523, #7787, #7857, #8638, #9057, #9058, #9059, #9060, #9061, #9062, #9063, #9149, #9210, #9521, #9630, #9636, #10032, #10416, #10636, #11096, #11147, #11152, #11274, #11302, #11658 and #11659.

Additionally there are some issues and enhancement requests showing progress,
but known to require more work to resolve them satisfactorily, specifically
refs #2804, #4200, #8747 and #9064.

Thanks to all contributors and followers, that enabled and encouraged a good
portion of this development work.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Steffen Hoffmann.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.