Skip to content

Commit

Permalink
Import Belga biographies into Superdesk [SDBELGA-623] (#385)
Browse files Browse the repository at this point in the history
* Import Belga biographies into Superdesk [SDBELGA-623]

* Address comment
  • Loading branch information
GyanP authored and petrjasek committed Mar 18, 2022
1 parent 3947104 commit 2200d17
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions server/belga/io/feed_parsers/belga_newsml_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,17 +622,17 @@ def parse_administrativemetadata(self, item, admin_el):

self.parse_sources(item, admin_el)

signoff_list = []
for element in admin_el.findall('Creator/Party'):
if element is not None and element.get('FormalName'):
author_name = element.get('FormalName', '').replace(' ', '')
item['sign_off'] = author_name
_sign_off = author_name = element.get('FormalName', '').replace(' ', '')
_topic = element.get('Topic', '')
author = {
'name': author_name,
'role': element.get('Topic', ''),
'sub_label': element.get('Topic', '')
'_id': [_topic], 'name': _topic, 'role': _topic,
'sub_label': author_name
}
# try to find an author in DB
user = get_resource_service('users').find_one(req=None, username=author['name'])
user = get_resource_service('users').find_one(req=None, username=author_name)
if user:
author['_id'] = [
str(user['_id']),
Expand All @@ -642,10 +642,14 @@ def parse_administrativemetadata(self, item, admin_el):
author['parent'] = str(user['_id'])
author['name'] = author['role']
if user.get('sign_off'):
item['sign_off'] = user['sign_off']
_sign_off = user['sign_off']

signoff_list.append(_sign_off)
item.setdefault('authors', []).append(author)

if signoff_list:
item["sign_off"] = "/".join(signoff_list)

element = admin_el.find('Contributor/Party')
if element is not None and element.get('FormalName'):
item['administrative']['contributor'] = element.get('FormalName')
Expand Down

0 comments on commit 2200d17

Please sign in to comment.