Revision 58295
Added by Sandro La Bruzzo over 4 years ago
modules/dli-api/branches/ES_7/v1/responseModel.py | ||
---|---|---|
59 | 59 |
result = item.__dict__['_d_'] |
60 | 60 |
result['linkProvider'] = result.pop('linkprovider') |
61 | 61 |
if 'creator' in result['source']: |
62 |
result['source']['creators']=result['source'].pop('creator') |
|
62 |
result['source']['creators']=result['source'].pop('creator')
|
|
63 | 63 |
result['source'].pop('objectSubType') |
64 |
|
|
65 | 64 |
result['source']['identifiers']=result['source'].pop('identifier') |
66 | 65 |
result['source']['objectProvider'] = [s['provider'] for s in result['source'].get('collectedFrom',[])] |
66 |
if result['source']['publisher'] is not None: |
|
67 |
result['source']['publisher'] = [x for x in result['source']['publisher'] if x.get('name') is not None] |
|
68 |
|
|
69 |
|
|
70 |
|
|
67 | 71 |
if 'creator' in result['target']: |
68 | 72 |
result['target']['creators']=result['target'].pop('creator') |
73 |
result['target'].pop('objectSubType') |
|
69 | 74 |
result['target']['identifiers']=result['target'].pop('identifier') |
75 |
if result['target']['publisher'] is not None: |
|
76 |
result['target']['publisher'] = [x for x in result['target']['publisher'] if x.get('name') is not None] |
|
70 | 77 |
if 'collectedFrom' in result['target']: |
71 | 78 |
result['target']['objectProvider'] = [s['provider'] for s in result['target'].get('collectedFrom',[])] |
72 | 79 |
else: |
modules/dli-api/branches/ES_7/v2/responseModel.py | ||
---|---|---|
59 | 59 |
IDURL:str= None |
60 | 60 |
|
61 | 61 |
class ScholixProviderType(BaseModel): |
62 |
name:str |
|
62 |
name:str = None
|
|
63 | 63 |
identifier:List[IdentifierType] = [] |
64 | 64 |
|
65 | 65 |
class RelationshipType(BaseModel): |
66 | 66 |
Name:str |
67 |
SubType:str |
|
67 |
SubType:str = None
|
|
68 | 68 |
SubTypeSchema:str = None |
69 | 69 |
|
70 | 70 |
class CreatorType(BaseModel): |
... | ... | |
116 | 116 |
publicationDate = item.publicationDate |
117 | 117 |
publisher = [] |
118 | 118 |
if 'publisher' in item and item.publisher is not None: |
119 |
publisher = [dict(name= x.name) for x in item.publisher] |
|
119 |
publisher = [dict(name= x.name) for x in item.publisher if x.name is not None]
|
|
120 | 120 |
c_type = item.objectType |
121 | 121 |
if item.objectType == 'publication': |
122 | 122 |
c_type = 'literature' |
Also available in: Unified diff
fixed bug of null publisher