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 #318 (closed defect: worksforme)

Opened 13 years ago

Last modified 10 years ago

Catwalk doesn't accept "None" in DateTime columns

Reported by: Michela Ledwidge <michela@…> Owned by: anonymous
Priority: normal Milestone: 1.x
Component: Toolbox.Catwalk Version:
Severity: normal Keywords: catwalk datetime
Cc:

Description

CatWalk's groovy datetime selector doesn't allow "None" as valid input so records with optional date fields can't be entered.

ModelDesigner? created this class Mod(SQLObject):

insertdate = DateTimeCol?(default="None",notNone=False)

Saving in CatWalk triggered this

File "/Library/Frameworks/Python?.framework/Versions/2.4/lib/python2.4/site-packages/TurboGears-0.9a0dev_r429-py2.4.egg/turbogears/toolbox/catwalk/init.py", line 60, in parse_datetime

raise ValueError?, 'invalid date string format'

ValueError?: invalid date string format

Attachments

catwalk.patch Download (450 bytes) - added by alberto@… 13 years ago.
This patch fixes it

Change History

Changed 13 years ago by alberto@…

This patch fixes it

comment:1 Changed 13 years ago by anonymous

  • Summary changed from Catwalk doesn't accept "None" in DateTime columns to [PATCH] Catwalk doesn't accept "None" in DateTime columns

comment:2 Changed 13 years ago by ronald@…

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

Thanks Alberto, there where actually two problem:

first ModelDesigner? was adding quotes around the default="None" value.

That will never work because DateTimeCol? won't accept the string 'None' as the default. The other problem was as you pointed with CatWalk's way to deal with the empty datetime field.

comment:3 Changed 13 years ago by anonymous

  • Status changed from closed to reopened
  • Resolution fixed deleted

Catwalk (SVN 601) won't properly save a record if you leave a DateCol? blank. It passes an empty string to sqlobject, which then bails (trace below).

Also, no indication of error is presented to the user.

30/Jan/2006:16:09:32 HTTP INFO Page handler: <bound method CatWalk.add of <turbogears.toolbox.catwalk.CatWalk instance at 0x15ac558>> Traceback (most recent call last):

File "/sw/lib/python2.4/site-packages/CherryPy-2.2.0beta-py2.4.egg/cherrypy/_cphttptools.py", line 99, in _run

self.main()

File "/sw/lib/python2.4/site-packages/CherryPy-2.2.0beta-py2.4.egg/cherrypy/_cphttptools.py", line 247, in main

body = page_handler(*virtual_path, self.params)

File "/sw/lib/python2.4/site-packages/TurboGears-0.9a0dev_r601-py2.4.egg/turbogears/controllers.py", line 241, in newfunc

html, fragment, *args, kw)

File "/sw/lib/python2.4/site-packages/TurboGears-0.9a0dev_r601-py2.4.egg/turbogears/database.py", line 189, in run_with_transaction

retval = func(*args, kw)

File "/sw/lib/python2.4/site-packages/TurboGears-0.9a0dev_r601-py2.4.egg/turbogears/controllers.py", line 258, in _execute_func

output = func(self, *args, kw)

File "/sw/lib/python2.4/site-packages/TurboGears-0.9a0dev_r601-py2.4.egg/turbogears/toolbox/catwalk/init.py", line 784, in add

new_object = obj(params)

File "/sw/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1534-py2.4.egg/sqlobject/main.py", line 1197, in init

self._create(id, kw)

File "/sw/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1534-py2.4.egg/sqlobject/main.py", line 1221, in _create

self.set(kw)

File "/sw/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1534-py2.4.egg/sqlobject/main.py", line 1080, in set

kw[name] = dbValue = from_python(value, self._SO_validatorState)

File "/sw/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1534-py2.4.egg/sqlobject/col.py", line 1021, in to_python

value = super(DateValidator?, self).to_python(value, state)

File "/sw/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1534-py2.4.egg/sqlobject/col.py", line 917, in to_python

(self.format, self.name, type(value), value), value, state)

Invalid: expected an date/time string of the '%Y-%m-%d' format in the DateTimeCol? 'startDate', got <type 'str'> instead

comment:4 Changed 13 years ago by jorge.vargas

  • Summary changed from [PATCH] Catwalk doesn't accept "None" in DateTime columns to Catwalk doesn't accept "None" in DateTime columns
  • Component changed from Toolbox to Toolbox.Catwalk
  • Milestone changed from 0.9 to 1.0

someone wants to provide a fix for the last comment?

comment:5 Changed 12 years ago by alberto

  • Milestone changed from 1.0 to 1.1

comment:6 Changed 12 years ago by JoostM

I have been looking/working on a number of catwalk tickets including this one. Yet by solving one problem something else will surly break and there is no testsuite to catch you. I therefore started work on a functional testsuite based Selenium RC to get catwalk ready for some serious bugfixing.

comment:7 Changed 12 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:8 Changed 10 years ago by jorge.vargas

  • Milestone changed from __unclassified__ to 1.x

comment:9 Changed 10 years ago by Chris Arndt

  • Status changed from reopened to closed
  • Resolution set to worksforme

I can not reproduce this anymore with TG 1.1rc or TG 1.0 SVN r6685.

Note: See TracTickets for help on using tickets.