Hello again, I have some additional information.

- turbogears version: I meant 1.0.8 (sorry)
- the form: after a validation error in the 'Edit' form, it gets back
to the 'Create' form. That's why I loose the record id. And the
validation url seems wrong.

Louis


On 15 avr, 14:51, lofic <[email protected]> wrote:
> Hello,
>
> I try to play with turbogears (1.1) and CRUD (tgcrud 1.0.2).
>
> I've created a basic controller with CRUD:
>
> class HostFields(widgets.WidgetsList):
>    """fields definitions. Replace to your Fields"""
>    hostname = widgets.TextField(label="Hostname")
>    ip = widgets.TextField(label="IP")
>
> class HostSchema(validators.Schema):
>    """
>    define validation schema that involves
>    field dependency or logical operators
>    """
>    hostname = validators.String(not_empty=True, max=8)
>    ip = validators.Regex(r'^d{1,3}.d{1,3}.d{1,3}.d{1,3}$')
>
> The Edit feature works fine, except after a validation error.
>
> The working generated form starts with:
> <form action="../save/1" method="post" name="form" class="tableform">
>
> (here '1' is the ID of the record)
>
> After a validation error, it becomes:
> <form action="save" method="post" name="form" class="tableform">
>
> So when I correct the wrong field and validate again, I get:
> (...)
>  File "/home/admin/customsys/customsys/HostEd/controllers.py", line
> 87, in save
>    record = Host.get(int(id))
> ValueError: invalid literal for int(): save
>
> Any clues ?
>
> Thanks in advance.
>
> Louis Coilliot
--~--~---------~--~----~------------~-------~--~----~
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