Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#9533 closed defect (fixed)

AttributeError: 'NoneType' object has no attribute 'chrome' in TicketQueryMacro

Reported by: erne.castro@… Owned by: Remy Blank
Priority: normal Milestone: 0.12.1
Component: ticket system Version: 0.12-stable
Severity: major Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Yesterday I switch from trac-trunk (a checkout that i had made shortly after release of trac 0.12, where there was no stable branch yet) to trac 0.12-stable.

Everything is working fine except the TicketQuery macro. I get a AttributeError: 'NoneType' object has no attribute 'chrome' in TicketQueryMacro in the wiki pages where I use it.

The stack dump in the trac.log is this:

2010-07-29 17:48:42,904 Trac[formatter] ERROR: Macro TicketQuery(format=table,milestone=Obsolescencia09&status=closed) failed:
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 710, in _macro_formatter
    return macro.process(args, in_paragraph=True)
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 304, in process
    text = self.processor(text)
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 291, in _macro_processor
    text)
  File "build/bdist.linux-x86_64/egg/trac/ticket/query.py", line 1279, in expand_macro
    data = query.template_data(formatter.context, tickets)
  File "build/bdist.linux-x86_64/egg/trac/ticket/query.py", line 790, in template_data
    'modes': self.get_modes()})
  File "build/bdist.linux-x86_64/egg/trac/web/chrome.py", line 126, in add_script_data
    req.chrome.setdefault('script_data', {}).update(data)
AttributeError: 'NoneType' object has no attribute 'chrome'

What I found is that add_script_data in web/chrome.py fails when called with req=None (the default value) as it is being called in this case.

It tries to use req.chrome without checking either if req is None or not, and does not set req to any value.

I could find anything similar already reported.

Attachments (0)

Change History (5)

comment:1 by Remy Blank, 14 years ago

Milestone: 0.12.1
Owner: set to Remy Blank
Version: 0.12-stable

Oh, I seem to have broken that in [9958].

comment:2 by Christian Boos, 14 years ago

Note that we should start to think about gradually moving the layout template related data from the Request to the rendering Context, to enable proper off-line rendering.

comment:3 by Remy Blank, 14 years ago

Heh, I had to read that four times, and I think I understand now, but could you give me an example, just to be sure?

comment:4 by Remy Blank, 14 years ago

Resolution: fixed
Status: newclosed

Fixed in [9969].

in reply to:  3 comment:5 by Christian Boos, 14 years ago

Replying to rblank:

Heh, I had to read that four times, and I think I understand now, but could you give me an example, just to be sure?

Sorry for the elliptic comment ;-) In my upcoming wikiparser branch, I've implemented trac-admin wiki format <page> [format] ..., for off-line wiki rendering. There, we don't have a Request, yet we have to fake it as it's still needed in a few places, like here now in display_html, for adding the stylesheets in particular.

Query.template_data had a context instance already, so this motivated the comment.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.