Skip to content

Commit

Permalink
Merge pull request #917 from marwoodandrew/SDAAP-94
Browse files Browse the repository at this point in the history
[SDAAP-94] Change the byline for PR images
  • Loading branch information
marwoodandrew authored Sep 19, 2023
2 parents 2e9d667 + fda3124 commit 99c21d6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/aap_mm/aap_mm_datalayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ def _set_byline(self, out_doc, in_doc):
:return:
"""
if in_doc.get('Credit', '').upper().startswith('AAP'):
out_doc['byline'] = titlecase(in_doc.get('Byline', '')) + '/AAP PHOTOS'
out_doc['byline'] = titlecase(in_doc.get('Byline', '')) + '/AAP PHOTOS' if in_doc.get(
'Byline') else 'AAP PHOTOS'
elif in_doc.get('Credit', '').upper().startswith('PR HANDOUT'):
out_doc['byline'] = 'HANDOUT/' + in_doc.get('Source', '')
else:
out_doc['byline'] = in_doc.get('Credit', '').upper() + ' PHOTO'

Expand Down Expand Up @@ -302,7 +305,7 @@ def _datetime(self, string):
try:
dt = datetime.datetime.strptime(string[0:19] + string[19:25].replace(':', ''),
'%Y-%m-%dT%H:%M:%S%z').astimezone(pytz.utc)
except:
except BaseException:
dt = utcnow()
return dt

Expand Down

0 comments on commit 99c21d6

Please sign in to comment.