File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -272,8 +272,18 @@ def save_draft_info(self, draft):
272272 )
273273 order = 0
274274 for author in draft .get_authors ():
275- name , email = author .rsplit (' ' , 1 )
276- first_name , last_name = name .split (' ' , 1 )
275+ try :
276+ name , email = author .rsplit (' ' , 1 )
277+ except ValueError :
278+ first_name = author
279+ last_name = ''
280+ email = ''
281+ else :
282+ try :
283+ first_name , last_name = name .split (' ' , 1 )
284+ except ValueError :
285+ first_name = name
286+ last_name = ''
277287 email = email .replace ('<' , '' ).replace ('>' , '' )
278288 order += 1
279289 TempIdAuthors .objects .create (
Original file line number Diff line number Diff line change @@ -166,6 +166,16 @@ def validate_revision(self):
166166 def validate_authors (self ):
167167 if not self .authors :
168168 self .add_warning ('authors' , 'No authors found' )
169+ return
170+ index = 1
171+ message = ''
172+ for author in self .authors :
173+ if not author .last_name :
174+ message += 'Author %s has no last name<br />' % index
175+ if not author .email :
176+ message += 'Author %s has no email<br />' % index
177+ if message :
178+ self .add_warning ('authors' , message )
169179
170180 def validate_creation_date (self ):
171181 date = self .draft .creation_date
Original file line number Diff line number Diff line change @@ -152,11 +152,12 @@ <h3>Meta-Data errors found</h3>
152152< tr > < th > File size</ th > < td > {{ detail.filesize|filesizeformat }}</ td > </ tr >
153153< tr {% if validation.warnings.creation_date %} class ="warning "{% endif %} > < th > Creation date</ th > < td > {{ detail.creation_date }}< div class ="warn_message "> {{ validation.warnings.creation_date }}</ div > </ td > </ tr >
154154< tr {% if validation.warnings.authors %} class ="warning "{% endif %} > < th colspan ="2 "> Author(s) information</ th > </ tr >
155- {% if not validation.authors %}
156- < tr class ="warning "> < td colspan ="2 "> < div class ="warn_message "> {{ validation.warning.authors }}</ div > </ td > </ tr >
157- {% else %}
155+ {% if validation.warnings.authors %}
156+ < tr class ="warning "> < td colspan ="2 "> < div class ="warn_message "> {{ validation.warnings.authors|safe }}</ div > </ td > </ tr >
157+ {% endif %}
158+ {% if validation.authors %}
158159{% for author in validation.authors %}
159- < tr > < th class ="author "> Author {{ forloop.counter }}</ th > < td > {{ author.email.0 }} <{{ author.email.1 }}></ td > </ tr >
160+ < tr {% if validation.warnings.authors %} class =" warning " {% endif %} > < th class ="author "> Author {{ forloop.counter }}</ th > < td > {{ author.email.0 }} <{{ author.email.1 }}></ td > </ tr >
160161{% endfor %}
161162{% endif %}
162163< tr {% if validation.warnings.pages %} class ="warning "{% endif %} > < th > Pages</ th > < td > {{ detail.txt_page_count }}< div class ="warn_message "> {{ validation.warnings.pages }}</ div > </ td > </ tr >
You can’t perform that action at this time.
0 commit comments