Type Error for ticket remaining_time, newbie problem?

20 views
Skip to first unread message

Pat

unread,
Feb 27, 2009, 1:33:53 PM2/27/09
to suppor...@agile42.com
Hi,
I am getting an error about the remaining time. The field is present
in the ticket so I'm not sure why I am getting this error. It's
probably something extremely simple, but I don't see it. Please
advise. Here is the error dump and the configuration:

Most recent call last:

* File "/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1-
py2.5.egg/trac/web/main.py", line 432, in _dispatch_request
Code fragment:
427. try:
428. if not env and env_error:
429. raise HTTPInternalError(env_error)
430. try:
431. dispatcher = RequestDispatcher(env)
432. dispatcher.dispatch(req)
433. except RequestDone:
434. pass
435. resp = req._response or []
436.
437. 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
0x2a9f37e510>
e TypeError('expected string or buffer',)
env <trac.env.Environment object at 0x2a9b8557d0>
env_error None
exc_info (<type 'exceptions.TypeError'>, TypeError('expected
string or buffer',), ...
filename '/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1-
py2.5.egg/trac/web/ma ...
frames [{'function': '_dispatch_request', 'lines_before': [u'
try:', u' ...
has_admin True
line u' dispatcher.dispatch(req)'
lineno 431
message u'TypeError: expected string or buffer'
req <Request "POST u'/ticket/28'">
resp []
tb <traceback object at 0x2a9b8512d8>
tb_hide None
traceback 'Traceback (most recent call last):\n File ...
* File "/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1-
py2.5.egg/trac/web/main.py", line 204, in dispatch
Code fragment:
199. req.args.get('__FORM_TOKEN') != req.form_token:
200. raise HTTPBadRequest('Missing or invalid form token. '
201. 'Do you have cookies enabled?')
202.
203. # Process the request and render the template
204. resp = chosen_handler.process_request(req)
205. if resp:
206. if len(resp) == 2: # Clearsilver
207. chrome.populate_hdf(req)
208. template, content_type = \
209. self._post_process_request(req, *resp)
Local variables:
Name Value
chosen_handler <agilo.ticket.web_ui.AgiloTicketModule object at
0x2a9f37e5d0>
chrome <trac.web.chrome.Chrome object at 0x2a9f37e310>
ctype 'application/x-www-form-urlencoded'
e TypeError("'NoneType' object is unsubscriptable",)
err (<type 'exceptions.TypeError'>, TypeError('expected string
or buffer',), ...
handler <agilo.ticket.web_ui.AgiloTicketModule object at
0x2a9f37e5d0>
options {}
req <Request "POST u'/ticket/28'">
self <trac.web.main.RequestDispatcher object at 0x2a9f37e510>
* File "/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1-
py2.5.egg/trac/ticket/web_ui.py", line 181, in process_request
Code fragment:
176.
177. def process_request(self, req):
178. if 'id' in req.args:
179. if req.path_info == '/newticket':
180. raise TracError(_("id can't be set for a new ticket
request."))
181. return self._process_ticket_request(req)
182. return self._process_newticket_request(req)
183.
184. # ITemplateProvider methods
185.
186. def get_htdocs_dirs(self):
Local variables:
Name Value
req <Request "POST u'/ticket/28'">
self <agilo.ticket.web_ui.AgiloTicketModule object at
0x2a9f37e5d0>
* File "/usr/local/lib/python2.5/site-packages/
agilo-0.7.3.0_r1228_20090121-py2.5.egg/agilo/ticket/web_ui.py", line
200, in _process_ticket_request
Code fragment:
195. # sending it to trac
196. self._do_delete(req)
197. # Process the Ticket the TRAC way
198. template = data = content_type = None
199. try:
200. template, data, content_type = super(AgiloTicketModule,
self)._process_ticket_request(req)
201. except RuleValidationException, e:
202. raise TracError(str(e))
203.
204. if template in ('diff_view.html', 'history_view.html'):
205. # We don't care about these pages, just display them
Local variables:
Name Value
content_type None
data None
req <Request "POST u'/ticket/28'">
self <agilo.ticket.web_ui.AgiloTicketModule object at
0x2a9f37e5d0>
template None
* File "/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1-
py2.5.egg/trac/ticket/web_ui.py", line 507, in _process_ticket_request
Code fragment:
502. # things.
503. valid = self._validate_ticket(req, ticket) and not
problems
504. if 'preview' not in req.args:
505. if valid:
506. # redirected if successful
507. self._do_save(req, ticket, action)
508. # else fall through in a preview
509. req.args['preview'] = True
510.
511. # Preview an existing ticket (after a Preview or a failed
Save)
512. data.update({
Local variables:
Name Value
action u'accept'
actions ['assign', 'accept', 'requestinfo_new', 'leave',
'close_new']
data {'comment': None, 'preserve_newlines': True, 'ticket': ...
field_changes {'status': {'new': u'accepted', 'old': u'new',
'by': ...
id 28
problems []
req <Request "POST u'/ticket/28'">
self <agilo.ticket.web_ui.AgiloTicketModule object at
0x2a9f37e5d0>
ticket <agilo.ticket.model.AgiloTicket object at 0x2a9f37e2d0>
valid True
version None
* File "/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1-
py2.5.egg/trac/ticket/web_ui.py", line 1005, in _do_save
Code fragment:
1000. # -- Save changes
1001.
1002. now = datetime.now(utc)
1003. if ticket.save_changes(get_reporter_id(req, 'author'),
1004. req.args.get('comment'), when=now,
1005. cnum=internal_cnum):
1006. try:
1007. tn = TicketNotifyEmail(self.env)
1008. tn.notify(ticket, newticket=False, modtime=now)
1009. except Exception, e:
1010. self.log.exception("Failure sending notification on change
to "
Local variables:
Name Value
action u'accept'
cnum u'1'
controllers
[<trac.ticket.default_workflow.ConfigurableTicketWorkflow object
at ...
internal_cnum u'1'
now datetime.datetime(2009, 2, 27, 18, 21, 16, 372181,
tzinfo=<FixedOffset ...
replyto u''
req <Request "POST u'/ticket/28'">
self <agilo.ticket.web_ui.AgiloTicketModule object at
0x2a9f37e5d0>
ticket <agilo.ticket.model.AgiloTicket object at 0x2a9f37e2d0>
* File "/usr/local/lib/python2.5/site-packages/
agilo-0.7.3.0_r1228_20090121-py2.5.egg/agilo/ticket/model.py", line
643, in save_changes
Code fragment:
638. """
639. if not AgiloConfig(self.env).is_agilo_enabled:
640. return super(AgiloTicket, self).save_changes(author,
comment,
641. when=when, db=db, cnum=cnum)
642. debug(self, "Called save_changes(%s, %s)..." % (author,
comment))
643. self._check_business_rules()
644. debug(self, "Saving ticket changes (%s, %s, %s, %s, %s)" %
\
645. (author, comment, when, db, cnum))
646. res = super(AgiloTicket, self).save_changes(author,
comment, when, db, cnum)
647. return res
648.
Local variables:
Name Value
author u'hawlepa1'
cnum u'1'
comment u''
db None
self <agilo.ticket.model.AgiloTicket object at 0x2a9f37e2d0>
when datetime.datetime(2009, 2, 27, 18, 21, 16, 372181,
tzinfo=<FixedOffset ...
* File "/usr/local/lib/python2.5/site-packages/
agilo-0.7.3.0_r1228_20090121-py2.5.egg/agilo/ticket/model.py", line
630, in _check_business_rules
Code fragment:
625.
626. def _check_business_rules(self):
627. """Checks if this ticket validates against business rules
defined"""
628. # Validate business rules
629. from agilo.workflow.api import RuleEngine
630. RuleEngine(self.env).validate_rules(self)
631.
632. # OVERRIDE
633. def save_changes(self, author, comment, when=None,
db=None, cnum=''):
634. """
635. Store ticket changes in the database. The ticket must
already exist in
Local variables:
Name Value
RuleEngine <class 'agilo.workflow.api.RuleEngine'>
self <agilo.ticket.model.AgiloTicket object at 0x2a9f37e2d0>
* File "/usr/local/lib/python2.5/site-packages/
agilo-0.7.3.0_r1228_20090121-py2.5.egg/agilo/workflow/api.py", line
63, in validate_rules
Code fragment:
58. will be validated and has to take care of all the checks,
return True
59. or False
60. """
61. debug(self, "Called validate_rules(%s)" % ticket)
62. for r in self.rules:
63. r.validate(ticket)
64.
Local variables:
Name Value
r <agilo.workflow.rules.CleanLettersFromRemainingTimeRule
object at ...
self <agilo.workflow.api.RuleEngine object at 0x2a9f1df450>
ticket <agilo.ticket.model.AgiloTicket object at 0x2a9f37e2d0>
* File "/usr/local/lib/python2.5/site-packages/
agilo-0.7.3.0_r1228_20090121-py2.5.egg/agilo/workflow/rules.py", line
180, in validate
Code fragment:
175. """Accept only tickets with remaining time field"""
176. debug(self, "Called validate(%s)..." % ticket)
177. if ticket is not None and isinstance(ticket, AgiloTicket)
and \
178. ticket.is_writeable_field(Key.REMAINING_TIME):
179. remaining_time = ticket[Key.REMAINING_TIME] or ''
180. match = self.extract_numbers_regex.match(remaining_time)
181. if match != None:
182. time_as_number = match.group(1)
183. ticket[Key.REMAINING_TIME] = time_as_number
184. else:
185. ticket[Key.REMAINING_TIME] = None
Local variables:
Name Value
remaining_time 3.0
self <agilo.workflow.rules.CleanLettersFromRemainingTimeRule
object at ...
ticket <agilo.ticket.model.AgiloTicket object at 0x2a9f37e2d0>

File "/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1-py2.5.egg/
trac/web/main.py", line 432, in _dispatch_request
dispatcher.dispatch(req)
File "/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1-py2.5.egg/
trac/web/main.py", line 204, in dispatch
resp = chosen_handler.process_request(req)
File "/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1-py2.5.egg/
trac/ticket/web_ui.py", line 181, in process_request
return self._process_ticket_request(req)
File "/usr/local/lib/python2.5/site-packages/
agilo-0.7.3.0_r1228_20090121-py2.5.egg/agilo/ticket/web_ui.py", line
200, in _process_ticket_request
template, data, content_type = super(AgiloTicketModule,
self)._process_ticket_request(req)
File "/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1-py2.5.egg/
trac/ticket/web_ui.py", line 507, in _process_ticket_request
self._do_save(req, ticket, action)
File "/usr/local/lib/python2.5/site-packages/Trac-0.11.2.1-py2.5.egg/
trac/ticket/web_ui.py", line 1005, in _do_save
cnum=internal_cnum):
File "/usr/local/lib/python2.5/site-packages/
agilo-0.7.3.0_r1228_20090121-py2.5.egg/agilo/ticket/model.py", line
643, in save_changes
self._check_business_rules()
File "/usr/local/lib/python2.5/site-packages/
agilo-0.7.3.0_r1228_20090121-py2.5.egg/agilo/ticket/model.py", line
630, in _check_business_rules
RuleEngine(self.env).validate_rules(self)
File "/usr/local/lib/python2.5/site-packages/
agilo-0.7.3.0_r1228_20090121-py2.5.egg/agilo/workflow/api.py", line
63, in validate_rules
r.validate(ticket)
File "/usr/local/lib/python2.5/site-packages/
agilo-0.7.3.0_r1228_20090121-py2.5.egg/agilo/workflow/rules.py", line
180, in validate
match = self.extract_numbers_regex.match(remaining_time)

System Information:

User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:
1.9.0.6) Gecko/2009011913 Firefox/3.0.6
Trac: 0.11.2.1
Python: 2.5.4 (r254:67916, Feb 2 2009, 13:16:38) [GCC 3.3.3 (SuSE
Linux)]
setuptools: 0.6c9
SQLite: 3.6.5
pysqlite: 2.3.2
Genshi: 0.5.1
mod_python: 3.3.1
Pygments: 1.0
Subversion: 1.5.4 (r33841)
jQuery: 1.2.6

Any suggestions on this are appreciated.
Pat

Felix Schwarz

unread,
Mar 2, 2009, 7:15:43 AM3/2/09
to suppor...@agile42.com

This looks strange. Which value did you entered for the remaining time?
'3.0'?

Can you please switch to the plain text view when you see the exception
and copy that? This is much more readable for us.

fs

Pat

unread,
Mar 2, 2009, 2:08:43 PM3/2/09
to suppor...@agile42.com
I think I found my problem.
I have tried setting up a hierarchy with

requirement -> epic -> story -> task

where task has a text field for remaining time,
story has a text field for remaining time but I was trying to use
remaining_time = sum:get_outgoing:remaining_time
epic has a text field for remaining time with remaining_time =
sum:get_outgoing:remaining_time
requirement has a text field for remaining time with remaining_time =
sum:get_outgoing:remaining_time

so that the time for a given level in the hierarchy would accumulate
at each level, but the calculated values are not strings so I get an
error message.

If I change the calculated values to total_remaining_time, then the
error goes away, but I can't get the totals at the top of the
hierarchy.

Is there a way to make this work?

Pat

Reply all
Reply to author
Forward
0 new messages