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 #300 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

Datacontroller error in add method when there's no default in the model

Reported by: Luca <luca@…> Owned by: anonymous
Priority: normal Milestone: 0.9
Component: TG Widgets Version:
Severity: major Keywords:
Cc:

Description

This is the model:

class Person(SQLObject):
    name = StringCol(length=255, title='Nombre')
    age = IntCol(title='Edad')

This is the traceback when clicking in the add method of the DataController:

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/CherryPy-2.1.0-py2.4.egg/cherrypy/_cphttptools.py", line 271, in run
    main()
  File "/usr/lib/python2.4/site-packages/CherryPy-2.1.0-py2.4.egg/cherrypy/_cphttptools.py", line 502, in main
    body = page_handler(*args, **cherrypy.request.paramMap)
  File "/tmp/turbogears/turbogears/controllers.py", line 242, in newfunc
    html, *args, **kw)
  File "/tmp/turbogears/turbogears/database.py", line 175, in run_with_transaction
    retval = func(*args, **kw)
  File "/tmp/turbogears/turbogears/controllers.py", line 262, in _execute_func
    return _process_output(tg_format, output, html)
  File "/tmp/turbogears/turbogears/controllers.py", line 64, in _process_output
    output = view.render(output, tg_format, template=template)
  File "/tmp/turbogears/turbogears/view.py", line 56, in render
    return engine.render(info, format, fragment, template)
  File "/tmp/turbogears/turbogears/kidsupport.py", line 141, in render
    return t.serialize(encoding=self.defaultencoding, output=format, fragment=fragment)
  File "/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py", line 232, in serialize
    return serializer.serialize(self, encoding, fragment)
  File "/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/serialization.py", line 51, in serialize
    text = list(self.generate(stream, encoding, fragment))
  File "/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/serialization.py", line 319, in generate
    for ev, item in self.apply_filters(stream):
  File "/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/serialization.py", line 77, in balancing_filter
    for ev, item in stream:
  File "/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/pull.py", line 203, in _coalesce
    for ev, item in stream:
  File "/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/filter.py", line 21, in transform_filter
    for ev, item in apply_matches(stream, template, templates, apply_func):
  File "/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/filter.py", line 31, in apply_matches
    item = stream.expand()
  File "/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/pull.py", line 95, in expand
    for ev, item in self._iter:
  File "/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/pull.py", line 164, in _track
    for p in stream:
  File "/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/pull.py", line 203, in _coalesce
    for ev, item in stream:
  File "/tmp/wtest/wtest/templates/welcome.py", line 53, in _pull
  File "/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/filter.py", line 21, in transform_filter
    for ev, item in apply_matches(stream, template, templates, apply_func):
  File "/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/filter.py", line 25, in apply_matches
    for ev, item in stream:
  File "/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/pull.py", line 164, in _track
    for p in stream:
  File "/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/pull.py", line 203, in _coalesce
    for ev, item in stream:
  File "<string>", line 77, in _pull
  File "/tmp/turbogears/turbogears/widgets/base.py", line 111, in insert
    convert=convert, **kw),
  File "/tmp/turbogears/turbogears/widgets/base.py", line 82, in create_dict
    value = self.validator.from_python(value)
  File "/usr/lib/python2.4/site-packages/FormEncode-0.4-py2.4.egg/formencode/api.py", line 342, in from_python
    value = self._from_python(value, state)
  File "/usr/lib/python2.4/site-packages/FormEncode-0.4-py2.4.egg/formencode/validators.py", line 894, in _to_python
    value, state)
Invalid: Please enter an integer value

If I use this:

class Person(SQLObject):
    name = StringCol(length=255, title='Nombre', default='')
    age = IntCol(title='Edad', default=0)

it works fine...

Change History

comment:1 Changed 13 years ago by alberto

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

This is fixed with the new widget API. TestDataController? proves it since r727

Note: See TracTickets for help on using tickets.