Edgewall Software

Ticket #7800 (new defect)

Opened 2 months ago

Last modified 2 months ago

Sorting by age broken in browser view

Reported by: chub@… Owned by: rblank
Priority: high Milestone: 0.11.3
Component: version control/browser Version: 0.11-stable
Severity: normal Keywords: age date order
Cc:

Description (last modified by rblank) (diff)

The key to sort the browser view is "age" not "date".

Patch is inlined. =)

  • trac/versioncontrol/templates/browser.html

    old new  
    8080              ${sortable_th(dir.order, dir.desc, 'name', 'Name')} 
    8181              ${sortable_th(dir.order, dir.desc, 'size', 'Size')} 
    8282              <th class="rev">Rev</th> 
    83               ${sortable_th(dir.order, dir.desc, 'date', 'Age')} 
     83              ${sortable_th(dir.order, dir.desc, 'age', 'Age')} 
    8484              <th class="change">Last Change</th> 
    8585            </tr> 
    8686          </thead> 

Attachments

Change History

follow-up: ↓ 2   Changed 2 months ago by rblank

  • keywords needinfo added; browser versioncontrol removed
  • description modified (diff)
  • milestone 0.11.2 deleted

Sorry, no more tickets for 0.11.2.

I quickly tested on trunk, and the sorting by age seems to work ok. But if I apply your patch, the sorting is messed up.

Could you describe more precisely what problem you observe and how to reproduce it? Also, what Trac version are you using (set the Version field)?

in reply to: ↑ 1   Changed 2 months ago by anonymous

Version 0.11.1 installed, I believe, using a CentOS package.

The problem happens when we try viewing a branch that we merge to sorted by age, though there are a dozen other branches that we can load using the same trac (and of course in the svn repository) that don't exhibit problems when we sort by age.

Here's the trace (and the patch probably didn't alleviate the problem, I apologize):

AttributeError?: 'dict' object has no attribute 'date' File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 423, in _dispatch_request

dispatcher.dispatch(req)

File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 197, in dispatch

resp = chosen_handler.process_request(req)

File "/usr/lib/python2.4/site-packages/trac/versioncontrol/web_ui/browser.py", line 359, in process_request

node.get_properties()),

File "/usr/lib/python2.4/site-packages/trac/versioncontrol/web_ui/browser.py", line 447, in _render_dir

entries = sorted(entries, key=browse_order, reverse=desc)

File "/usr/lib/python2.4/site-packages/trac/versioncontrol/web_ui/browser.py", line 446, in browse_order

return a.isdir and dir_order or 0, file_order(a)

File "/usr/lib/python2.4/site-packages/trac/versioncontrol/web_ui/browser.py", line 434, in file_order

return changes[a.rev].date

Trac: 0.11.1 Python: 2.4.3 (#1, May 24 2008, 13:57:05) [GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] setuptools: 0.6c5 SQLite: 3.3.6 pysqlite: 1.1.7 Genshi: 0.5.1 mod_python: 3.2.8 Subversion: 1.5.3 (r33570) jQuery: 1.2.6

Thanks!

  Changed 2 months ago by rblank

  • keywords needinfo removed
  • owner set to rblank
  • milestone set to 0.11.3

Ok, that helps a lot more. I suspect the line:

return changes[a.rev].date

should actually be:

return changes[a.rev]["date"]

I'll put this on my to-do.

  Changed 2 months ago by cboos

  • priority changed from normal to high
  • version changed from none to 0.11-stable

It looks like a duplicate of #6143.

I think it's the changeset = repos.get_changeset(rev) line which fails for some reason, and then the fallback value ({}) leads to the problem shown above (and to the one seen in #6143). We should:

  • log the error
  • provide a safer fallback

Add/Change #7800 (Sorting by age broken in browser view)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from rblank. Next status will be 'new'
The owner will change from rblank to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.