Modify

Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#6305 closed defect (fixed)

AttributeError: 'bool' object has no attribute 'lower'

Reported by: anonymous Owned by: Russ Tyndall
Priority: high Component: TimingAndEstimationPlugin
Severity: blocker Keywords:
Cc: Trac Release: 0.11

Description

after installing the plugin i can't create a new ticket, i get the following error :

Oops… Trac detected an internal error: AttributeError: 'bool' object has no attribute 'lower' This is probably a local installation issue.

Found a bug in Trac? If you think this should work and you can reproduce the problem, you should consider reporting this to the Trac team.

Before you do that, though, please first try searching for similar issues, as it is quite likely that this problem has been reported before. For questions about installation and configuration of Trac, please try the mailing list instead of filing a ticket.

Otherwise, please

How to Reproduce

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

(please provide additional details here)

User Agent was: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

System Information

Trac 0.11.6
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)]
setuptools 0.6c11
SQLite 3.5.9
pysqlite 2.4.1
Genshi 0.6dev-r1092
Subversion 1.6.6 (r40053)
jQuery: 1.2.6

Python Traceback

Traceback (most recent call last):
  File "C:\Python26\lib\site-packages\trac-0.11.6-py2.6-win32.egg\trac\web\main.py", line 450, in _dispatch_request
    dispatcher.dispatch(req)
  File "C:\Python26\lib\site-packages\trac-0.11.6-py2.6-win32.egg\trac\web\main.py", line 227, in dispatch
    data, content_type)
  File "C:\Python26\lib\site-packages\trac-0.11.6-py2.6-win32.egg\trac\web\chrome.py", line 745, in render_template
    stream |= self._filter_stream(req, method, filename, stream, data)
  File "build\bdist.win32\egg\genshi\core.py", line 132, in __or__
    return Stream(_ensure(function(self)), serializer=self.serializer)
  File "C:\Python26\lib\site-packages\trac-0.11.6-py2.6-win32.egg\trac\web\chrome.py", line 848, in inner
    data)
  File "build\bdist.win32\egg\timingandestimationplugin\blackmagic.py", line 123, in filter_stream
    if disabled or istrue(self.config.get(csection, '%s.disable' % field, False)):
  File "build\bdist.win32\egg\timingandestimationplugin\blackmagic.py", line 76, in istrue
    if v.lower() in ('yes', 'true', '1', 'on'):
AttributeError: 'bool' object has no attribute 'lower'

a new ticket at the Trac project site, where you can describe the problem and explain how to reproduce it.

Python Traceback Most recent call last: File "C:\Python26\lib\site-packages\trac-0.11.6-py2.6-win32.egg\trac\web\main.py", line 450, in _dispatch_request Code fragment:

try: if not env and env_error: raise HTTPInternalError(env_error) try: dispatcher = RequestDispatcher(env)

dispatcher.dispatch(req)

except RequestDone: pass resp = req._response or [] except HTTPException, e:

Local variables:

