Using deform to AJAX validate one field at a time before submission

2011-12-11 Thread Craig Younkins
Hello! Is it possible to use deform to validate HTML forms one field at a time, as they are changed, before submission? So, if a user types 'foo' as their email address, an AJAX call is made, deform validates that field and raises an exception, and the response to the browser indicat

Re: @validate and request params

2010-06-17 Thread Petr Blahos
>> So first, why does @validate change the request method? Is it to help >> the error middleware? > > It's so that if the other method that displays the form has a REST decorator > requiring > a GET to show the form, it can still actually be run. Not an ideal solution

Re: @validate and request params

2010-06-04 Thread Mike Orr
ld be the default value in the text box.; >> >> In 'save' decorated with @validate, you'd get the processed variables >> from self.form_result. request.params contains the variables as they >> were

Re: @validate and request params

2010-06-04 Thread Petr Blahos
>> First of all, I would like to know, whether my idea that request.params >> should be there is correct. > > You called it with "?par1=xxx", so c.par1 should be "xxx" and that > should be the default value in the text box.; > > In 'save' de

Re: @validate and request params

2010-06-04 Thread Mike Orr
On Thu, Jun 3, 2010 at 11:58 PM, Petr Blahos wrote: >> > CODE: >> > When I call validate/index?par1=xxx >> > fill a non-number into the second text-field and press submit, I get >> > an exception >> > on the second line of index. >> >> So w

Re: @validate and request params

2010-06-03 Thread Petr Blahos
> > CODE: > > When I call validate/index?par1=xxx > > fill a non-number into the second text-field and press submit, I get > > an exception > > on the second line of index. > > So what is the problem? �...@validate is eating parameters so that they > no

Re: @validate and request params

2010-06-03 Thread Mike Orr
On Thu, Jun 3, 2010 at 7:15 AM, pb wrote: > CODE: > When I call validate/index?par1=xxx > fill a non-number into the second text-field and press submit, I get > an exception > on the second line of index. So what is the problem? @validate is eating parameters so that they no l

Re: @validate and request params

2010-06-03 Thread cd34
I had a similar issue using the @validate with a RESTful URI: request.environ['webob._parsed_post_vars'][0] contained the post data -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send

@validate and request params

2010-06-03 Thread pb
Hi all, I have been using 0.9.6 until recently and after upgrade I noticed a change in behaviour: I use formencode and the @validate decorator with a form parameter. Now, in 0.9.6 the form action called in case of an error received the same request.params as the action being validated. It no

unexpected behavior of request.params after validate ; is this intentional of webob (not @validate)?

2010-02-28 Thread Jonathan Vanasco
i spent the past 3 hours going through my own validate code, and the original pylons that i forked off of, trying to figure out why params is always empty on a form error. i finally tracked down the issue. @validate has this line, so that the form can be re-run as a GET with htmlfill args

Re: @validate revisited, JSON support, content negotiation

2010-02-28 Thread Mike Burrows
@validate becomes self._parse() and self._render_invalid(), both of these defined on BaseController. The on_get bit is near the top of _parse() - you could easily patch/override that. I have just noticed that I didn't remove that fragment from what's left of validate() - you would

Re: @validate revisited, JSON support, content negotiation

2010-02-27 Thread Jonathan Vanasco
ah, interesting -- so the validation becomes a function of the controller. i'd like to make a suggestion to your then. i have an arg to validate called gatekeeper , which is enabled as True by default ( along with post_only ) In conjunction with one another, gatekeeper just makes sure th

Re: annoying htmlfill error - on error, overwrites all submit buttons with the selected option from formencode/validate

2010-02-27 Thread Ian Wilson
ay that you have mutiple submit buttons: > >  input type="submit" name="action" value="do_this" >  input type="submit" name="action" value="do_that" > > if formencode/validate catches an error on the form, all "action&quo

annoying htmlfill error - on error, overwrites all submit buttons with the selected option from formencode/validate

2010-02-27 Thread Jonathan Vanasco
this is annoying. lets say that you have mutiple submit buttons: input type="submit" name="action" value="do_this" input type="submit" name="action" value="do_that" if formencode/validate catches an error on the form, all &qu

Re: @validate revisited, JSON support, content negotiation

