From fda3124f3c962aa9a6310bb4cbaf5051778fb69b Mon Sep 17 00:00:00 2001 From: marwoodandrew Date: Mon, 18 Sep 2023 11:01:03 +1000 Subject: [PATCH] [SDAAP-94] Change the byline for PR images --- server/aap_mm/aap_mm_datalayer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/aap_mm/aap_mm_datalayer.py b/server/aap_mm/aap_mm_datalayer.py index 71a79793b..477e23966 100644 --- a/server/aap_mm/aap_mm_datalayer.py +++ b/server/aap_mm/aap_mm_datalayer.py @@ -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' @@ -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