Name Value after [u' except RequestDone:', u' pass', u' resp = ... before [u' try:', u' if not env and env_error:', u' raise ... dispatcher <trac.web.main.RequestDispatcher object at 0x017C96B0> e AttributeError("'bool' object has no attribute 'lower'",) env <trac.env.Environment object at 0x00FDBD90> env_error None exc_info (<type 'exceptions.AttributeError'>, AttributeError("'bool' object has no ... filename 'C:
Python26
lib
site-packages
trac-0.11.6-py2.6-win32.egg
trac
web
... frames [{'function': '_dispatch_request', 'lines_before': [u' try:', u' ... has_admin True line u' dispatcher.dispatch(req)' lineno 449 message u"AttributeError: 'bool' object has no attribute 'lower'" req <Request "GET u'/newticket'"> resp [] tb <traceback object at 0x019B1670> tb_hide None traceback u'Traceback (most recent call last):\n File ...

File "C:\Python26\lib\site-packages\trac-0.11.6-py2.6-win32.egg\trac\web\main.py", line 227, in dispatch Code fragment:

out = StringIO() pprint(data, out) req.send(out.getvalue(), 'text/plain') else: output = chrome.render_template(req, template,

data, content_type)

# Give the session a chance to persist changes req.session.save() req.send(output, content_type or 'text/html') else: self._post_process_request(req)

Local variables:

Name Value chosen_handler <trac.ticket.web_ui.TicketModule object at 0x017C95D0> chrome <trac.web.chrome.Chrome object at 0x01713F30> content_type None data {'dateinfo': <function dateinfo at 0x01B0BEB0>, 'valid': None, 'fields': ... err (<type 'exceptions.AttributeError'>, AttributeError("'bool' object has no ... handler <trac.ticket.web_ui.TicketModule object at 0x017C95D0> req <Request "GET u'/newticket'"> resp ('ticket.html', {'dateinfo': <function dateinfo at 0x01B0BEB0>, 'valid': ... self <trac.web.main.RequestDispatcher object at 0x017C96B0> template 'ticket.html'

File "C:\Python26\lib\site-packages\trac-0.11.6-py2.6-win32.egg\trac\web\chrome.py", line 745, in render_template Code fragment:

stream = template.generate(data) # Filter through ITemplateStreamFilter plugins if self.stream_filters:

stream |= self._filter_stream(req, method, filename, stream, data)

if fragment: return stream if method == 'text':

Local variables:

Name Value content_type 'text/html' data {'abs_url_of': <function get_abs_url at 0x01B0B9F0>, 'all': <built-in ... filename 'ticket.html' fragment False i 0 method 'xhtml' req <Request "GET u'/newticket'"> self <trac.web.chrome.Chrome object at 0x01713F30> stream <genshi.core.Stream object at 0x01B165F0> template <MarkupTemplate "ticket.html"> type_ 'notices'

File "build\bdist.win32\egg\genshi\core.py", line 132, in or Local variables: Name Value function <function inner at 0x01B0BB30> self <genshi.core.Stream object at 0x01B165F0>

File "C:\Python26\lib\site-packages\trac-0.11.6-py2.6-win32.egg\trac\web\chrome.py", line 848, in inner Code fragment:

def _filter_stream(self, req, method, filename, stream, data): def inner(stream, ctxt=None): for filter in self.stream_filters: stream = filter.filter_stream(req, method, filename, stream,

data)

return stream return inner def _stream_location(self, stream): for kind, data, pos in stream:

Local variables:

Name Value ctxt None data {'abs_url_of': <function get_abs_url at 0x01B0B9F0>, 'all': <built-in ... filename 'ticket.html' filter <timingandestimationplugin.blackmagic.TicketTweaks object at 0x01964A50> method 'xhtml' req <Request "GET u'/newticket'"> self <trac.web.chrome.Chrome object at 0x01713F30> stream <genshi.core.Stream object at 0x01B165F0>

File "build\bdist.win32\egg\timingandestimationplugin\blackmagic.py", line 123, in filter_stream Local variables: Name Value data {'abs_url_of': <function get_abs_url at 0x01B0B9F0>, 'all': <built-in ... denial u'hide' disabled False field u'billable' fields [u'billable', u'totalhours', u'hours', u'estimatedhours', u'internal'] filename 'ticket.html' hidden False hide_summary False method 'xhtml' perm u'TIME_VIEW' perms [u'TIME_VIEW:hide', u'TIME_RECORD:disable'] remove False req <Request "GET u'/newticket'"> s u'TIME_RECORD:disable' self <timingandestimationplugin.blackmagic.TicketTweaks object at 0x01964A50> stream <genshi.core.Stream object at 0x01B165F0>

File "build\bdist.win32\egg\timingandestimationplugin\blackmagic.py", line 76, in istrue Local variables: Name Value otherwise None v False

File "C:\Python26\lib\site-packages\trac-0.11.6-py2.6-win32.egg\trac\web\main.py", line 450, in _dispatch_request

dispatcher.dispatch(req)

File "C:\Python26\lib\site-packages\trac-0.11.6-py2.6-win32.egg\trac\web\main.py", line 227, in dispatch

data, content_type)

File "C:\Python26\lib\site-packages\trac-0.11.6-py2.6-win32.egg\trac\web\chrome.py", line 745, in render_template

stream |= self._filter_stream(req, method, filename, stream, data)

File "build\bdist.win32\egg\genshi\core.py", line 132, in orFile "C:\Python26\lib\site-packages\trac-0.11.6-py2.6-win32.egg\trac\web\chrome.py", line 848, in inner

data)

File "build\bdist.win32\egg\timingandestimationplugin\blackmagic.py", line 123, in filter_streamFile "build\bdist.win32\egg\timingandestimationplugin\blackmagic.py", line 76, in istrue

System Information: User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

Trac: 0.11.6 Python: 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] setuptools: 0.6c11 SQLite: 3.5.9 pysqlite: 2.4.1 Genshi: 0.6dev-r1092 Subversion: 1.6.6 (r40053) jQuery: 1.2.6

Attachments (0)

Change History (4)

comment:1 Changed 14 years ago by anonymous

when i set timingandestimationplugin.* = disabled , then i can create a new ticket, when i enable it, it doesn't work anymore, see error above

comment:2 Changed 14 years ago by Russ Tyndall

Resolution: fixed
Status: newclosed

(In [7235]) While I could not reproduce the error on my end, I made the blackmagic istrue function be more robust. This should take care of type errors being experienced. fixes #6305

comment:3 Changed 14 years ago by anonymous

in blackmagic.py , you need to change v.lower() into str(v).lower() !!

comment:4 Changed 14 years ago by Russ Tyndall

...um as best I can tell that is what I did in [7235]. Did that not work in some way?

If you pull a fresh copy you should have a new version with the bug fixed.

Modify Ticket

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