Re: disabling zope.schema constraint check in edit form

Leonardo Rochael Almeida <[email protected]>
Newsgroups gmane.comp.web.zope.devel,gmane.comp.web.zope.bluebream
Message-ID <CAMxX_oOpkw_ZyoS2FLqvfuMVBOYa66XUpao=E35G5iMT8b3DEw@mail.gmail.com>
Hi Joshua,

On Thu, Aug 18, 2011 at 09:59, Joshua Immanuel <[email protected]> wrote:
> [...] Worse case scenario is where I have a cancel
> action button which just redirects to another page, that too screams for
> the NameAlreadyExists error.

For the 'cancel button' case, you need to have a form action with a
validator that always validates, no matter what. You can find an
example of one such null_validator here:

https://svn.plone.org/svn/plone/plone.app.form/tags/2.0.3/plone/app/form/validators.py

To use it, you do something like

class MyForm(...):

  @form.action(..., validator=null_validator):
  def handle_cancel(self, ...)
    [... do the redirect ...]

Cheers,

Leo

> [...]
_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.