Re: Repeating elements and htmlfill

2010-01-11 Thread Mike Orr
On Mon, Jan 11, 2010 at 7:07 PM, Chris wrote: > FormEncode is great too, but also seems more complex.  I often find > myself wondering if I'm sub-classing the right thing or overriding the > right methods in my custom validators.  For example, when subclassing > FormValidator, you override .valida

Re: Repeating elements and htmlfill

2010-01-11 Thread Chris
I've used wtforms a little and I think it is pretty great. Code base is very clean and small and it also offers an immediate alternative to @validate (and htmlfill). It does include html generation through python class-based widgets (vs mako style widgets), but it still lends ample flexibility wh

Re: Repeating elements and htmlfill

2010-01-10 Thread Mike Orr
On Sun, Jan 10, 2010 at 3:27 PM, Chris wrote: > One more alternative I forgot to mention about form handling: > http://marcuscavanaugh.com/posts/pylons-django-forms/ A few people have mentioned using django.forms with Pylons and have been pleased with it. There's another project WTForms which is

Re: Repeating elements and htmlfill

2010-01-10 Thread Chris
One more alternative I forgot to mention about form handling: http://marcuscavanaugh.com/posts/pylons-django-forms/ On Jan 9, 1:18 am, Mike Burrows wrote: > Thanks again Mike and everyone - this has been a very informative > thread. > > > You'd have to ask on the FormEncode list for this.  I a

Re: Repeating elements and htmlfill

