This surely is a bug.  I already have a fix for it but don't have the  
code handy right now, I'll post it when I get to the office (1hour).

Alberto

On 21/02/2006, at 11:27, Olli Wang wrote:

>
> hi, i got problem when using CalendarDateTimePicker with validator. i
> don't know it's a bug or I misunderstand how to use it. can someone
> help me. here's my code and traceback:
>
> code(i just list related code):
>
> # if I put off name's "validator=validators.NotEmpty", then it work.
> class AddEntryFields(widgets.WidgetsDeclaration):
>       name = widgets.TextField(label="Name:",  
> validator=validators.NotEmpty)
>       datetime = widgets.CalendarDateTimePicker()
>       category = widgets.SingleSelectField(label="Category:",
> options=[('test','test')])
>       description = widgets.TextArea(label="Description:")
>       mode = widgets.HiddenField(default="add")
>
> add_entry_form = widgets.TableForm(fields=AddEntryFields(),
>                                  submit_text=" Save Entry ")
>
> -
> # in Root class:
>       @expose(template="myrs.templates.schedule.add_entry")
>       def add_entry(self, tg_errors=None, *args, **kw):
>               if tg_errors:
>                       flash("There was a problem with the form!")
>               return dict(add_entry_form=add_entry_form)
>
>       @expose()
>       @validate(form=add_entry_form)
>       @error_handler(add_entry)
>       def processing_entry(self, name, datetime, category, description,
> mode):
>               flash(_("New entry saved!"))
>               raise cherrypy.HTTPRedirect(url("/schedule/"))
> -
> TraceBack:
>
> 500 Internal error
>
> The server encountered an unexpected condition which prevented it from
> fulfilling the request.
>
> Page handler: <bound method Root.save of
> <formstutorial.controllers.Root object at 0x00C2C310>>
> Traceback (most recent call last):
>   File
> "c:\python24\lib\site-packages\cherrypy-2.2.0beta-py2.4.egg\cherrypy 
> \_cphttptools.py",
> line 98, in _run
>     self.main()
>   File
> "c:\python24\lib\site-packages\cherrypy-2.2.0beta-py2.4.egg\cherrypy 
> \_cphttptools.py",
> line 246, in main
>     body = page_handler(*virtual_path, **self.params)
>   File "<string>", line 3, in save
>   File "c:\program
> files\subversion\turbogears\turbogears\controllers.py", line 201, in
> expose
>     tg_format, html, fragment, *args, **kw)
>   File "turbogears\database.py", line 193, in run_with_transaction
>   File "c:\program
> files\subversion\turbogears\turbogears\controllers.py", line 219, in
> _execute_func
>     output = errorhandling.try_call(func, *args, **kw)
>   File "c:\program
> files\subversion\turbogears\turbogears\errorhandling.py", line 63, in
> try_call
>     output = func(self, *args, **kw)
>   File "<string>", line 3, in save
>   File "c:\program
> files\subversion\turbogears\turbogears\controllers.py", line 136, in
> validate
>     return errorhandling.run_with_errors(errors, func, *args, **kw)
>   File "c:\program
> files\subversion\turbogears\turbogears\errorhandling.py", line 91, in
> run_with_errors
>     output = dispatch_error(self, func, errors, None, *args, **kw)
>   File "<string>", line 5, in dispatch_error
>   File "c:\program
> files\subversion\turbogears\turbogears\errorhandling.py", line 57, in
> adaptor
>     return func(controller, *args, **kw)
>   File "<string>", line 3, in add
>   File "c:\program
> files\subversion\turbogears\turbogears\controllers.py", line 196, in
> expose
>     output = _execute_func(func, tg_format, html, fragment,
>   File "c:\program
> files\subversion\turbogears\turbogears\controllers.py", line 224, in
> _execute_func
>     return _process_output(tg_format, output, html, fragment)
>   File "c:\program
> files\subversion\turbogears\turbogears\controllers.py", line 68, in
> _process_output
>     fragment=fragment)
>   File "turbogears\view.py", line 60, in render
>   File "c:\program
> files\subversion\turbogears\plugins\kid\turbokid\kidsupport.py", line
> 108, in render
>     return t.serialize(encoding=self.defaultencoding, output=format,
> fragment=fragment)
>   File
> "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid\__init__.py",
> line 236, in serialize
>     return serializer.serialize(self, encoding, fragment)
>   File
> "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid 
> \serialization.py",
> line 51, in serialize
>     text = list(self.generate(stream, encoding, fragment))
>   File
> "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid 
> \serialization.py",
> line 327, in generate
>     for ev, item in self.apply_filters(stream):
>   File
> "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid 
> \serialization.py",
> line 84, in balancing_filter
>     for ev, item in stream:
>   File "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid 
> \pull.py",
> line 206, in _coalesce
>     for ev, item in stream:
>   File
> "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid\filter.py",  
> line
> 21, in transform_filter
>     for ev, item in apply_matches(stream, template, templates,
> apply_func):
>   File
> "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid\filter.py",  
> line
> 31, in apply_matches
>     item = stream.expand()
>   File "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid 
> \pull.py",
> line 95, in expand
>     for ev, item in self._iter:
>   File "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid 
> \pull.py",
> line 164, in _track
>     for p in stream:
>   File "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid 
> \pull.py",
> line 206, in _coalesce
>     for ev, item in stream:
>   File "E:\TurboGears\FormsTutorial\formstutorial\templates\form.py",
> line 62, in _pull
>   File "c:\program
> files\subversion\turbogears\turbogears\widgets\base.py", line 146, in
> __call__
>     return self.display(*args, **kw)
>   File "c:\program
> files\subversion\turbogears\turbogears\widgets\base.py", line 218, in
> display
>     return view.transform(template_vars, template=self.template_c)
>   File "turbogears\view.py", line 65, in transform
>   File "c:\program
> files\subversion\turbogears\plugins\kid\turbokid\kidsupport.py", line
> 125, in transform
>     return ElementStream(t.transform()).expand()
>   File "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid 
> \pull.py",
> line 95, in expand
>     for ev, item in self._iter:
>   File "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid 
> \pull.py",
> line 164, in _track
>     for p in stream:
>   File
> "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid\filter.py",  
> line
> 21, in transform_filter
>     for ev, item in apply_matches(stream, template, templates,
> apply_func):
>   File
> "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid\filter.py",  
> line
> 25, in apply_matches
>     for ev, item in stream:
>   File "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid 
> \pull.py",
> line 164, in _track
>     for p in stream:
>   File "c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid 
> \pull.py",
> line 206, in _coalesce
>     for ev, item in stream:
>   File "<string>", line 66, in _pull
>   File "c:\program
> files\subversion\turbogears\turbogears\widgets\base.py", line 217, in
> display
>     self.update_data(template_vars)
>   File "c:\program
> files\subversion\turbogears\turbogears\widgets\big_widgets.py", line
> 60, in update_data
>     d['strdate'] = d['value'].strftime(d['format'])
> KeyError: 'format'
>
>
>


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to