diff --git a/opac/webapp/factory.py b/opac/webapp/factory.py index a37882d9..ee5b310d 100644 --- a/opac/webapp/factory.py +++ b/opac/webapp/factory.py @@ -237,6 +237,7 @@ def __init__(self, doc_id, issue_id=None): self.doc.htmls = None self.doc.pdfs = None self.doc.mat_suppl_items = None + self.doc.collabs = None def add_identifiers(self, v2, aop_pid, other_pids=None): # Identificadores @@ -458,6 +459,14 @@ def publish_document(self, created, updated, is_public): raise PublishDocumentError(e) return self.doc + def add_collab(self, name): + # collabs = EmbeddedDocumentListField(Collab) + if self.doc.collabs is None: + self.doc.collabs = [] + _collab = models.Collab() + _collab.name = name + self.doc.collabs.append(_collab) + def ArticleFactory( document_id: str, @@ -570,6 +579,11 @@ def ArticleFactory( # add_doi_with_lang(self, language, doi) # add_related_article(self, doi, ref_id, related_type) factory.publish_document(data.get("created"), data.get("updated"), data.get("is_public")) + + for item in data.get("collab") or []: + factory.add_collab( + name=item.get("name") + ) return article diff --git a/requirements.txt b/requirements.txt index b0959687..782fbe92 100644 --- a/requirements.txt +++ b/requirements.txt @@ -94,6 +94,6 @@ zope.interface==5.5.2 tox==4.3.5 PyJWT==2.8.0 tenacity==8.2.3 --e git+https://git@github.com/scieloorg/opac_schema@v2.8.1#egg=Opac_Schema +-e git+https://git@github.com/scieloorg/opac_schema@v2.9.0#egg=Opac_Schema -e git+https://git@github.com/scieloorg/packtools@4.5.0#egg=packtools -e git+https://github.com/scieloorg/scieloh5m5.git@1.9.5#egg=scieloh5m5