1.1 --- a/MoinForms.py Thu Nov 07 19:55:56 2013 +0100
1.2 +++ b/MoinForms.py Thu Nov 07 23:26:32 2013 +0100
1.3 @@ -349,7 +349,16 @@
1.4 submission 'number', returning the metadata headers and field structure.
1.5 """
1.6
1.7 - f = StringIO(store[number])
1.8 + return loadFieldsFromString(store[number])
1.9 +
1.10 +def loadFieldsFromString(s):
1.11 +
1.12 + """
1.13 + Load the fields from the given string 's', returning the metadata headers
1.14 + and field structure.
1.15 + """
1.16 +
1.17 + f = StringIO(s)
1.18
1.19 headers = []
1.20 lines = []
1.21 @@ -369,7 +378,8 @@
1.22
1.23 if text:
1.24 for line in lines:
1.25 - headers.append(line.strip().split(":", 1))
1.26 + name, value = [s.strip() for s in line.split(":", 1)]
1.27 + headers.append((name, value))
1.28
1.29 # Otherwise, rewind to obtain the entire item text for field data.
1.30
1.31 @@ -548,6 +558,10 @@
1.32 acl = self.handler.getSubpageACL()
1.33 item = acl.getString() + item
1.34
1.35 + # Add a format header to the page for parsers to use.
1.36 +
1.37 + item = "#FORMAT formdata\n" + item
1.38 +
1.39 ItemStoreBase.append(self, item)
1.40
1.41 def __getitem__(self, number):