Opened 14 months ago

# ValueError: invalid literal for int():

Reported by: Owned by: dannysauer ejucovy normal TracBacksPlugin normal 0.12

### Description

I get the "invalid literal for int" message on line 83 in tracbacks.py when I refer to these three tickets. It says it's failing on ticket 480, but it's worth noting that 481 and 484 have no changes recorded at this point (480 has two changes). None of the three referenced ticket get updated, however, so perhaps the issue actually is with 480.

The Tracbacks version is 0.2dev-r12197 and I'm on Python 2.4.3 (I know, I know).

Here's the debug output from tracbacks.py:

78	change_log = [i for i in t.get_changelog()
79	if i[2] == "comment"]
80	if change_log != []:
81	lastchange = change_log[-1]
82	cnum_lastchange = lastchange[3].rsplit('.', 1)
83	cnum_lastcomment = int(cnum_lastchange[-1])
84	cnum_thischange = str(cnum_lastcomment + 1)
85	else:
86	cnum_thischange = "1"
87	t.save_changes(author, tracback, cnum=cnum_thischange)
88
Local variables:
Name	Value
author 	'me'
change_log 	[(datetime.datetime(2012, 10, 30, 21, 26, 22, 178432, tzinfo=<FixedOffset ...
cnum_lastchange 	['']
comment 	u"It occurs to me that stdout won't work, since there'd be no way to tell ...
i 	(datetime.datetime(2012, 10, 30, 21, 56, 34, 222284, tzinfo=<FixedOffset ...
lastchange 	(datetime.datetime(2012, 10, 30, 21, 56, 34, 222284, tzinfo=<FixedOffset ...
old_values 	{}
pattern 	<_sre.SRE_Pattern object at 0x2aaaafaed620>
self 	<tracbacks.tracbacks.TracBacksPlugin object at 0x2aaab1a8b690>
t 	<trac.ticket.model.Ticket object at 0x2aaab1a8b190>
ticket 	<trac.ticket.model.Ticket object at 0x2aaab1507f50>
ticket_to_tracback 	480
tickets_referenced 	set([480, 481, 484])
tracback 	u'{{{\n#!html\n<div class="tracback"></div>\n}}}\nThis ticket has been ...


And here's the listener call from save_changes:

File "/usr/lib/python2.4/site-packages/Trac-0.12-py2.4.egg/trac/ticket/model.py", line 353, in save_changes
Code fragment:
Line
348	old_values = self._old
349	self._old = {}
350	self.values['changetime'] = when
351
352	for listener in TicketSystem(self.env).change_listeners:
353	listener.ticket_changed(self, comment, author, old_values)
354	return True
355
356	def get_changelog(self, when=None, db=None):
357	"""Return the changelog as a list of tuples of the form
358	(time, author, field, oldvalue, newvalue, permanent).
Local variables:
Name	Value
author 	'me'
cc 	u''
cclist 	[u'']
cnum 	u'2'
comment 	u"It occurs to me that stdout won't work, since there'd be no way to tell ...
db 	None
do_save 	None
listener 	<tracbacks.tracbacks.TracBacksPlugin object at 0x2aaab1a8b690>
old_values 	{}
self 	<trac.ticket.model.Ticket object at 0x2aaab1507f50>
when 	datetime.datetime(2012, 11, 1, 13, 48, 25, 803904, tzinfo=<FixedOffset ...
when_ts 	1351777705803904L


Oh, and here's the (lightly redacted, and with newlines added so the lines aren't offensively long) ticket change information for 480:

sqlite> SELECT * FROM ticket_change WHERE ticket=480;
480|1351632382178432|me|status|new|accepted
480|1351632382178432|me|owner||me
480|1351632382178432|me|blocking||479
480|1351632382178432|me|comment|1|
480|1351634194222284|me|blockedby||483
480|1351634194222284|me|comment||(In #483) If stdout works reasonably, we might
just be able to use /var/cfengine/outputs and not need to do #480 or #484 (but
#481 might still be useful unless I can figure out a better way to rotate log
files - maybe an edit_lines promise that deletes all the lines if the file's
over some size, and keeps a "rotate"-based backup?).


And here's the same for 483, where these are coming from (note that adding the "blockedby" relationship above, using the TracMasterTickets plugin, did create a reference. And I tried to update the comment in 483 to see if that would trigger a backref).

sqlite> SELECT * FROM ticket_change WHERE ticket=483;
483|1351634194222284|me|status|new|accepted
483|1351634194222284|me|owner||me
483|1351634194222284|me|blocking|479|479, 480, 484
483|1351634194222284|me|comment|1|If stdout works reasonably, we might just be able
to use /var/cfengine/outputs and not need to do #480 or #484.  But #481 might
still be useful unless I can figure out a better way to rotate log files - maybe
an edit_lines promise that deletes all the lines if the file's over some size, and
keeps a "rotate"-based backup?  It'd still need compression.
483|1351634194222284|me|_comment0|If stdout works reasonably, we might just be able
to use /var/cfengine/outputs and not need to do #480 or #484 (but #481 might
still be useful unless I can figure out a better way to rotate log files - maybe
an edit_lines promise that deletes all the lines if the file's over some size, and
keeps a "rotate"-based backup?).|1351634521352234
483|1351777705803904|me|comment|2|It occurs to me that stdout won't work, since
there'd be no way to tell if the policy was kept, repaired, or failed.  So we'll
have to use three separate files.  So #480 and #484 aren't off the hook, and we
may as well do #481 at the same time.


### Modify Ticket

Change Properties