Added guards against picking up non-ascii title and abstract from drafts submitted in xml form.
- Legacy-Id: 12429
This commit is contained in:
parent
1f1772a777
commit
9c9b15bec8
|
@ -5,6 +5,7 @@ import email
|
|||
import pytz
|
||||
import xml2rfc
|
||||
import tempfile
|
||||
from unidecode import unidecode
|
||||
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
|
@ -170,8 +171,12 @@ class SubmissionUploadForm(forms.Form):
|
|||
else:
|
||||
self.revision = None
|
||||
self.filename = draftname
|
||||
self.title = self.xmlroot.findtext('front/title')
|
||||
self.abstract = self.xmlroot.findtext('front/abstract')
|
||||
self.title = self.xmlroot.findtext('front/title').strip()
|
||||
if type(self.title) is unicode:
|
||||
self.title = unidecode(self.title)
|
||||
self.abstract = self.xmlroot.findtext('front/abstract').strip()
|
||||
if type(self.abstract) is unicode:
|
||||
self.abstract = unidecode(self.abstract)
|
||||
self.author_list = []
|
||||
author_info = self.xmlroot.findall('front/author')
|
||||
for author in author_info:
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="US-ASCII"?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" []>
|
||||
<?rfc toc="yes"?>
|
||||
<rfc category="info" docName="%(name)s" ipr="trust200902">
|
||||
<front>
|
||||
<title>Testing Tests</title>
|
||||
<title>Testing Tests</title>
|
||||
<author fullname="Author Name" initials="A." surname="Name">
|
||||
<organization>Test Centre Inc.</organization>
|
||||
|
||||
|
|
|
@ -796,7 +796,7 @@ class SubmitTests(TestCase):
|
|||
self.assertTrue(name in open(os.path.join(self.staging_dir, u"%s-%s.txt" % (name, rev))).read())
|
||||
self.assertTrue(os.path.exists(os.path.join(self.staging_dir, u"%s-%s.xml" % (name, rev))))
|
||||
self.assertTrue(name in open(os.path.join(self.staging_dir, u"%s-%s.xml" % (name, rev))).read())
|
||||
self.assertTrue('<?xml version="1.0" encoding="US-ASCII"?>' in open(os.path.join(self.staging_dir, u"%s-%s.xml" % (name, rev))).read())
|
||||
self.assertTrue('<?xml version="1.0" encoding="UTF-8"?>' in open(os.path.join(self.staging_dir, u"%s-%s.xml" % (name, rev))).read())
|
||||
self.assertTrue(os.path.exists(os.path.join(self.staging_dir, u"%s-%s.pdf" % (name, rev))))
|
||||
self.assertTrue('This is PDF' in open(os.path.join(self.staging_dir, u"%s-%s.pdf" % (name, rev))).read())
|
||||
self.assertTrue(os.path.exists(os.path.join(self.staging_dir, u"%s-%s.ps" % (name, rev))))
|
||||
|
|
Loading…
Reference in a new issue