Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #760 (closed defect: fixed)

Opened 11 years ago

Last modified 8 years ago

Exception in Catwalk when setting optional DecimalCol fields to None

Reported by: anonymous Owned by: chrisz
Priority: normal Milestone: 1.0.x bugfix
Component: Toolbox.Catwalk Version: 1.0
Severity: normal Keywords: needs patch, catwalk, decimal
Cc:

Description

I believe there is a bug with using Catwalk to set field values to "NULL" or None. On the other hand, it appears to "read" or show None fields properly. I've only checked this for DecimalCol? value fields. BTW< I'm currently running TG 0.9a2

Change History

comment:1 Changed 11 years ago by jorge.vargas

  • Milestone set to 1.0b3

please provide a working copy of the problem if it still exists.

comment:2 Changed 10 years ago by alberto

  • Milestone changed from 1.0b3 to 1.1

comment:3 Changed 10 years ago by jorge.vargas

  • Component changed from Toolbox to Toolbox.Catwalk

comment:4 Changed 10 years ago by alberto

  • Milestone changed from 1.1 to __unclassified__

Batch moved into unclassified from 1.1 to properly track progress on the later

comment:5 Changed 10 years ago by yvesjmt

  • Version changed from 0.9a2 to 1.0

I'd like to re-open this bug. I'm using a mix of the latest turbogears and 1.0 versions and I can confirm this bug. I'm not sure if this was fixed or not. If so, sorry for the trouble.

It's a bug in the javascript file. This patch works for me.

--- /tmp/catwalk.js     2007-08-22 18:31:51.000000000 -0300
+++ /usr/share/python-support/python-turbogears/turbogears/toolbox/catwalk/static/javascript/catwalk.js 2007-08-22 18:32:48.000000000 -0300
@@ -514,6 +514,9 @@
     case 'SOIntCol':
       columnValue = catwalk.renderNumericCol(column,'int');
       break;
+    case 'SODecimalCol':
+      columnValue = catwalk.renderNumericCol(column,'float');
+      break;
     case 'SOFloatCol':
       columnValue = catwalk.renderNumericCol(column,'float');
       break;

Thanks.

comment:6 Changed 8 years ago by jorge.vargas

  • Milestone changed from __unclassified__ to 1.x

comment:7 Changed 8 years ago by Chris Arndt

  • Owner changed from anonymous to Chris Arndt
  • Keywords needs confirmation, needs review added
  • Milestone changed from 1.x to 1.0.x bugfix

comment:8 Changed 8 years ago by Chris Arndt

  • Keywords patch, catwalk, decimal added; confirmation, review removed

I can confirm that this is still a problem in TG 1.1rc1 and TG 1.0 SVN r6685 but the fix given in the comment above does not fix the issue, it only adds support to display decimal columns properly.

The cause of the the problem is in toolbox.catwalk.CatWalk.extract_decimal_value, which only catches ValueError when trying to convert the request param into a Decimal object. It should also catch TypeError and decimal.InvalidOperation. Also the extract_parameters does not seem to check if a column has notNone set to False, so fixing extract_decimal_value would set empty decimal fields to Decimal(0.0).

comment:9 Changed 8 years ago by Chris Arndt

  • Summary changed from Problems using Catwalk to set fields to NULL (or None) to Exception in Catwalk when setting optional DecimalCol fields to None

I applied the fix in comment 5 and the above mentioned fix to toolbox.catwalk.CatWalk.extract_decimal_value in r6689 to all 1.x branches.

We still need to fix extract_parameters to check for optional fields.

comment:10 Changed 8 years ago by Chris Arndt

  • Owner changed from Chris Arndt to chrisz

comment:11 Changed 8 years ago by chrisz

  • Status changed from new to closed
  • Resolution set to fixed

There were actually three problems:

  • extract_parameters did not check for optional fields, as mentioned above,
  • the Javascript validator for numeric fields did not allow null values,
  • null values were rendered as "None" instead of empty fields.

Fixed all three in r6800 for all 1.x branches.

Note: See TracTickets for help on using tickets.