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

Opened 14 years ago

Last modified 12 years ago

Error in DataController when using title in SQLObject columns

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

Description

This is the model.py

from sqlobject import *
from turbogears.database import PackageHub

hub = PackageHub("wtest")
__connection__ = hub

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

This is the controller.py

import cherrypy
import turbogears
from turbogears.fastdata import DataController
import model

class Root(controllers.RootController):
    person = DataController(model.Person)

This is the traceback for  http://localhost:8080/person/1/edit (object with id 1 exists)

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 220, in newfunc
    html, *args, **kw)
  File "/tmp/turbogears/turbogears/database.py", line 174, in run_with_transaction
    retval = func(*args, **kw)
  File "/tmp/turbogears/turbogears/controllers.py", line 246, in _execute_func
    output = func(self, *args, **kw)
  File "/tmp/turbogears/turbogears/fastdata/datacontroller.py", line 111, in default
    return method(item, *vpath[1:], **params)
  File "/tmp/turbogears/turbogears/controllers.py", line 223, in newfunc
    tg_format, html, *args, **kw)
  File "/tmp/turbogears/turbogears/controllers.py", line 249, 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 55, in render
    return engine.render(info, format, fragment, template)
  File "/tmp/turbogears/turbogears/kidsupport.py", line 106, 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/turbogears/turbogears/fastdata/templates/form.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 56, in _pull
AttributeError: 'str' object has no attribute 'insert'

This is the traceback for  http://localhost:8080/person/add

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 220, in newfunc
    html, *args, **kw)
  File "/tmp/turbogears/turbogears/database.py", line 174, in run_with_transaction
    retval = func(*args, **kw)
  File "/tmp/turbogears/turbogears/controllers.py", line 249, 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 55, in render
    return engine.render(info, format, fragment, template)
  File "/tmp/turbogears/turbogears/kidsupport.py", line 106, 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/turbogears/turbogears/fastdata/templates/form.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 56, in _pull
AttributeError: 'str' object has no attribute 'insert'

Change History

comment:1 Changed 14 years ago by kevin

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

this is fixed in [406] by the change presented in #288.

Note: See TracTickets for help on using tickets.