Merge pull request #730 from Gluejar/protect-long-descriptions

protect long descriptions
pull/46/head
eshellman 2017-12-11 13:46:23 -05:00 committed by GitHub
commit 82d7bf20b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -908,11 +908,16 @@ class BasePandataLoader(object):
) )
if metadata.publisher: #always believe yaml if metadata.publisher: #always believe yaml
edition.set_publisher(metadata.publisher) edition.set_publisher(metadata.publisher)
if metadata.publication_date: #always believe yaml if metadata.publication_date: #always believe yaml
edition.publication_date = metadata.publication_date edition.publication_date = metadata.publication_date
#be careful about overwriting the work description
if metadata.description and len(metadata.description) > len(work.description): if metadata.description and len(metadata.description) > len(work.description):
#be careful about overwriting the work description # don't over-write reasonably long descriptions
work.description = metadata.description if len(work.description) < 500:
work.description = metadata.description
if metadata.creator and not edition.authors.count(): if metadata.creator and not edition.authors.count():
edition.authors.clear() edition.authors.clear()
for key in metadata.creator.keys(): for key in metadata.creator.keys():