Hi,

I am using z3c.form, which is complicated but a lot more flexible than the old zope.formlib. Thanks for building it.


Currently, I am having a problem with the SequenceWidget. Let me illustrate the scenario: I have a search-form with batching of the results - the links for the pages of the search contain the search parameters and the action-key as GET-parameters like this "search.html?form.widgets.text=foo&form.buttons.search=1".

With "normal" Widgets, this works perfectly well. But when my search-form contains a SequenceWidget, this approach breaks, because SequenceWidget depends on zope-functionality in some other place, which transforms paramters with a key-postfix of ":list" to a list of values (the postfix is appended to the parameter-name by the template).

The part of my application, that builds the query-string for the batch does however not have any knowledge about the widget-type of the parameters (that's intentionally to limit the dependencies to the form implementation).

This problem would not exist, if the extract-method of SequenceWidget would contain two additional lines of code:

def extract(self, default=interfaces.NOVALUE):
       """See z3c.form.interfaces.IWidget."""
       if (self.name not in self.request and
           self.name+'-empty-marker' in self.request):
           return []
       value = self.request.get(self.name, default)
       if value != default:
>       if not isinstance(value, (list, tuple)):
> value = [value] for token in value:
               if token == self.noValueToken:
                   continue
               try:
                   self.terms.getTermByToken(token)
               except LookupError:
                   return default
       return value

I (hope I) can work around this problem by subclassing SequenceWidget and overwrite the extract method, but I wonder, if this fix introduces some unknown problems and whether it can be included in the standard implementation.

Thanks,

Mat

--
Dipl. Inf. Matthias Lehmann
Software- und Web-Development
Käthe-Kollwitz-Straße 6
99734 Nordhausen

fon:   +49 3631 470652
mobil: +49 170 5176774
eMail: [EMAIL PROTECTED]
web:   http://www.matlehmann.de

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to