Modify ↓
Opened 17 years ago
Closed 15 years ago
#2962 closed defect (duplicate)
Incorrect integer value: '' for column 'default_rate'
Reported by: | Owned by: | Colin Guthrie | |
---|---|---|---|
Priority: | normal | Component: | ClientsPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description
I don't know if this is because I'm using MySQL database or what, but I get this error when adding a client on the admin panel.
Most recent call last: * File "c:\program files\python\lib\site-packages\Trac-0.11dev_r6893-py2.5.egg\trac\web\main.py", line 417, in _dispatch_request Code fragment: 412. try: 413. if not env and env_error: 414. raise HTTPInternalError(env_error) 415. try: 416. dispatcher = RequestDispatcher(env) 417. dispatcher.dispatch(req) 418. except RequestDone: 419. pass 420. resp = req._response or [] 421. 422. 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 0x02FF29F0> e OperationalError(1366, "Incorrect integer value: '' for column ... env <trac.env.Environment object at 0x02B1E150> env_error None exc_info (<class '_mysql_exceptions.OperationalError'>, OperationalError(1366, ... filename 'c:\\program ... frames [{'function': '_dispatch_request', 'lines_before': [u' try:', u' ... has_admin True line u' dispatcher.dispatch(req)' lineno 416 message u'OperationalError: (1366, "Incorrect integer value: \'\' for column ... req <Request "POST u'/admin/ticket/clients'"> resp [] tb <traceback object at 0x0311B148> tb_hide None traceback 'Traceback (most recent call last):\n File "c:\\program ... * File "c:\program files\python\lib\site-packages\Trac-0.11dev_r6893-py2.5.egg\trac\web\main.py", line 197, in dispatch Code fragment: 192. req.args.get('__FORM_TOKEN') != req.form_token: 193. raise HTTPBadRequest('Missing or invalid form token. ' 194. 'Do you have cookies enabled?') 195. 196. # Process the request and render the template 197. resp = chosen_handler.process_request(req) 198. if resp: 199. if len(resp) == 2: # Clearsilver 200. chrome.populate_hdf(req) 201. template, content_type = \ 202. self._post_process_request(req, *resp) Local variables: Name Value chosen_handler <trac.admin.web_ui.AdminModule object at 0x02FF2B30> chrome <trac.web.chrome.Chrome object at 0x02FB2C70> ctype 'application/x-www-form-urlencoded' err (<class '_mysql_exceptions.OperationalError'>, OperationalError(1366, ... handler <trac.admin.web_ui.AdminModule object at 0x02FF2B30> options {} req <Request "POST u'/admin/ticket/clients'"> self <trac.web.main.RequestDispatcher object at 0x02FF29F0> * File "c:\program files\python\lib\site-packages\Trac-0.11dev_r6893-py2.5.egg\trac\admin\web_ui.py", line 109, in process_request Code fragment: 104. if not provider: 105. raise HTTPNotFound(_('Unknown administration panel')) 106. 107. if hasattr(provider, 'render_admin_panel'): 108. template, data = provider.render_admin_panel(req, cat_id, panel_id, 109. path_info) 110. 111. else: # support for legacy WebAdmin panels 112. data = {} 113. cstmpl, ct = provider.process_admin_request(req, cat_id, panel_id, 114. path_info) Local variables: Name Value _panel_order <function _panel_order at 0x03112FB0> cat_id u'ticket' panel_id u'clients' panels [('general', 'General', 'basics', 'Basic Settings'), ('general', ... path_info None provider <clients.admin.ClientAdminPanel object at 0x031172F0> providers {('general', 'basics'): <trac.admin.web_ui.BasicsAdminPanel object at ... req <Request "POST u'/admin/ticket/clients'"> self <trac.admin.web_ui.AdminModule object at 0x02FF2B30> * File "c:\program files\python\lib\site-packages\Trac-0.11dev_r6893-py2.5.egg\trac\ticket\admin.py", line 43, in render_admin_panel Code fragment: 38. 39. def render_admin_panel(self, req, cat, page, version): 40. req.perm.require('TICKET_ADMIN') 41. # Trap AssertionErrors and convert them to TracErrors 42. try: 43. return self._render_admin_panel(req, cat, page, version) 44. except AssertionError, e: 45. raise TracError(e) 46. 47. 48. class ComponentAdminPanel(TicketAdminPanel): Local variables: Name Value cat u'ticket' page u'clients' req <Request "POST u'/admin/ticket/clients'"> self <clients.admin.ClientAdminPanel object at 0x031172F0> version None * File "build\bdist.win32\egg\clients\admin.py", line 47, in _render_admin_panel Local variables: Name Value cat u'ticket' client None clnt <clients.model.Client object at 0x03110E70> page u'clients' req <Request "POST u'/admin/ticket/clients'"> self <clients.admin.ClientAdminPanel object at 0x031172F0> * File "build\bdist.win32\egg\clients\model.py", line 98, in insert Local variables: Name Value cursor <trac.db.util.IterableCursor object at 0x03117090> db <trac.db.pool.PooledConnection object at 0x02FF4CD8> handle_ta True self <clients.model.Client object at 0x03110E70> * File "c:\program files\python\lib\site-packages\Trac-0.11dev_r6893-py2.5.egg\trac\db\util.py", line 50, in execute Code fragment: 45. def execute(self, sql, args=None): 46. # -- In case of SQL errors, uncomment the following 'print' statements 47. # print 'execute', repr(sql) 48. if args: 49. # print repr(args) 50. return self.cursor.execute(sql_escape_percent(sql), args) 51. return self.cursor.execute(sql) 52. 53. def executemany(self, sql, args=None): 54. # print 'executemany', repr(sql) 55. if args: Local variables: Name Value args (u'Client02', None, '', 'never', 1209393065, '', 'never', 1209393065, '', ... self <trac.db.util.IterableCursor object at 0x03117090> sql 'INSERT INTO client (name,description, changes_list, changes_period, ... * File "c:\program files\python\lib\site-packages\Trac-0.11dev_r6893-py2.5.egg\trac\db\util.py", line 50, in execute Code fragment: 45. def execute(self, sql, args=None): 46. # -- In case of SQL errors, uncomment the following 'print' statements 47. # print 'execute', repr(sql) 48. if args: 49. # print repr(args) 50. return self.cursor.execute(sql_escape_percent(sql), args) 51. return self.cursor.execute(sql) 52. 53. def executemany(self, sql, args=None): 54. # print 'executemany', repr(sql) 55. if args: Local variables: Name Value args (u'Client02', None, '', 'never', 1209393065, '', 'never', 1209393065, '', ... self <trac.db.util.IterableCursor object at 0x03110FB0> sql 'INSERT INTO client (name,description, changes_list, changes_period, ... * File "C:\Program Files\Python\lib\site-packages\MySQLdb\cursors.py", line 166, in execute Code fragment: 161. self.errorhandler(self, TypeError, m) 162. except: 163. exc, value, tb = exc_info() 164. del tb 165. self.messages.append((exc, value)) 166. self.errorhandler(self, exc, value) 167. self._executed = query 168. if not self._defer_warnings: self._warning_check() 169. return r 170. 171. def executemany(self, query, args): Local variables: Name Value ListType <type 'list'> TupleType <type 'tuple'> args (u'Client02', None, '', 'never', 1209393065, '', 'never', 1209393065, '', ... charset 'utf8' db <weakproxy at 02EFE390 to Connection at 0300C9B8> exc <class '_mysql_exceptions.OperationalError'> exc_info <built-in function exc_info> query "INSERT INTO client (name,description, changes_list, changes_period, ... self <MySQLdb.cursors.Cursor object at 0x03110EB0> value OperationalError(1366, "Incorrect integer value: '' for column ... * File "C:\Program Files\Python\lib\site-packages\MySQLdb\connections.py", line 35, in defaulterrorhandler Code fragment: 30. cursor.messages.append(error) 31. else: 32. connection.messages.append(error) 33. del cursor 34. del connection 35. raise errorclass, errorvalue 36. 37. 38. class Connection(_mysql.connection): 39. 40. """MySQL Database Connection Object""" Local variables: Name Value error (<class '_mysql_exceptions.OperationalError'>, OperationalError(1366, ... errorclass <class '_mysql_exceptions.OperationalError'> errorvalue OperationalError(1366, "Incorrect integer value: '' for column ... File "c:\program files\python\lib\site-packages\Trac-0.11dev_r6893-py2.5.egg\trac\web\main.py", line 417, in _dispatch_request dispatcher.dispatch(req) File "c:\program files\python\lib\site-packages\Trac-0.11dev_r6893-py2.5.egg\trac\web\main.py", line 197, in dispatch resp = chosen_handler.process_request(req) File "c:\program files\python\lib\site-packages\Trac-0.11dev_r6893-py2.5.egg\trac\admin\web_ui.py", line 109, in process_request path_info) File "c:\program files\python\lib\site-packages\Trac-0.11dev_r6893-py2.5.egg\trac\ticket\admin.py", line 43, in render_admin_panel return self._render_admin_panel(req, cat, page, version) File "build\bdist.win32\egg\clients\admin.py", line 47, in _render_admin_panelFile "build\bdist.win32\egg\clients\model.py", line 98, in insertFile "c:\program files\python\lib\site-packages\Trac-0.11dev_r6893-py2.5.egg\trac\db\util.py", line 50, in execute return self.cursor.execute(sql_escape_percent(sql), args) File "c:\program files\python\lib\site-packages\Trac-0.11dev_r6893-py2.5.egg\trac\db\util.py", line 50, in execute return self.cursor.execute(sql_escape_percent(sql), args) File "C:\Program Files\Python\lib\site-packages\MySQLdb\cursors.py", line 166, in execute self.errorhandler(self, exc, value) File "C:\Program Files\Python\lib\site-packages\MySQLdb\connections.py", line 35, in defaulterrorhandler raise errorclass, errorvalue
I was able to fix it with some small changes. See attached patch.
Attachments (1)
Change History (3)
Changed 17 years ago by
comment:1 Changed 17 years ago by
comment:2 Changed 15 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Jeeze I totally forgot about this ticket. In retrospect tho' I don't want to store 0's in the db to mean "no rate". A 0 rated client may be correct and doesn't mean the same as a client with "no default rate".
I'd rather store a number or null.
Can you comment on #4805 about this?
Note: See
TracTickets for help on using
tickets.
Patch looks harmless and is arguably more correct than my original :)
I'll double check on SQLite later and apply.
Thanks :)