2010-02-24 Thread Mike Burrows
I'm 100% sure that this answers your question, but (following my outline above) self._render_invalid(e, form='_checkout_shipping__print') will call the _checkout_shipping__print action and apply the errors to it, just as @validate would. In the example, the errors are ob

Re: @validate revisited, JSON support, content negotiation

2010-02-23 Thread Jonathan Vanasco
does this new approach allow for form errors to be re-triggered in the controller like my stab ( http://groups.google.com/group/pylons-discuss/browse_thread/thread/4269ca745e31793 ) ? because that's the only thing i care about. example: from OpenSocialNetwork.lib.decorators import osn_validate

Re: how to make formencode validate conditionally

2010-02-20 Thread Mariano Mara
Excerpts from Ian Wilson's message of Sat Feb 20 05:52:10 -0300 2010: > Hello hello, > > You probably want to create a chained form validator. Then apply the > validators to the combo fields manually depending on if your checkbox > is True or False. There are other ways to do this but I've creat

Re: how to make formencode validate conditionally

2010-02-20 Thread Ian Wilson
Hello hello, You probably want to create a chained form validator. Then apply the validators to the combo fields manually depending on if your checkbox is True or False. There are other ways to do this but I've created a pastie of one. You can mess around and see if it fits what you need. http

how to make formencode validate conditionally

2010-02-19 Thread Mariano Mara
Hi everyone, I have three validations on a schema (one for a checkbox with a StringBool validation and two combo boxes using OneOf validations) and I want to enforce validation on combos if the check box is true, otherwise I want FormEncode to ignore them. I checked FormEncode documentation an

Re: @validate revisited, JSON support, content negotiation

2010-02-12 Thread Mike Burrows
Done, new gist http://gist.github.com/302617, ticket updated. @validate now uses the same _parse() and _render_invalid() methods used by the example below. def update(self): try: self._parse(request, schema=MyForm()) # Here self.form_result is populated as

Re: @validate revisited, JSON support, content negotiation

2010-02-11 Thread Mike Burrows
t; Personally, I would be happy to see a decorator-free Pylons but I say > > > that without knowing what our action methods will look like without > > > them! > > > You can do it now; the trouble is you either have to work up from a > > minimal try/except or wo

Re: @validate revisited, JSON support, content negotiation

2010-02-11 Thread Mike Burrows
tor-free Pylons but I say > > that without knowing what our action methods will look like without > > them! > > You can do it now; the trouble is you either have to work up from a > minimal try/except or work down from the @validate code. The problem > with the @validate code

Re: @validate revisited, JSON support, content negotiation

2010-02-11 Thread Mike Orr
ry/except or work down from the @validate code. The problem with the @validate code is it's hard to separate the universal pattern from the specific argument slinging the decorator does. The pattern is something like this (untested): ''' try: val = MyValidator() data = va

Re: @validate revisited, JSON support, content negotiation

2010-02-11 Thread Mike Burrows
Feb 11, 2010 at 8:30 AM, Mike Burrows wrote: > > So...  anyone else interested? > > I'm not sure, it's kind of complex to make a quick decision on. Could > you make a link to your proposal in the @validate reorganization > ticket? Then we can consider it for Pylons 1.1.

Re: @validate revisited, JSON support, content negotiation

2010-02-11 Thread Mike Orr
On Thu, Feb 11, 2010 at 8:30 AM, Mike Burrows wrote: > So...  anyone else interested? I'm not sure, it's kind of complex to make a quick decision on. Could you make a link to your proposal in the @validate reorganization ticket? Then we can consider it for Pylons 1.1. My inclin

Re: @validate revisited, JSON support, content negotiation

2010-02-11 Thread Mike Burrows
I've done quick write-up on the now-completed {.format} thing here (with a clarifying comment or two) : * http://positiveincline.com/?p=617 This gist has the refactored and json-capable @validate plus other small goodies referred to in previous discussions: * http://gist.github.com/3

@validate revisited, JSON support, content negotiation

2010-02-09 Thread Mike Burrows
Hi, No, not another whinge - maybe there's life in @validate yet! Locally to my project, I have a refactored @validate decorator sitting in my lib/base.py, with most of the work of what was previously a 100+ line function extracted to methods on BaseController. What's left of the fu

Re: @validate ....

2009-11-20 Thread Ian Wilson
I'm going to keep this thread alive. I ended up using the containers class you mentioned. I think my solution is _really_ similar to Tycon's solution as mentioned in the splitting validate ticket except I don't use decorators. Somehow I did not see his solution until I saw th

Re: alternate @validate for review / submission

2009-11-01 Thread Jonathan Vanasco
didn't realize the boilerplate copyright/license was on there... 50% of that is pylons! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googl

alternate @validate for review / submission

2009-11-01 Thread Jonathan Vanasco
I redid the @validate decorator, because I hate it. it seems to work, but needs some help. i put it on pylonshq as a pastie here: http://pylonshq.com/pasties/4fb8ce88c6d42b2ee048cf0ef0e678c1 to note: - decorating with @osn_validate is mostly backwards compatible - - the main difference is

ToscaWidgets, @validate, Restful URL question

2009-10-29 Thread cd34
I have an application where I have a url of: /widgets >From that list, you can view the detail of an individual widget with: /widget/1 This page displays widget_header and widget_detail lines. The form at the bottom allows the user to add a new detail line. @validate(widget_f

Re: @validate ....

2009-10-28 Thread Mike Orr
On Wed, Oct 28, 2009 at 2:30 PM, Ian Wilson wrote: > >> > 1. the separation of form prompt(initial display), form >> > redisplay(errors) and form rendering(shared by initial display and >> > redisplay). >> >> What would that gain you?  Are you talking about something like a >> class with methods

Re: @validate ....

2009-10-28 Thread Ian Wilson
On Oct 23, 6:29 pm, Mike Orr wrote: > On Fri, Oct 23, 2009 at 4:44 PM, Ian Wilson wrote: > > > I think validate was created as a simple yet incomplete solution but > > people expect it to do everything. > > Yes. I think it was created because TurboGears had a validate &

Re: @validate ....

2009-10-23 Thread Mike Orr
On Fri, Oct 23, 2009 at 4:44 PM, Ian Wilson wrote: > > I think validate was created as a simple yet incomplete solution but > people expect it to do everything. Yes. I think it was created because TurboGears had a validate decorator and we wanted one too. It solves the use cas

Re: @validate ....

2009-10-23 Thread Mike Orr
On Fri, Oct 23, 2009 at 3:58 PM, Kevin J. Smith wrote: > Thanks for the clarification, Mike.  So it is really an issue with the > decorator rather than FormEncode as a whole, correct?  As I mentioned, I > have never ran into issues with FormEncode but I have only just started > using Pylons there

Re: @validate ....

2009-10-23 Thread Ian Wilson
using Pylons therefore haven't ran across a huge number of cases with the > decorator. > > 2009/10/23 Mike Orr >> >> On Fri, Oct 23, 2009 at 3:29 PM, Kevin J. Smith >> wrote: >> > I'm curious as to what everyone's hate for @validate is.  I have been

Re: @validate ....

2009-10-23 Thread Kevin J. Smith
h the decorator. 2009/10/23 Mike Orr > > On Fri, Oct 23, 2009 at 3:29 PM, Kevin J. Smith > wrote: > > I'm curious as to what everyone's hate for @validate is. I have been a > long > > time user of FormEncode and new to Pylons and found @validate pretty damn > > s

Re: @validate ....

2009-10-23 Thread Mike Orr
On Fri, Oct 23, 2009 at 3:29 PM, Kevin J. Smith wrote: > I'm curious as to what everyone's hate for @validate is.  I have been a long > time user of FormEncode and new to Pylons and found @validate pretty damn > slick.  I've got custom validators and chained validators

Re: @validate ....

2009-10-23 Thread Kevin J. Smith
I'm curious as to what everyone's hate for @validate is. I have been a long time user of FormEncode and new to Pylons and found @validate pretty damn slick. I've got custom validators and chained validators and never really had a complaint. I've definitely ran into sit

Re: @validate ....

2009-10-23 Thread Mike Orr
On Fri, Oct 23, 2009 at 2:31 PM, Thomas G. Willis wrote: > > On Oct 23, 4:54 pm, Mike Orr wrote: >> On Sun, Oct 11, 2009 at 1:53 PM, Jonathan Vanasco >> wrote: > >> This is one of the problems with @validate; it's not flexible enough >> for this situa

Re: how can I cause a form error outside of an @validate schema ?

2009-10-23 Thread D D
If I get an error while validation, I set the session variables: except formencode.Invalid, error: session['flash_error'] = str(error) session['htmlfill_values'] = self.form_result return self.show_form() and then in show_form: values = session.pop('htmlfill_values', None) if not values: //

Re: how can I cause a form error outside of an @validate schema ?

2009-10-23 Thread Mike Orr
On Fri, Oct 23, 2009 at 1:58 PM, Thomas G. Willis wrote: > > I would think formencode/htmlfill allows for this. > > If you need to validate the entire form, use a chained validator(or > several), In your validator you can make your error message say > whatever you want. This

Re: @validate ....

2009-10-23 Thread Jonathan Vanasco
Agreed with Mike about the shortcomings with @validate. There's a lot of things I don't like about it. Chained Validators are not an option for me, and likely others. They work great for validating the input, but in many cases you have business logic within the controller tha

@validate ....

2009-10-23 Thread Thomas G. Willis
On Oct 23, 4:54 pm, Mike Orr wrote: > On Sun, Oct 11, 2009 at 1:53 PM, Jonathan Vanasco > wrote: > This is one of the problems with @validate; it's not flexible enough > for this situation.  The developers are mulling over ways to rewrite > it or replace it. > > -

Re: how can I cause a form error outside of an @validate schema ?

2009-10-23 Thread Thomas G. Willis
I would think formencode/htmlfill allows for this. If you need to validate the entire form, use a chained validator(or several), In your validator you can make your error message say whatever you want. Spend some time with the docs, they are pretty thorough. http://formencode.org/ and maybe

Re: how can I cause a form error outside of an @validate schema ?

2009-10-23 Thread Mike Orr
On Sun, Oct 11, 2009 at 1:53 PM, Jonathan Vanasco wrote: > > where does webhelpers get the data for form values ? > > i have the validator handling stuff fine, however in some situations i > need to cause an error within the controller. This is one of the problems with @val

Re: how can I cause a form error outside of an @validate schema ?

2009-10-23 Thread Jonathan Vanasco
On Oct 23, 3:55 pm, d2ncal wrote: > I am looking for the same thing. > > Currently, I am setting session['flash_error'] and calling my > show_form function which does htmlfill. but there has to have a better > way. How does your show_form function handle htmlfill ? --~--~-~--~~--

Re: how can I cause a form error outside of an @validate schema ?

2009-10-23 Thread d2ncal
I am looking for the same thing. Currently, I am setting session['flash_error'] and calling my show_form function which does htmlfill. but there has to have a better way. On Oct 11, 1:53 pm, Jonathan Vanasco wrote: > where does webhelpers get the data for form values ? > > i have the validator

how can I cause a form error outside of an @validate schema ?

2009-10-11 Thread Jonathan Vanasco
where does webhelpers get the data for form values ? i have the validator handling stuff fine, however in some situations i need to cause an error within the controller. currently this just republishes the form; I need to figure out how to get the form show the correct and incorrect values --~--

Re: Using Django Forms with Pylons (and a successor to @validate?)

2009-10-05 Thread Ian Bicking
average learning curve but like all things that are powerful and can be > > adapted to any situation, there is always a tradeoff. I would hate to > see > > support for FormEncode lost in Pylons. I currently use @validate with > > custom validators and formatters with htmlfill

Re: Using Django Forms with Pylons (and a successor to @validate?)

2009-10-05 Thread Dan
always a tradeoff.  I would hate to see > > support for FormEncode lost in Pylons.  I currently use @validate with > > custom validators and formatters with htmlfill with great success.  I think > > it would be a great loss to move to some simpler solution that is not as > > powerful.

Re: Using Django Forms with Pylons (and a successor to @validate?)

2009-10-04 Thread Mike Orr
apted to any situation, there is always a tradeoff.  I would hate to see > support for FormEncode lost in Pylons.  I currently use @validate with > custom validators and formatters with htmlfill with great success.  I think > it would be a great loss to move to some simpler solution that

Re: Using Django Forms with Pylons (and a successor to @validate?)

2009-10-04 Thread Mike Orr
orm, but there are methods you can override to customize form validation , which I think would give you the equivalent. > Both solutions look really nice - I wonder what the advantages/ > disadvantages to using WTForms are, compared to FormEncode/htmlfill? I > never had much luck with @va

Re: Using Django Forms with Pylons (and a successor to @validate?)

2009-10-04 Thread Kevin J. Smith
support for FormEncode lost in Pylons. I currently use @validate with custom validators and formatters with htmlfill with great success. I think it would be a great loss to move to some simpler solution that is not as powerful. The reason I chose Pylons is for its power to adapt, otherwise, I would

Re: Using Django Forms with Pylons (and a successor to @validate?)

2009-10-04 Thread DavidG
Does either Django forms or WTForms support chained validators a la FormEncode? I find this a very useful feature. Both solutions look really nice - I wonder what the advantages/ disadvantages to using WTForms are, compared to FormEncode/htmlfill? I never had much luck with @validate, so

Re: Using Django Forms with Pylons (and a successor to @validate?)

2009-10-03 Thread Dan
gant. It would obviate FormEncode, htmlfill, and > the form helpers, it looks like.  Are the validators complete?  Not > that FormEncode's validators are easy to use in their semi-documented > state. > > Can you use the validators alone without the form?  I use a FormEncode > sch

Re: Using Django Forms with Pylons (and a successor to @validate?)

2009-10-02 Thread Mike Orr
, it looks like. Are the validators complete? Not that FormEncode's validators are easy to use in their semi-documented state. Can you use the validators alone without the form? I use a FormEncode schema to validate the INI file in environment.py, so that I can make all exceptions happen at

Re: Using Django Forms with Pylons (and a successor to @validate?)

2009-10-02 Thread Marcus Cavanaugh
On Oct 2, 6:05 pm, Dan wrote: > WTForms does this already:http://wtforms.simplecodes.com/ > > It uses the same pattern as Django forms, and might be a bit further > developed. Cool, I had not heard of WTForms before. If it's well-maintained, then that's a win-win. --~--~-~--~~---

Re: Using Django Forms with Pylons (and a successor to @validate?)

2009-10-02 Thread Dan
> Every now and then a little flare-up of anxiety has hit me about the attempt > > you and I did at PyCon... and each time I didn't know what to do to "fix" > > @validate or to make recommendations based on what you and I worked through. > > > Thanks for shar

Re: Using Django Forms with Pylons (and a successor to @validate?)

2009-10-02 Thread Mike Orr
g >> django.forms with Pylons here: > > This looks great, Marcus. > > Every now and then a little flare-up of anxiety has hit me about the attempt > you and I did at PyCon... and each time I didn't know what to do to "fix" > @validate or to make recommenda

Re: Using Django Forms with Pylons (and a successor to @validate?)

2009-10-02 Thread Matt Feifarek
ery now and then a little flare-up of anxiety has hit me about the attempt you and I did at PyCon... and each time I didn't know what to do to "fix" @validate or to make recommendations based on what you and I worked through. Thanks for sharing your solution. I expect that ditching @va

Using Django Forms with Pylons (and a successor to @validate?)

2009-10-02 Thread Marcus Cavanaugh
ill want to use FormEncode, I included some code that lets you use FormEncode validation with django-style controller code (to replace @validate). I've thought about @validate for a long time now, and I don't think a decorator will ever give the flexibility we need; Django's idioms work e

Re: Difficulties with Pylons + tw.forms and @validate which returns AttributeError: 'function' object has no attribute 'replace'

2009-09-29 Thread cd34
as lucky, I picked up tw a while ago and so got the benefit of   > Alberto's correct docs: > > http://albertovalverde.es/tags/toscawidgets Had I copied your actual validate line rather than modifying mine, I probably would have seen this sooner. Thanks for the assistance. --~--~-

Re: Difficulties with Pylons + tw.forms and @validate which returns AttributeError: 'function' object has no attribute 'replace'

2009-09-28 Thread Graham Higgins
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 29 Sep 2009, at 07:04, cd34 wrote: > In order for the code to work properly by passing a function name to > error_handler in the decorator, I would need to change the above to: > >if error_handler: >environ = pylons.re

Re: Difficulties with Pylons + tw.forms and @validate which returns AttributeError: 'function' object has no attribute 'replace'

2009-09-28 Thread cd34
replacing: @validate(form=movie_form, error_handler=index) with: @validate(form=movie_form, error_handler='index') Allows validation to work as expected. Since error_handler as specified in the decorator is a function, it is rather obvious why it fails. file tw/mods/pylonshf.py (0

Re: Difficulties with Pylons + tw.forms and @validate which returns AttributeError: 'function' object has no attribute 'replace'

2009-09-28 Thread cd34
the test and the original virtualenv I had set up. out of curiosity, can you add this controller and template to a virtualenv and see if the code itself is right? templates/test_test.mako: ${tmpl_context.form()|n} controllers/test.py: from pylons import request, response, session, tmpl_co

Re: Difficulties with Pylons + tw.forms and @validate which returns AttributeError: 'function' object has no attribute 'replace'

2009-09-28 Thread cd34
On Sep 28, 7:49 pm, Graham Higgins wrote: > >> With this, and the code taken from toscawidget's tutorial > > which has explicitly: > > """ > In myapp/controllers/movie.py, add the following line: > > from tw.mods.pylonshf import validate which i

Re: Difficulties with Pylons + tw.forms and @validate which returns AttributeError: 'function' object has no attribute 'replace'

2009-09-28 Thread Graham Higgins
using, based on the reference to the toscawidgets tutorial ... >> With this, and the code taken from toscawidget's tutorial which has explicitly: """ In myapp/controllers/movie.py, add the following line: from tw.mods.pylonshf import validate Inside the RootController class,

Re: Difficulties with Pylons + tw.forms and @validate which returns AttributeError: 'function' object has no attribute 'replace'

2009-09-28 Thread Graham Higgins
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 28 Sep 2009, at 20:11, cd34 wrote: > $ cat ../lib/python2.5/site-packages/easy-install.pth I dunno if this helps but there seem to be three required libraries missing from that list. Check Pylons' setup.py for the list of install_requires a

Re: Difficulties with Pylons + tw.forms and @validate which returns AttributeError: 'function' object has no attribute 'replace'

2009-09-28 Thread Krishnakant
Just a quick curious question. Very sorry to take this off track a bit, but Can't we do validations using toscawidgets? Happy hacking. Krishnakant. On Mon, 2009-09-28 at 12:11 -0700, cd34 wrote: > On Sep 28, 2:29 pm, cd34 wrote: > > Going to install a new virtualenv -- though, this one was very

Re: Difficulties with Pylons + tw.forms and @validate which returns AttributeError: 'function' object has no attribute 'replace'

2009-09-28 Thread cd34
On Sep 28, 2:29 pm, cd34 wrote: > Going to install a new virtualenv -- though, this one was very > minimally changed, so, I'm not too hopeful. $ cat ../lib/python2.5/site-packages/easy-install.pth import sys; sys.__plen = len(sys.path) ./setuptools-0.6c9-py2.5.egg ./Pylons-0.9.7-py2.5.egg ./Temp

Re: Difficulties with Pylons + tw.forms and @validate which returns AttributeError: 'function' object has no attribute 'replace'

2009-09-28 Thread cd34
On Sep 27, 11:12 pm, Graham Higgins wrote: > http://bitbucket.org/gjhiggins/shabti/src/tip/shabti/templates/micros... > > (based on Pylons==0.9.7, ToscaWidgets>=0.9.4,   > tw.forms>=0.9.3dev-20090122) Downgraded toscawidgets to 0.9.4, tw.forms to 0.9.3, same issue with your code and my code. Wh

Re: Difficulties with Pylons + tw.forms and @validate which returns AttributeError: 'function' object has no attribute 'replace'

2009-09-27 Thread Mike Orr
On Sun, Sep 27, 2009 at 8:12 PM, Graham Higgins wrote: > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > > On 27 Sep 2009, at 22:35, cd34 wrote: > >> @validate(form=movie_form, error_handler=index) > > > Working example here: > > http://bit

Re: Difficulties with Pylons + tw.forms and @validate which returns AttributeError: 'function' object has no attribute 'replace'

2009-09-27 Thread Graham Higgins
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 27 Sep 2009, at 22:35, cd34 wrote: > @validate(form=movie_form, error_handler=index) Working example here: http://bitbucket.org/gjhiggins/shabti/src/tip/shabti/templates/microsite/+package+/controllers/pages.py_tmpl (based on Pylons==0.

Re: Difficulties with Pylons + tw.forms and @validate which returns AttributeError: 'function' object has no attribute 'replace'

2009-09-27 Thread cd34
On Sep 27, 3:48 pm, Mike Orr wrote: > >   �...@validate(movie_form, error_handler=index) modified to: @validate(form=movie_form, error_handler=index) as listed on the docs - I missed the form=, however, even with that, it doesn't change it. http://turbogears.org/2.0/docs/main/T

Re: Difficulties with Pylons + tw.forms and @validate which returns AttributeError: 'function' object has no attribute 'replace'

2009-09-27 Thread Mike Orr
TableForm('movie_form', action='save', children=[ ... > > class TestController(BaseController): > >    def index(self, **kw): >        tmpl_context.form = movie_form >        return render('/test_test.mako') > >   �...@validate(movie_form, error_ha

Difficulties with Pylons + tw.forms and @validate which returns AttributeError: 'function' object has no attribute 'replace'

2009-09-27 Thread cd34
ion/tw.forms/tutorials/validate_pylons.html, I've followed the tutorials, but, am running into an issue. The following controller: from pylons import request, response, session, tmpl_context from tw.mods.pylonshf import validate from cp.lib.base import BaseController, render import tw.form

Re: Does pylons populate the request object when @validate kicks in?

2009-07-03 Thread afrotypa
y able to figure this out by reading the validate decorator to see how it handles multiple selection fields like checkbox groups. I am not sure that this is readily documented. If someone would kindly confirm that this would be the right way to handle this scenario then perhaps we can consider documen

Re: Does pylons populate the request object when @validate kicks in?

2009-07-01 Thread afrotypa
Ah. So that explains why I didnt see a http request for re-generating the form!. Javascript will also work perhaps. My App already requires javascript anyhow. So javascript dependence is already a given and really is not an issue. I went with the other option though. So when validation fa

Re: Does pylons populate the request object when @validate kicks in?

2009-07-01 Thread afrotypa
Thanks. I found the try : validate pattern with manual form handling works quite well and offers great flexibility/control. And the specific example in the book is quite clear on how to accomplish that. On Jun 30, 12:06 pm, Isaac Csandl wrote: > This chapter of the pylons book has g

Re: Does pylons populate the request object when @validate kicks in?

2009-06-30 Thread Mike Orr
On Jun 29, 12:18 pm, afrotypa wrote: > I ran through the scenario again and did not see a 2nd http get to > 'edit' upon validation failure. I can verify that 'edit' was indeed > called though. See lines 160-161 in pylons/decorators/__init__.py: request.environ['pylons.routes_dict'

Re: Does pylons populate the request object when @validate kicks in?

2009-06-30 Thread Isaac Csandl
This chapter of the pylons book has good examples of manual form processing: http://bit.ly/15TMYd HTH --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylon

Re: Does pylons populate the request object when @validate kicks in?

2009-06-29 Thread afrotypa
quest.params) And the following log was generated from the 2nd call to get :- ### edit called!, params is UnicodeMultiDict([]) perhaps the specific validate options on save have caused this strange behaviour?. Anyhow I will follow the other suggestions on the correct usage of validate to remo

Re: Does pylons populate the request object when @validate kicks in?

2009-06-29 Thread afrotypa
owing :- 1. changes A's selection to 2 (this triggers an ajax update to B's options - changing the available options to 5 and 6) 2. Selects 6 on B 3. Makes no entry in text field C and attempts to submit the form. This causes a validation failure and when @validate kicks in the form will

Re: Does pylons populate the request object when @validate kicks in?

2009-06-26 Thread Mike Orr
On Fri, Jun 26, 2009 at 10:23 AM, Matt Feifarek wrote: > On Wed, Jun 24, 2009 at 11:08 AM, afrotypa wrote: >> >> @restrict('POST') >> @validate(schema=TestSchema(), form='edit', post_only=False, >> on_get=True) >> def save(self, id=None): &

Re: Does pylons populate the request object when @validate kicks in?

2009-06-26 Thread Matt Feifarek
On Wed, Jun 24, 2009 at 11:08 AM, afrotypa wrote: > > @restrict('POST') > @validate(schema=TestSchema(), form='edit', post_only=False, > on_get=True) > def save(self, id=None): > > I'm not following your full question, but right-off, I see a contradi

Re: Does pylons populate the request object when @validate kicks in?

2009-06-26 Thread Mike Orr
On Wed, Jun 24, 2009 at 9:08 AM, afrotypa wrote: > > Hi, > > I had a question about how @validate works > > Say you have /controller/edit > > which returns a form in a rendered template whose action is / > controller/save > > As well the save action has an @v

Re: Does pylons populate the request object when @validate kicks in?

2009-06-26 Thread afrotypa
ion fields) that depend on the actual form submission values following a validation failure?. Am I making any sense? On Jun 24, 12:08 pm, afrotypa wrote: > Hi, > > I had a question about how @validate works > > Say you have /controller/edit > > which returns a form in a re

Does pylons populate the request object when @validate kicks in?

2009-06-24 Thread afrotypa
Hi, I had a question about how @validate works Say you have /controller/edit which returns a form in a rendered template whose action is / controller/save As well the save action has an @validate decorator associated with edits submitted form i.e. :- @restrict('POST') @valid

KeyError on @validate failure after 0.9.7 upgrade

2009-03-09 Thread captsens
Hi folks I'm trying to upgrade an application from 0.9.6 to 0.9.7, and I'm stuck on the last bug. Whenever any of my formencode schemas cause validation to fail (via the @validate decorator on form POST), I lose all the request params when the request is redirected to my form disp

Re: 0.9.7 bug - no g in inherited templates when formerror parsing ( @validate decorator )

2009-02-22 Thread Jonathan Vanasco
actually, strike that. more testing and I found out that there was a stray entity the parser didn't like. sigh. sorry folks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this g

0.9.7 bug - no g in inherited templates when formerror parsing ( @validate decorator )

2009-02-22 Thread Jonathan Vanasco
figuring out what happened drove me crazy all day... this worked in 0.9.6 , but its broken in 0.9.7: if you fail an @validate test on a formencode form, you'll error out if you try to access a g variable in an inherited template g is available in the regular template. just not i

Re: @validate split - code!

2008-04-17 Thread Jonathan Vanasco
Cookbooked: http://wiki.pylonshq.com/display/pylonscookbook/Hacking+validate+into+a+split+functionality I did some 'namespace' caching to add rudimentary support for multiple forms, and defaulting to the 'last form'. i'm not sure if its necessary, but i like thi

Re: @validate split - code!

2008-04-16 Thread Mike Orr
say "writes pylons.c.foo", "reads pylons.c.foo". > in order to do this right, it would have to somehow stash > that cache with the classtype on the schema, so that a developer > doesn't validate a LoginForm then call an error with the > RegisterForm I

Re: @validate split - code!

2008-04-16 Thread Jonathan Vanasco
Mike- Any comments on this: http://pylonshq.com/pasties/775 sorry i killed the docstrings on that ;) now you can call validate_form( self, @validate args ) which returns true/false on form validation the main thing i don't like about my refactoring: it's using some caching t

Re: @validate split - code!

2008-04-16 Thread Jonathan Vanasco
h... i might take a stab at that tonight. the pylons team did all this great work on form validtation - it's almost silly that its hardcoded into a decorator to access it. it's awesome that pylons will validate my form via a decorator, but sometimes i just want to know if the form is

Re: @validate split - code!

2008-04-16 Thread Mike Orr
On Wed, Apr 16, 2008 at 3:52 PM, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > > I'm a little unclear on your goals, so the answer is yes and not > really. ;) > > This refactoring will let the form validate as a decorator, and then > allow you to cause an erro

Re: @validate split - code!

2008-04-16 Thread Jonathan Vanasco
I'm a little unclear on your goals, so the answer is yes and not really. ;) This refactoring will let the form validate as a decorator, and then allow you to cause an error within your pylons function @validate( blah ) def stuff( self ): # yay, form is valid if not record_in_database

Re: @validate split - code!

2008-04-16 Thread Mike Orr
One problem with @validate is the 'state' argument is useless unless you're passing data that's the same for every request -- in which case the data could be put in the validator itself and 'state' isn't needed. But some interesting validators depend on the cur

@validate split - code!

2008-04-16 Thread Jonathan Vanasco
I took a stab today at splitting @validate in two the code is pretty darn awful, but I'm hoping some people who are more familiar with pylons can help whip this up: a drop-in replacement for @validate is below , as is a new function validation_error the functionality is this: @validate

  1   2   >