On May 16, 2007, at 7:51 AM, Graham Stratton wrote:
> > Hi all, > > I see there's discussion about the issues with the @validate decorator > in the tracker. I've come across a few problems myself in the last > few weeks, so hopefully I can contribute here: > > - In order to use multiple fields, you need to set variable_decode to > True. This is probably fair enough, and it probably ought to be the > default. It does have other side effects for field names containing > '-' or '.' Making variable_decode True by default is certainly not a > backwards-compatible change. > > - In order to use htmlfill with multiples, params also needs to be > mapped from a MultiDict. At present htmlfill called from the decorator > only selects the first value for fields with multiple values. I think > this can be fixed by passing decoded instead of params to htmlfill. > > - It's worth noting that line 98 tests for the type of params, and if > it is a UnicodeMultiDict decodes the page to unicode. So any playing > around with params needs to preserve its type. This doesn't feel > right to me. > > - Specifying separate validators (as opposed to a schema) fails if no > value is passed for a multiple. I suspect that line 90: > > validator.to_python(decoded[field] or None) > > should read > > validator.to_python(decoded.get(field, None)) > All these minus the htmlfill with multiples should be taken care of in trunk r2005. I am even passing the result of MultiDict.mixed() to htmlfill now as opposed to passing the MultiDict itself. But as I said in another email, that doesn't get htmlfill working with non variable_decode style multiples. -- Philip Jenvey --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
