You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changed draft submission field validation taking place in clean() to associate the errors with the field in question, rather than raising them as general form errors.
raiseforms.ValidationError('Unexpected submission file types; found %s, but %s is required'% (', '.join(self.file_types), ' or '.join(self.base_formats)))
163
+
ifnotself.errors:
164
+
raiseforms.ValidationError('Unexpected submission file types; found %s, but %s is required'% (', '.join(self.file_types), ' or '.join(self.base_formats)))
164
165
165
166
#debug.show('self.cleaned_data["xml"]')
166
167
ifself.cleaned_data.get('xml'):
@@ -187,14 +188,14 @@ def format_messages(where, e, log):
187
188
self.xmlroot=self.xmltree.getroot()
188
189
xml_version=self.xmlroot.get('version', '2')
189
190
exceptExceptionase:
190
-
raiseforms.ValidationError("An exception occurred when trying to [arse the XML file: %s"%e)
191
+
self.add_error('xml', "An exception occurred when trying to parse the XML file: %s"%e)
191
192
192
193
draftname=self.xmlroot.attrib.get('docName')
193
194
ifdraftnameisNone:
194
-
raiseforms.ValidationError("No docName attribute found in the xml root element")
195
+
self.add_error('xml', "No docName attribute found in the xml root element")
195
196
name_error=validate_submission_name(draftname)
196
197
ifname_error:
197
-
raiseforms.ValidationError(name_error)
198
+
self.add_error('xml', name_error)
198
199
revmatch=re.search("-[0-9][0-9]$", draftname)
199
200
ifrevmatch:
200
201
self.revision=draftname[-2:]
@@ -230,10 +231,10 @@ def format_messages(where, e, log):
230
231
prep.options.accept_prepped=True
231
232
self.xmltree.tree=prep.prep()
232
233
ifself.xmltree.tree==None:
233
-
raiseforms.ValidationError("Error from xml2rfc (prep): %s"%prep.errors)
234
+
self.add_error('xml', "Error from xml2rfc (prep): %s"%prep.errors)
0 commit comments