2010-01-08 Thread Mike Burrows
Thanks again Mike and everyone - this has been a very informative thread. > You'd have to ask on the FormEncode list for this. I agree they'd be > useful defaults. Right - I will follow up with them, > > [also: routes.Mapper(..., explicit=True); mapper.minimization=False - > > where the framew

Re: Repeating elements and htmlfill

2010-01-08 Thread Mike Orr
On Thu, Jan 7, 2010 at 6:12 AM, Mike Burrows (asplake) wrote: > > While we're removing cruft, how often do people NOT need the first two > members below?  As previously mentioned I'd like to get that last one > for free too. > > class BaseSchema(formencode.Schema): >    """ >    Base form schema >

Re: Repeating elements and htmlfill

2010-01-08 Thread Mike Orr
A lot of things to comment on. On Thu, Jan 7, 2010 at 10:35 PM, Chris wrote: > I think a lot of folks have ended up writing their own @validate > decorator to suit their needs (I have as well).  I think there is a > new one scheduled for 1.0. It's been postponed till after 1.0 because otherwise

Re: Repeating elements and htmlfill

2010-01-08 Thread Mike Burrows (asplake)
Thank you Chris for the pointer - it looks very good on a quick read and I will study it properly. On Jan 8, 7:35 am, Chris wrote: > Mike, > I think a lot of folks have ended up writing their own @validate > decorator to suit their needs (I have as well).  I think there is a > new one scheduled

Re: Repeating elements and htmlfill

2010-01-07 Thread Chris
Mike, I think a lot of folks have ended up writing their own @validate decorator to suit their needs (I have as well). I think there is a new one scheduled for 1.0. I've moved away from htmlfill in favor of a technique Mike Bayer blogged about here: http://techspot.zzzeek.org/?p=28 I use Bayer's

Re: Repeating elements and htmlfill

2010-01-07 Thread Mike Burrows (asplake)
Make that if v and not k.endswith('--repetitions')) to remove empty values that for some reason get placed by htmlfill at the top of the page and do weird things to page layout! In case it wasn't obvious, the helper assumes a "from formencode import variabledecode" Mike On

Re: Repeating elements and htmlfill

2010-01-07 Thread Mike Burrows (asplake)
Right. And you could easily do additional validation without having to wrap it up in a FancyValidator or whatever. I may go this way myself. On Jan 7, 3:11 pm, "Brian O'Connor" wrote: > I meant to reply to this a little bit sooner.  I had a solution that isn't > amazingly elegant, but works, a

Re: Repeating elements and htmlfill

2010-01-07 Thread Mike Burrows (asplake)
While we're removing cruft, how often do people NOT need the first two members below? As previously mentioned I'd like to get that last one for free too. class BaseSchema(formencode.Schema): """ Base form schema """ allow_extra_fields = True filter_extra_fields = True pre

Re: Repeating elements and htmlfill

2010-01-07 Thread Brian O'Connor
I meant to reply to this a little bit sooner. I had a solution that isn't amazingly elegant, but works, and supports javascript addition of arbitrary number of elements. I do not use the @validate decorator. This was originally designed for a newspaper website to add n number of authors to an ar

Re: Repeating elements and htmlfill

2010-01-07 Thread Mike Burrows (asplake)
Perhaps you're right - maybe @validate is more trouble than it is worth. I have discovered that it doesn't handle repeating elements properly: it negelects to flatten the errors dict. I worked around this issue in a fill_render() helper which I use to render my forms: def fill_render(template_n

Re: Repeating elements and htmlfill

2009-12-23 Thread Ian Wilson
On Wed, Dec 23, 2009 at 8:26 PM, Mike Orr wrote: > On Wed, Dec 23, 2009 at 3:58 AM, Mike Burrows (asplake) > wrote: >> I'm far too new to Pylons to feel confident enough to contribute >> documentation but I have linked to a few of my blog posts here.  I >> don't see too many others doing the same

Re: Repeating elements and htmlfill

2009-12-23 Thread Mike Orr
On Wed, Dec 23, 2009 at 3:58 AM, Mike Burrows (asplake) wrote: > I'm far too new to Pylons to feel confident enough to contribute > documentation but I have linked to a few of my blog posts here.  I > don't see too many others doing the same though, so I have to wonder > about etiquette. Is this t

Re: Repeating elements and htmlfill

2009-12-23 Thread Wyatt Baldwin
On Dec 23, 3:58 am, "Mike Burrows (asplake)" wrote: > I'm far too new to Pylons to feel confident enough to contribute > documentation but I have linked to a few of my blog posts here.  I > don't see too many others doing the same though, so I have to wonder > about etiquette. Is this to be encour

Re: Repeating elements and htmlfill

2009-12-23 Thread Mike Burrows (asplake)
I'm far too new to Pylons to feel confident enough to contribute documentation but I have linked to a few of my blog posts here. I don't see too many others doing the same though, so I have to wonder about etiquette. Is this to be encouraged? And who is blogging regularly about Pylons? The most

Re: Repeating elements and htmlfill

2009-12-22 Thread Mark
I wish there was more resources for Pylons. I'm having the same problem grasping the concepts of Pylons. I also ran into the same problem at work...It's so irritating. On Nov 6, 3:28 pm, "Mike Burrows (asplake)" wrote: > Hi Chris, > > Having got stuck with the basics of populating and validatin

Re: Repeating elements and htmlfill

2009-11-05 Thread Mike Burrows (asplake)
Hi Chris, Having got stuck with the basics of populating and validating the form, I haven't got round to adding rows (dynamically or otherwise). I think I've got my head sufficiently around the book example to implement it now but I may yet decide to take the Javascript option. Meanwhile, I just

Re: Repeating elements and htmlfill

2009-11-03 Thread Mike Burrows (asplake)
Thanks, variable_encode did the trick. Makes one wonder why this (and NestedVariables) can't be there by default though - it would make for a much smaller gap between the easy, documented examples and the real world! All it would take is an enanced render method and perhaps a subclass of Schema.

Re: Repeating elements and htmlfill

2009-11-02 Thread Mike Burrows (asplake)
On Nov 2, 8:32 pm, Ian Wilson wrote: > Yeah as far as I know it does not work like that for the first case. > You need to preprocess your defaults with > formencode.variabledecode.variable_encode() to change the first case > into the second case. Thanks Ian, I'll look into that tomorrow. > I'

Re: Repeating elements and htmlfill

2009-11-02 Thread Ian Wilson
Yeah as far as I know it does not work like that for the first case. You need to preprocess your defaults with formencode.variabledecode.variable_encode() to change the first case into the second case. I'm still working on a good repetitions example, are you using javascript? You should look at

Repeating elements and htmlfill

2009-11-02 Thread Mike Burrows (asplake)
Hi, htmlfill.render() doesn't seem to handle repeating elements as I expect. I've boiled my code down to this example: import formencode.htmlfill as htmlfill template = '' print htmlfill.render(template, defaults={'weightings': [{'weight': 1.0}]}) print htmlfill.render(template,