Modify

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#6764 closed defect (fixed)

AttributeError: qry_args = Internal error when following "For version" link

Reported by: Lucas Rangit MAGASWERAN Owned by: Malcolm Studd
Priority: normal Component: ExtendedVersionPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

How to Reproduce

While doing a GET operation on /version/1.0, Trac issued an internal error.

After installing, restarting apache, updating trac database, I edit a milestone to assign it to a version. I then click the link in "For version:" next to the due date and get the error below.

AttributeError: qry_args

Request parameters:

{'id': u'1.0'}

User Agent was: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.307.9 Safari/532.9

System Information

Trac 0.11.5
Python 2.6.4 (r264:75706, Dec 7 2009, 18:59:58)
[GCC 4.4.1]
setuptools 0.6c9
SQLite 3.6.16
pysqlite 2.5.5
Genshi 0.5.1
mod_python 3.3.1
Pygments 1.0
Subversion 1.6.6 (r40053)
jQuery: 1.3.2

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 444, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 205, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python2.6/dist-packages/ExtendedVersionTracPlugin-0.0-py2.6.egg/extendedversion/version.py", line 124, in process_request
    return self._render_view(req, db, version)
  File "/usr/local/lib/python2.6/dist-packages/ExtendedVersionTracPlugin-0.0-py2.6.egg/extendedversion/version.py", line 288, in _render_view
    milestone_stats.append(milestone_stats_data(self.env, req, stat, milestone.name))
  File "/usr/lib/python2.6/dist-packages/trac/ticket/roadmap.py", line 287, in milestone_stats_data
    'stats_href': query_href(stat.qry_args),
  File "/usr/lib/python2.6/dist-packages/trac/web/api.py", line 198, in __getattr__
    raise AttributeError(name)
AttributeError: qry_args

Attachments (2)

debug-qry_args.diff (945 bytes) - added by Malcolm Studd 14 years ago.
Add debug output to try to find source of qry_args crash
version.py.patch (611 bytes) - added by abekkine@… 14 years ago.

Download all attachments as: .zip

Change History (18)

comment:1 Changed 14 years ago by anonymous

I also notice now that even though I only assigned a version to a single milestone, when I view the roadmap, all milestones appear assigned to version 1. When I attempt to change them, they do not have a version assigned (nothing showed on the edit milestone page). Even after I assign them all it gives me the same error. I tried creating a new milestone and assigned it to a new version number but even that does not work and resulted in the identical error.

comment:2 Changed 14 years ago by anonymous

