I got toscawidgets working in the python shell ( as in I could call and
render a widget ) and in the pylons simple toscawidget example, where
the widget gets attached to that handy 'c' object. Couldn't figure out
what to do in TG2 though. Doing the regular tg way gives me the
following traceback from *paster* ( the browser screen just hangs )

TypeError: No object (name: ToscaWidgets per-request storage) has been
registered for this thread

And trying it the pylons way, apparently we don't have the c object.
( no object c in global scope ) BTW, why is that? Is it impossible to
have it both ways? Or do I need to import it from somewhere special? I
didn't see any special import in the pylons controller, it was just
there! ( From BaseController? ) I thought that c and g business seemed
pretty cool from the pylons docs.

Code below:

from toscawidgets.widgets.forms import *
from toscawidgets.widgets.forms.samples import *
from toscawidgets.widgets.forms.validators import *
from toscawidgets.api import WidgetBunch


class RootController(BaseController):

    @expose('app1.templates.index')
    def index(self):
        from datetime import datetime
        return dict(now=datetime.now())

    # can we get widgets working?
    @expose()
    def form(self):
        table_form = TableForm("myform",action="myaction", 
                        method="post", submit_text="Save Me")        
        return table_form.display() 
    
   

Traceback:

File
"/home/xornot/www/tg2_ve2/lib/python2.4/site-packages/twForms-0.2rc2dev_r3751-py2.4.egg/toscawidgets/widgets/forms/templates/table_form.html",
 line 31, in <Expression u'field.display(value_for(field), **args_for(field))'>
    ${field.display(value_for(field), **args_for(field))}
  File
"/home/xornot/www/tg2_ve2/lib/python2.4/site-packages/ToscaWidgets-0.2rc3dev_r3795-py2.4.egg/toscawidgets/core.py",
 line 463, in display
    kw = self.prepare_dict(value, kw)
  File
"/home/xornot/www/tg2_ve2/lib/python2.4/site-packages/twForms-0.2rc2dev_r3751-py2.4.egg/toscawidgets/widgets/forms/core.py",
 line 200, in prepare_dict
    kw = super(InputWidget, self).prepare_dict(value, kw, adapt=False)
  File
"/home/xornot/www/tg2_ve2/lib/python2.4/site-packages/ToscaWidgets-0.2rc3dev_r3795-py2.4.egg/toscawidgets/core.py",
 line 507, in prepare_dict
    self.update_params(d)
  File
"/home/xornot/www/tg2_ve2/lib/python2.4/site-packages/twForms-0.2rc2dev_r3751-py2.4.egg/toscawidgets/widgets/forms/fields.py",
 line 397, in update_params
    super(SubmitButton, self).update_params(d)
  File
"/home/xornot/www/tg2_ve2/lib/python2.4/site-packages/twForms-0.2rc2dev_r3751-py2.4.egg/toscawidgets/widgets/forms/fields.py",
 line 107, in update_params
    super(FormField,self).update_params(d)
  File
"/home/xornot/www/tg2_ve2/lib/python2.4/site-packages/twForms-0.2rc2dev_r3751-py2.4.egg/toscawidgets/widgets/forms/core.py",
 line 216, in update_params
    super(InputWidget, self).update_params(d)
  File
"/home/xornot/www/tg2_ve2/lib/python2.4/site-packages/ToscaWidgets-0.2rc3dev_r3795-py2.4.egg/toscawidgets/core.py",
 line 563, in update_params
    self._calls_for_request
  File
"/home/xornot/www/tg2_ve2/lib/python2.4/site-packages/ToscaWidgets-0.2rc3dev_r3795-py2.4.egg/toscawidgets/util.py",
 line 235, in __get__
    return getattr(request_local, self.name)
  File
"/home/xornot/www/tg2_ve2/lib/python2.4/site-packages/Paste-1.5.1-py2.4.egg/paste/registry.py",
 line 125, in __getattr__
    return getattr(self._current_obj(), attr)
  File
"/home/xornot/www/tg2_ve2/lib/python2.4/site-packages/Paste-1.5.1-py2.4.egg/paste/registry.py",
 line 180, in _current_obj
    raise TypeError(
TypeError: No object (name: ToscaWidgets per-request storage) has been
registered for this thread
----------------------------------------





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" 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-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to