grok.Form subclasses expect an actions attribute when rendering
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grok |
Fix Released
|
Medium
|
Jan Wijbrand Kolman | ||
1.0 |
Fix Released
|
Medium
|
Jan Wijbrand Kolman |
Bug Description
This is grok 0.12.1.
Forms created by subclassing grok.Form fail to render if no actions are specified. For example:
(app.py)
from zope.interface import Interface
from zope.schema import TextLine
import grok
class IDummyForm(
name = TextLine(
class Content(
grok.
class DummyForm(
grok.
form_fields = [] # or grok.AutoFields
Visiting the /dummyform URL in the browser gives a traceback as follows:
2008-06-02T21:10:08 ERROR SiteError http://
Traceback (most recent call last):
File "/Users/
File "/Users/
File "/Users/
File "/Users/
- __traceback_info__: <madhatter.
File "/Users/
File "/Users/
File "/Users/
File "/Users/
AttributeError: 'DummyForm' object has no attribute 'actions'
While forms with buttons are the common case, it's not hard to imagine a situation where a form might not have any buttons (perhaps the form is processed by some client-side javascript).
It should be possible to have forms without buttons (actions).
Changed in grok: | |
assignee: | nobody → janwijbrand |
milestone: | none → 1.0 |
On 2 Jun 2008, at 22:14 , Dan Fairs wrote: Interface) : title=u' name') grok.Applicatio n, grok.Container): (IDummyForm) grok.Form) : Content) (Content) localhost: 8080/foo/
> (app.py)
> from zope.interface import Interface
> from zope.schema import TextLine
> import grok
>
> class IDummyForm(
> name = TextLine(
>
> class Content(
> grok.implements
>
>
> class DummyForm(
> grok.context(
> form_fields = [] # or grok.AutoFields
>
> Visiting the /dummyform URL in the browser gives a traceback as
> follows:
>
> 2008-06-02T21:10:08 ERROR SiteError http://
> dummyform
> Traceback (most recent call last):
> ...
> AttributeError: 'DummyForm' object has no attribute 'actions'
>
> While forms with buttons are the common case, it's not hard to
> imagine a
> situation where a form might not have any buttons (perhaps the form is
> processed by some client-side javascript).
>
> It should be possible to have forms without buttons (actions).
You can simply add the 'actions' attribute to the form class to avoid
the exception:
class DummyForm( grok.Form) :
...
actions = []