In my controller I have:

class SerialReachFields(WidgetsList):
    serialnumber = Label(label="Serial Number")
    reach=SingleSelectField('Reach', options=lambda: [(t.id, t.reach)
for t in Reach.select()])

class SerialReachSchema(validators.Schema):
    serialnumber = validators.String(not_empty=True, max=8)
    reach = validators.String(not_empty=True, max=45)

class SerialReachForm(TableForm):
    fields = SerialReachFields()
    validator = SerialReachSchema() # define schema outside of
SerialReachFields


AND

    def edit(self, id=None, tg_paginate_limit=25, tg_paginate_no=1,
**kw):
        if identity.current.anonymous:
                    raise redirect("/login", forward_url="%s/
list"%self.rootDir)

        try:
            record = SerialReach.get(int(id))
        except:
            flash = "Not valid edit"

        RecordReach = record.reach
        reachID = Reach.byReach(record.reach)

        model_form.fields[1].default=reachID.id
        return dict(modelname = self.modelname,
                    record = record,
                    form = model_form,
tg_paginate_limit=tg_paginate_limit, tg_paginate_no=tg_paginate_no,
                    rootDir=self.rootDir)


My App Page shows the way I expect it to the first time it pulls up.
However if i refresh the display for go back and select another record
to edit I get:

Page handler: <bound method serialreach.edit of
<ycwuadispatch.serialreach.controllers.serialreach object at
0x885448c>>
Traceback (most recent call last):
  File "/var/lib/python-support/python2.4/cherrypy/_cphttptools.py",
line 105, in _run
    self.main()
  File "/var/lib/python-support/python2.4/cherrypy/_cphttptools.py",
line 254, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in edit
  File "/usr/lib/python2.4/site-packages/TurboGears-1.0.2.2-py2.4.egg/
turbogears/controllers.py", line 334, in expose
    output = database.run_with_transaction(
  File "<string>", line 5, in run_with_transaction
  File "/usr/lib/python2.4/site-packages/TurboGears-1.0.2.2-py2.4.egg/
turbogears/database.py", line 303, in so_rwt
    retval = func(*args, **kw)
  File "<string>", line 5, in _expose
  File "/usr/lib/python2.4/site-packages/TurboGears-1.0.2.2-py2.4.egg/
turbogears/controllers.py", line 351, in <lambda>
    mapping, fragment, args, kw)))
  File "/usr/lib/python2.4/site-packages/TurboGears-1.0.2.2-py2.4.egg/
turbogears/controllers.py", line 378, in _execute_func
    output = errorhandling.try_call(func, *args, **kw)
  File "/usr/lib/python2.4/site-packages/TurboGears-1.0.2.2-py2.4.egg/
turbogears/errorhandling.py", line 73, in try_call
    return func(self, *args, **kw)
  File "/home/mirizarry/mirizarry/YCWUADispatch/ycwuadispatch/
serialreach/controllers.py", line 93, in edit
    model_form.fields[1].default=reachID.id
  File "/usr/lib/python2.4/site-packages/TurboGears-1.0.2.2-py2.4.egg/
turbogears/widgets/base.py", line 310, in __setattr__
    raise ValueError, \
ValueError: It is not threadsafe to modify widgets in a request


Why am I allowed to set it the first time through by now again?  Is
there a way around this?

Thanks,
Mel


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to