MoinForms

Change of MoinForms.py

5:8fe065e89206
MoinForms.py
     1.1 --- a/MoinForms.py	Sun Dec 02 00:40:22 2012 +0100
     1.2 +++ b/MoinForms.py	Sun Dec 02 00:54:15 2012 +0100
     1.3 @@ -115,6 +115,30 @@
     1.4              max_index = -1
     1.5              section[name] = {0 : placeholder}
     1.6  
     1.7 +# Form and field information.
     1.8 +
     1.9 +def getFieldArguments(field_definition):
    1.10 +
    1.11 +    "Return the parsed arguments from the given 'field_definition' string."
    1.12 +
    1.13 +    field_args = {}
    1.14 +
    1.15 +    for field_arg in field_definition.split():
    1.16 +
    1.17 +        # Record the key-value details.
    1.18 +
    1.19 +        try:
    1.20 +            argname, argvalue = field_arg.split("=", 1)
    1.21 +            field_args[argname] = argvalue
    1.22 +
    1.23 +        # Single keywords are interpreted as type descriptions.
    1.24 +
    1.25 +        except ValueError:
    1.26 +            if not field_args.has_key("type"):
    1.27 +                field_args["type"] = field_arg
    1.28 +
    1.29 +    return field_args
    1.30 +
    1.31  # Common formatting functions.
    1.32  
    1.33  def formatForm(text, request, fmt, attrs=None, write=None):