* refactor: Update parsers/base.py for Python3 * style: Black * refactor: Remove mime type check from FileParser * refactor: Validate that submission is UTF-8 The mime check distinguished us-ascii from UTF-8, but as far as I can tell the code relying on it treated both as equally valid. * feat: Clear error when file is not valid XML * chore: Remove unused import * test: Update tests to match changes * fix: Count bytes starting from 1 * test: Add tests of FileParser validations * fix: Fix / simplify regexp * test: Test error caused by bad XML submission --------- Co-authored-by: Robert Sparks <rjsparks@nostrum.com>
13 lines
312 B
Python
13 lines
312 B
Python
from ietf.submit.parsers.base import FileParser
|
|
|
|
|
|
class XMLParser(FileParser):
|
|
ext = 'xml'
|
|
|
|
# If some error is found after this method invocation
|
|
# no other file parsing is recommended
|
|
def critical_parse(self):
|
|
super(XMLParser, self).critical_parse()
|
|
return self.parsed_info
|
|
|