Also, the same error is produced when I follow the version link (e.g. http://server/trac_project/version/1.0).

comment:3 in reply to:  2 Changed 14 years ago by anonymous

Replying to anonymous:

Also, the same error is produced when I follow the version link (e.g. http://server/trac_project/version/1.0).

This only happens to versions that have been assigned to a milestone.

comment:4 in reply to:  1 Changed 14 years ago by Malcolm Studd

Status: newassigned

Replying to anonymous:

I also notice now that even though I only assigned a version to a single milestone, when I view the roadmap, all milestones appear assigned to version 1.

OK, I've reproduced this, so I should be able to fix it soon.

As for the AttributeError: qry_args error, I'm stumped. You're the second person to hit it, but I can't reproduce it at all. I tried several things, but it always works for me. What kind of tickets are assigned to the milestone?

comment:5 Changed 14 years ago by Lucas Rangit MAGASWERAN

Any luck?

comment:6 Changed 14 years ago by Malcolm Studd

OK, I figured out the part I could reproduce. Turns out Genshi doesn't like the 'li[@class="milestone"]/div/h2/a/em' XPath selector. Taking out the [1] makes it work again. I must have had genshi from trunk post 0.5 on my previous install.

A nice side effect was that I managed to simplify the code and I actually understand what it's doing now. Always a nice thing ;-)

r7775 should fix the incorrect version display.

comment:7 Changed 14 years ago by Malcolm Studd

er, the selector was 'li[@class="milestone"]/div/h2[1]/a/em'

Changed 14 years ago by Malcolm Studd

Attachment: debug-qry_args.diff added

Add debug output to try to find source of qry_args crash

comment:8 Changed 14 years ago by Malcolm Studd

Could you apply the attached patch, run tracd, and report the output? Apply in the top-level of the plugin source with patch -p0 < debug-qry_args.diff

The output should look something like

[root@quasar ~]# tracd -p8080 /srv/trac
Serving on 0.0.0.0:8080 view at http://127.0.0.1:8080/
127.0.0.1 - - [12/Mar/2010 20:00:08] "GET /wildcat/roadmap HTTP/1.1" 200 -
127.0.0.1 - - [12/Mar/2010 20:00:08] "GET /wildcat/chrome/common/css/trac.css HTTP/1.1" 304 -
127.0.0.1 - - [12/Mar/2010 20:00:08] "GET /wildcat/chrome/common/css/roadmap.css HTTP/1.1" 304 -
127.0.0.1 - - [12/Mar/2010 20:00:08] "GET /wildcat/chrome/common/trac_logo_mini.png HTTP/1.1" 304 -
127.0.0.1 - - [12/Mar/2010 20:00:08] "GET /wildcat/chrome/common/trac_banner.png HTTP/1.1" 304 -
127.0.0.1 - - [12/Mar/2010 20:00:08] "GET /wildcat/chrome/common/topbar_gradient.png HTTP/1.1" 304 -
127.0.0.1 - - [12/Mar/2010 20:00:08] "GET /wildcat/chrome/common/dots.gif HTTP/1.1" 304 -
127.0.0.1 - - [12/Mar/2010 20:00:08] "GET /wildcat/chrome/common/topbar_gradient2.png HTTP/1.1" 304 -
127.0.0.1 - - [12/Mar/2010 20:00:08] "GET /wildcat/chrome/common/ics.png HTTP/1.1" 304 -
<trac.ticket.roadmap.TicketGroupStats object at 0x7fa3747575d0>
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'add_interval', 'count', 'done_count', 'done_percent', 'intervals', 'qry_args', 'refresh_calcs', 'title', 'unit']

Those last two line are what I'm interested in.

comment:9 Changed 14 years ago by Lucas Rangit MAGASWERAN

I'm just letting you know that I'll be getting to this either tonight or tomorrow. Just a quick question though, does it matter if I run Trac through Apache instead of as a daemon? I'm thinking that the debug output will be in the Apache logs.

comment:10 Changed 14 years ago by Malcolm Studd

I don't know. I haven't run trac in mod_python recently, and never with any of the other Apache methods.

comment:11 Changed 14 years ago by anonymous

This is my output for your patch.

<trac.ticket.roadmap.TicketGroupStats object at 0xb263f0c>
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'add_interval', 'count', 'done_count', 'done_percent', 'intervals', 'qry_args', 'refresh_calcs', 'title', 'unit']

comment:12 Changed 14 years ago by abekkine@…

What should i do to see the contents of qry_args field?

Changed 14 years ago by abekkine@…

Attachment: version.py.patch added

comment:13 Changed 14 years ago by abekkine@…

It works for me, with the change shown in the attached patch file.

comment:14 Changed 14 years ago by Malcolm Studd

http://trac.edgewall.org/changeset/8625/branches/0.11-stable/trac/ticket/roadmap.py

This commit adds the env to milestone_stats_data. Your Trac is obviously prior to than commit, and mine is after. I guess milestone_stats_data is not stable/public API. I can fix this tonight, I just need to decide the best way.

comment:15 Changed 14 years ago by Malcolm Studd

Resolution: fixed
Status: assignedclosed

(In [7780]) Fix #6764 by copying milestone_stats_data from Trac. The method changed during the 0.11 branch.

comment:16 Changed 14 years ago by Lucas Rangit MAGASWERAN

I just got around to trying your latest fix. I performed a sudo easy_install --upgrade http://trac-hacks.org/svn/extendedversionplugin/0.11 and attempted to assign versions to milestones. 1) assigning a milestone to a version does not affect other milestones when viewed on the roadmap. 2) clicking the version goes to the version page that shows the assigned milestones progress bars are not the qyr_args internal error message.

Nice work!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Malcolm Studd.
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.