# HG changeset patch # User paulb # Date 1128818772 0 # Node ID 2f5efdf824fa58ef1ee609fd7a664310b3ad1352 # Parent f2ecf7e14298f1b1cae3e18326fd5bc314fe913b [project @ 2005-10-09 00:46:12 by paulb] Added docstrings. diff -r f2ecf7e14298 -r 2f5efdf824fa XSLForms/Fields.py --- a/XSLForms/Fields.py Fri Oct 07 21:34:58 2005 +0000 +++ b/XSLForms/Fields.py Sun Oct 09 00:46:12 2005 +0000 @@ -347,29 +347,75 @@ "A collection of documents processed from form fields." def __init__(self, *args, **kw): + + """ + Initialise the form data container with the general 'args' and 'kw' + parameters. + """ + FieldProcessor.__init__(self, *args, **kw) self.parameters = {} self.documents = {} def set_parameters(self, parameters): + + "Set the request 'parameters' (or fields) in the container." + self.parameters = parameters self.documents = self.make_documents(self.parameters.items()) def get_parameters(self): + + """ + Get the request parameters (or fields) from the container. Note that + these parameters comprise the raw form field values submitted in a + request rather than the structured form data. + + Return a dictionary mapping parameter names to values. + """ + return self.parameters def get_documents(self): + + """ + Get the form data documents from the container, returning a dictionary + mapping document names to DOM-style document objects. + """ + return self.documents def get_selectors(self): + + """ + Get the form data selectors from the container, returning a dictionary + mapping selector names to collections of selected elements. + """ + return FieldProcessor.get_selectors(self, self.parameters.items(), self.documents) def new_instance(self, name): + + """ + Make a new document with the given 'name', storing it in the container + and returning the document. + """ + doc = FieldProcessor.new_instance(self, name) self.documents[name] = doc return doc + # An alias for the older method name. + + new_document = new_instance + def set_document(self, name, doc): + + """ + Store in the container under the given 'name' the supplied document + 'doc'. + """ + self.documents[name] = doc if __name__ == "__main__":