# HG changeset patch # User paulb # Date 1103814457 0 # Node ID caf1d0ae25e55ad3cb9bc48e0bb759da7bdedb4c # Parent af075ff8b78e2258faa5ef383f5ffaef8566f113 [project @ 2004-12-23 15:07:37 by paulb] Added notes about supporting multivalued fields. diff -r af075ff8b78e -r caf1d0ae25e5 XSLForms/Fields.py --- a/XSLForms/Fields.py Wed Dec 22 00:40:24 2004 +0000 +++ b/XSLForms/Fields.py Thu Dec 23 15:07:37 2004 +0000 @@ -1,6 +1,11 @@ #!/usr/bin/env python """ +NOTE: Add support for multiple values from fields, perhaps using +NOTE: the following notation: +NOTE: +NOTE: /package#1/categories#1/category#n/value + Classes which process field collections, producing instance documents. Each field entry consists of a field name mapped to a string value, where the field name may have the following @@ -73,16 +78,6 @@ if model_name is None: continue - # Convert from lists if necessary. - - if self.values_are_lists: - value = value[0] - - # Convert the value to Unicode if necessary. - - if type(value) == type(""): - value = unicode(value, encoding=self.encoding) - # Get a new instance document if none has been made for the # model. @@ -95,6 +90,17 @@ for component in components: t = component.split(Constants.pair_separator) if len(t) == 1: + + # Convert from lists if necessary. + + if self.values_are_lists: + value = value[0] + + # Convert the value to Unicode if necessary. + + if type(value) == type(""): + value = unicode(value, encoding=self.encoding) + node.setAttributeNS(EMPTY_NAMESPACE, t[0], value) break