Modify

Opened 12 years ago

Closed 12 years ago

#10532 closed defect (fixed)

AttributeError: 'int' object has no attribute 'rsplit'

Reported by: rj Owned by: Ryan J Ollos
Priority: high Component: WorkLogPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

How to Reproduce

While doing a POST operation on /worklog, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'__FORM_TOKEN': u'2d35bd78fde6b4d47b032412',
 'source_url': u'/trac/pmdoc/ticket/51',
 'startwork': u'Start Work',
 'ticket': u'51'}

User agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.13 (KHTML, like Gecko) Chrome/24.0.1284.2 Safari/537.13

System Information

Trac 1.0
Babel 0.9.6
CustomFieldAdmin 0.2.6-r10460
Docutils 0.9.1
Genshi 0.6 (without speedups)
mod_python 3.3.1
Pygments 1.5
pysqlite 2.6.3
Python 2.7.3 (default, Oct 13 2012, 03:49:29)
[GCC 4.5.3]
pytz 2012f
setuptools 0.6
SQLite 3.7.14.1
Subversion 1.6.17 (r1128011)
jQuery 1.7.2

Enabled Plugins

ContextMenuPlugin 0.2dev-r12127
ExcelDownloadPlugin 0.12.0.1
FootNoteMacro 1.03-r11767
graphviz 0.7.6dev-r11464
RedirectsPlugin 0.1
SvnAuthzAdminPlugin 0.2
timingandestimationplugin 1.2.8
TracAccountManager 0.4dev-r12139
TracCollapsiblePlugin 0.1
TracCustomFieldAdmin 0.2.6-r10460
TracDateField 1.0.2-r10435
TracDiscussion 0.8
TracIncludeMacro 3.0.0dev-r12030
TracMasterTickets 3.0.2
TracMetrixPlugin 0.1.8dev-r12198
TracStats 0.5
TracTags 0.7dev-r12165
TracTicketChangelogPlugin 0.1
TracTocMacro 11.0.0.3
TracWorkflowAdmin 0.12.0.1
worklog 0.3dev-r12090

Python Traceback

Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 214, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib64/python2.7/site-packages/worklog-0.3dev_r12090-py2.7.egg/worklog/webui.py", line 126, in process_request
    if not mgr.start_work(req.args['ticket']):
  File "/usr/lib64/python2.7/site-packages/worklog-0.3dev_r12090-py2.7.egg/worklog/manager.py", line 135, in start_work
    self.save_ticket(tckt, 'Automatically accepting in order to start work.')
  File "/usr/lib64/python2.7/site-packages/worklog-0.3dev_r12090-py2.7.egg/worklog/manager.py", line 81, in save_ticket
    tckt.save_changes(self.authname, msg, nowdt, cnum=cnum+1)
  File "/usr/lib64/python2.7/site-packages/trac/ticket/model.py", line 364, in save_changes
    return int(cnum.rsplit('.', 1)[-1])
AttributeError: 'int' object has no attribute 'rsplit'

Attachments (0)

Change History (4)

comment:1 Changed 12 years ago by anonymous

Component: SELECT A HACKWorkLogPlugin
Owner: changed from anonymous to Ryan J Ollos

comment:2 Changed 12 years ago by Ryan J Ollos

Priority: normalhigh
Status: newassigned

comment:3 Changed 12 years ago by Ryan J Ollos

cnum is being passed to Ticket.save_changes as an int, but it should be a str. It looks like this wouldn't have caused problems in Trac 0.11 or Trac 0.12 since there were no manipulations on the object that would result in an error. In fact, the post-commit-hook in Trac 0.11 also passed cnum as an int.

In the back of my mind I'm wondering if passing an int to some databases other than SQLite when a str is expected might cause some problems. If that was the case I would have expected the post-commit-hook in Trac to have been modified to pass cnum as a str by Trac 0.11.7, but it was not.

comment:4 Changed 12 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

(In [12245]) Fixes #10532: Pass cnum to Ticket.save_changes as a string, which is what the method expect. This didn't cause a problem until Trac 1.0, however. Thanks to rj for the report.

Modify Ticket

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