Ticket #10532 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months ago

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

Reported by: rj Assigned to: rjollos
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

Change History

10/23/12 21:09:23 changed by anonymous

  • owner set to rjollos.
  • component changed from SELECT A HACK to WorkLogPlugin.

10/23/12 21:11:30 changed by rjollos

  • status changed from new to assigned.
  • priority changed from normal to high.

10/23/12 21:31:27 changed by rjollos

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.

10/23/12 21:32:20 changed by rjollos

  • status changed from assigned to closed.
  • resolution set to fixed.

(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.


Add/Change #10532 (AttributeError: 'int' object has no attribute 'rsplit')




Change Properties
Action