From 86aec0caf5025d6c0c4a95573df9c29232eb76e5 Mon Sep 17 00:00:00 2001 From: Jamil Atta Junior Date: Tue, 16 Aug 2016 14:22:58 -0300 Subject: [PATCH 1/8] =?UTF-8?q?Garantindo=20que=20as=20atualiza=C3=A7?= =?UTF-8?q?=C3=A3o=20de=20pip=20e=20setuptools=20sejam=20executadas=20ante?= =?UTF-8?q?s=20das=20depend=C3=AAncias=20e=20removendo=20params=20deprecad?= =?UTF-8?q?os.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 59bada67..f75105ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,12 @@ python: - 2.7 env: - DJANGO_VERSION=1.4 SCIELOMANAGER_SETTINGS_FILE=`pwd`/scielomanager/scielomanager/settings_local.include -install: +before_install: - pip install --upgrade pip - pip install --upgrade setuptools - - pip install -r requirements.txt --use-mirrors - - pip install -r requirements-test.txt --use-mirrors +install: + - pip install -r requirements.txt + - pip install -r requirements-test.txt before_script: - cp scielomanager/scielomanager/settings_local.include-TEMPLATE scielomanager/scielomanager/settings_local.include - psql -c 'create database journalmanager;' -U postgres From 23dfe16e0701014dd85bdf39b57e8dd03cab6082 Mon Sep 17 00:00:00 2001 From: fabiobatalha Date: Tue, 31 May 2016 10:54:58 -0300 Subject: [PATCH 2/8] =?UTF-8?q?Incluidos=20servi=C3=A7os=20Thirft=20para?= =?UTF-8?q?=20models=20Journal,=20Issue,=20Collection=20e=20EditorialBoard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scielomanager/thrift/__init__.py | 1 - scielomanager/thrift/scielomanager.thrift | 205 ++++++++++++- scielomanager/thrift/server.py | 277 +++++++++++++++++- .../tools/import_data/requirements.txt | 2 +- 4 files changed, 480 insertions(+), 5 deletions(-) diff --git a/scielomanager/thrift/__init__.py b/scielomanager/thrift/__init__.py index 31691b3a..3d452d0a 100644 --- a/scielomanager/thrift/__init__.py +++ b/scielomanager/thrift/__init__.py @@ -9,4 +9,3 @@ # data transfer objects and services build at runtime spec = thriftpy.load(os.path.join(HERE, 'scielomanager.thrift'), module_name='scielomanager_thrift') - diff --git a/scielomanager/thrift/scielomanager.thrift b/scielomanager/thrift/scielomanager.thrift index d5dd216d..d570630e 100644 --- a/scielomanager/thrift/scielomanager.thrift +++ b/scielomanager/thrift/scielomanager.thrift @@ -51,6 +51,10 @@ exception BadRequestError { exception TimeoutError { } +/* Recurso requerido não existe. */ +exception DoesNotExist { +} + /* * Representa a relação entre artigos. * @@ -90,6 +94,146 @@ struct Article { 17: optional list referrers; } +/* + * Collection representa um conjunto de metadados de um periódico. Os dados são + * compatíveis com o modelo de dados definidos em models.py entretanto apenas + * alguns metadados estão disponíveis. + * + */ + +struct Collection { + 1: optional i64 id; + 2: required string name; + 3: optional string name_slug; + 4: optional string url; + 5: required string acronym; + 6: optional string country; + 7: optional string state; + 8: optional string city; + 9: optional string address; + 10: optional string address_number; + 11: optional string address_complement; + 12: optional string zip_code; + 13: optional string phone; + 14: optional string fax; + 15: optional string email; + 16: optional list journals; +} + +struct UseLicense { + 1: required string license_code; + 2: optional string reference_url; + 3: optional string disclaimer; + 4: required bool is_default; +} + +struct JournalMission { + 1: optional string language; + 2: optional string description; +} + +/* + * Journal representa um conjunto de metadados de um periódico. Os dados são + * compatíveis com o modelo de dados definidos em models.py entretanto apenas + * alguns metadados estão disponíveis. + * + */ + +struct Journal { + 1: optional i64 id; + 2: required string title; + 3: required string title_iso; + 4: optional string short_title; + 5: optional string medline_title; + 6: optional string medline_code; + 7: optional string twitter_user; + 8: required list study_areas; + 9: required list subject_categories; + 10: required UseLicense use_license; + 11: optional string created; + 12: optional string updated; + 13: required string acronym; + 14: required string scielo_issn; + 15: optional string print_issn; + 16: optional string electronic_issn; + 17: optional string frequency; + 18: optional string copyrighter; + 19: optional string url_online_submission; + 20: optional string url_journal; + 21: optional string notes; + 22: optional bool is_trashed; + 23: optional bool is_indexed_scie; + 24: optional bool is_indexed_ssci; + 25: optional bool is_indexed_aehci; + 26: optional list missions; + 27: optional list issues; + 28: optional list collections; +} + +/* + * EditorialBoardMember representa os dados de um membro de um corpo editorial. + * Os dados são compatíveis com o modelo de dados definidos em models.py + * entretanto apenas alguns metadados estão disponíveis através. + * + */ + +struct EditorialBoardMember { + 1: optional string first_name; + 2: optional string last_name; + 3: optional string city; + 4: optional string country; + 5: optional string state; + 6: optional string email; + 7: optional string research_id; + 8: optional string orcid; + 9: optional string link_cv; + 10: optional string role; + 11: optional i64 order; + 12: optional string institution; +} + +/* + * IssueTitle representa o título de um fascículo em um idioma específico. Os + * dados são compatíveis com o modelo de dados definidos em models.py entretanto + * apenas alguns metadados estão disponíveis através. + * + */ + +struct IssueTitle { + 1: optional string language; + 2: optional string title; +} + +/* + * Issue representa um conjunto de metadados de um fascículo. Os dados são + * compatíveis com o modelo de dados definidos em models.py entretanto apenas + * alguns metadados estão disponíveis. + * + */ + + struct Issue { + 1: optional i64 id; + 2: optional Journal journal; + 3: optional string volume; + 4: optional string number; + 5: optional string created; + 6: optional string updated; + 7: optional i64 publication_start_month; + 8: optional i64 publication_end_month; + 9: optional i64 publication_year; + 10: optional string publication_date; + 11: optional UseLicense use_license; + 12: optional string label; + 13: optional i64 order; + 14: required string type; + 15: optional string suppl_text; + 16: optional string spe_text; + 17: optional string identification; + 18: optional list issue_title; + 19: optional list articles; + 20: optional list editorial_board; + } + /* * ScanArticlesResults representa um lote de entidades Article, retornado * após uma consulta por meio da função ScanArticles. @@ -190,5 +334,64 @@ service JournalManagerServices { * Obtém a versão da interface Thrift do servidor. */ string getInterfaceVersion(); -} + /* + * Obtém metadados de periódicos. + * + * Os resultados são representados pela struct `Journal`. + * + */ + + Journal getJournal(1:i64 journal_id) throws (1:ServerError srv_err, + 2:BadRequestError req_err, 3:DoesNotExist match_err); + + /* + * Obtém metadados de fascículos. + * + * Os resultados são representados pela struct `Issue`. + * + */ + + Issue getIssue(1:i64 issue_id) throws (1:ServerError srv_err, + 2:BadRequestError req_err, 3:DoesNotExist match_err); + + /* + * Obtém metadados de fascículos. + * + * Os resultados são representados pela struct `Issue`. + * + */ + + Collection getCollection(1:i64 collection_id) throws (1:ServerError srv_err, + 2:BadRequestError req_err, 3:DoesNotExist match_err); + + /* + * Obtém lista de periódicos de uma coleção ou de todo o catálogo. + * + * Os resultados são representados por uma lista instâncias de struct + * `Journal`. + * + */ + + list getJournals(1: optional i64 collection_id, 2: optional string from_date, 3: optional string until_date, 4: i32 limit, 5: i32 offset) throws (1:ServerError srv_err, 2:BadRequestError req_err) + + /* + * Obtém lista de fascículos de um periódico ou de todo o catálogo. + * + * Os resultados são representados por uma lista instâncias de struct + * `Issue`. + * + */ + + list getIssues(1: optional i64 journal_id, 2: optional string from_date, 3: optional string until_date, 4: i32 limit, 5: i32 offset) throws (1:ServerError srv_err, 2:BadRequestError req_err) + + /* + * Obtém lista de coleções do catálogo. + * + * Os resultados são representados por uma lista instâncias de struct + * `Collection`. + * + */ + + list getCollections(1: optional string from_date, 2: optional string until_date, 3: i32 limit, 4: i32 offset) throws (1:ServerError srv_err, 2:BadRequestError req_err) +} diff --git a/scielomanager/thrift/server.py b/scielomanager/thrift/server.py index aada6cd4..20e76c24 100644 --- a/scielomanager/thrift/server.py +++ b/scielomanager/thrift/server.py @@ -1,6 +1,7 @@ #coding: utf-8 import logging import json +import datetime from django.db import close_connection from celery.result import AsyncResult @@ -8,11 +9,15 @@ from journalmanager import tasks from thrift import spec from scielomanager import connectors - +from journalmanager.models import Journal, Issue, Collection +from editorialmanager.models import EditorialBoard +from django.core.exceptions import ObjectDoesNotExist LOGGER = logging.getLogger(__name__) ARTICLE_ES_CLIENT = connectors.ArticleElasticsearch() +TODAY = datetime.datetime.now().isoformat()[:10] +LIMIT = 100 ERRNO_NS = { 'IntegrityError': 1, @@ -37,7 +42,8 @@ def wrapper(*args, **kwargs): def article_from_es(data): - """ Get an instance of `spec.Article` from Elasticsearch datastructure. + """ + Get an instance of `spec.Article` from Elasticsearch datastructure. """ article = spec.Article(abbrev_journal_title=data.get('abbrev_journal_title'), @@ -57,6 +63,175 @@ def article_from_es(data): return article +def journal_mission_from_model(data): + + journal_mission = spec.JournalMission( + language=data.language.iso_code, + description=data.description + + ) + + return journal_mission + + +def use_license_from_model(data): + + use_license = spec.UseLicense( + license_code=data.license_code, + reference_url=data.reference_url, + disclaimer=data.disclaimer, + is_default=data.is_default + + ) + + return use_license + + +def collection_from_model(data): + """ + Get an instance of `spec.Collection` from models.collection instance. + """ + + try: + journals = data.journal_set.all() + except ObjectDoesNotExist: + journals = [] + + collection = spec.Collection( + id=data.pk, + name=data.name, + name_slug=data.name_slug, + url=data.url, + acronym=data.acronym, + country=data.country, + state=data.state, + city=data.city, + address=data.address, + address_number=data.address_number, + address_complement=data.address_complement, + zip_code=data.zip_code, + phone=data.phone, + fax=data.fax, + email=data.email, + journals=[i.pk for i in journals] + ) + + return collection + + +def journal_from_model(data): + """ + Get an instance of `spec.Journal` from models.journal instance. + """ + + journal = spec.Journal( + id=data.pk, + title=data.title, + title_iso=data.title_iso, + short_title=data.short_title, + medline_title=data.medline_title, + medline_code=data.medline_code, + twitter_user=data.twitter_user, + study_areas=[i.study_area for i in data.study_areas.all()], + subject_categories=[i.term for i in data.subject_categories.all()], + use_license=use_license_from_model(data.use_license), + created=data.created.isoformat(), + updated=data.updated.isoformat(), + acronym=data.acronym, + scielo_issn=data.scielo_pid, + print_issn=data.print_issn, + electronic_issn=data.eletronic_issn, + frequency=data.frequency, + copyrighter=data.copyrighter, + url_online_submission=data.url_online_submission, + url_journal=data.url_journal, + notes=data.notes, + is_trashed=data.is_trashed, + is_indexed_scie=data.is_indexed_scie, + is_indexed_ssci=data.is_indexed_ssci, + is_indexed_aehci=data.is_indexed_aehci, + missions=[journal_mission_from_model(i) for i in data.missions.all()], + issues=[i.pk for i in data.issue_set.all()] + ) + + return journal + + +def issue_title_from_model(data): + + issue_title = spec.IssueTitle( + language=data.language.iso_code, + title=data.title + ) + + return issue_title + + +def editorial_board_member_from_model(data): + """ + Get an instance of `spec.EditorialBoardMember` from + models.editorial_members instance. + """ + + editorial_board_member = spec.EditorialBoardMember( + first_name=data.first_name, + last_name=data.last_name, + city=data.city, + country=data.country.code, + state=data.state, + email=data.email, + research_id=data.research_id, + orcid=data.orcid, + link_cv=data.link_cv, + role=data.role.name, + order=data.order, + institution=data.institution + ) + + return editorial_board_member + + +def issue_from_model(data): + """ + Get an instance of `spec.Issue` from models.issue instance. + """ + + try: + eb = data.editorialboard.editorialmember_set.all() + except ObjectDoesNotExist: + eb = [] + + try: + it = data.issuetitle_set.all() + except ObjectDoesNotExist: + it = [] + + issue = spec.Issue( + id=data.pk, + journal=journal_from_model(data.journal), + volume=data.volume, + number=data.number, + created=data.created.isoformat(), + updated=data.updated.isoformat(), + publication_start_month=data.publication_start_month, + publication_end_month=data.publication_end_month, + publication_year=data.publication_year, + publication_date=str(data.publication_date), + use_license=use_license_from_model(data.use_license), + label=data.label, + order=data.order, + type=data.type, + suppl_text=data.suppl_text, + spe_text=data.spe_text, + identification=data.identification, + issue_title=[issue_title_from_model(i) for i in it], + articles=[i.aid for i in data.articles.all()], + editorial_board=[editorial_board_member_from_model(i) for i in eb] + ) + + return issue + + class RPCHandler(object): """Implementação do serviço `JournalManagerServices`. """ @@ -155,3 +330,101 @@ def addArticleAsset(self, aid, filename, content, meta): LOGGER.exception(exc) raise spec.ServerError() + def getJournal(self, journal_id): + + try: + data = Journal.objects.get(pk=journal_id) + return journal_from_model(data) + except Journal.DoesNotExist: + raise spec.DoesNotExist() + except Exception as exc: + LOGGER.ServerError(exc) + raise spec.Server() + + def getIssue(self, issue_id): + + try: + data = Issue.objects.get(pk=issue_id) + return issue_from_model(data) + except Issue.DoesNotExist: + raise spec.DoesNotExist() + except Exception as exc: + LOGGER.ServerError(exc) + raise spec.Server() + + def getCollection(self, collection_id): + + try: + data = Collection.objects.get(pk=collection_id) + return collection_from_model(data) + except Collection.DoesNotExist: + raise spec.DoesNotExist() + except Exception as exc: + LOGGER.ServerError(exc) + raise spec.Server() + + def getJournals(self, collection_id, from_date, until_date, limit, offset): + query = {} + limit = limit or LIMIT + offset = offset or 0 + + if from_date or until_date: + from_date = from_date or '0001-01-01' + until_date = until_date or TODAY + query = { + "created__range": [from_date, until_date] + } + + if collection_id: + query['collections__pk'] = collection_id + + try: + data = [journal_from_model(i) for i in Journal.objects.filter(**query)[offset:offset+limit]] + except Exception as exc: + LOGGER.ServerError(exc) + raise spec.Server() + + return data + + def getIssues(self, journal_id, from_date, until_date, limit, offset): + query = {} + limit = limit or LIMIT + offset = offset or 0 + + if from_date or until_date: + from_date = from_date or '0001-01-01' + until_date = until_date or TODAY + query = { + "created__range": [from_date, until_date] + } + + if journal_id: + query['journal__pk'] = journal_id + + try: + data = [issue_from_model(i) for i in Issue.objects.filter(**query)[offset:offset+limit]] + except Exception as exc: + LOGGER.ServerError(exc) + raise spec.Server() + + return data + + def getCollections(self, from_date, until_date, limit, offset): + query = {} + limit = limit or LIMIT + offset = offset or 0 + + if from_date or until_date: + from_date = from_date or '0001-01-01' + until_date = until_date or TODAY + query = { + "created__range": [from_date, until_date] + } + + try: + data = [collection_from_model(i) for i in Collection.objects.filter(**query)[offset:offset+limit]] + except Exception as exc: + LOGGER.ServerError(exc) + raise spec.Server() + + return data \ No newline at end of file diff --git a/scielomanager/tools/import_data/requirements.txt b/scielomanager/tools/import_data/requirements.txt index 140618af..e9d6d5ef 100644 --- a/scielomanager/tools/import_data/requirements.txt +++ b/scielomanager/tools/import_data/requirements.txt @@ -1 +1 @@ --e git+https://github.com/scieloorg/xylose@1.2.3#egg=xylose +-e git+https://github.com/scieloorg/xylose@1.3.4#egg=xylose From f8cf76913341ff7d9a640f9be6e1c166b3cd9a9e Mon Sep 17 00:00:00 2001 From: fabiobatalha Date: Mon, 13 Jun 2016 11:27:39 -0300 Subject: [PATCH 3/8] =?UTF-8?q?Inclu=C3=ADdo=20Timeline=20ao=20Journal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scielomanager/thrift/scielomanager.thrift | 9 +++++- scielomanager/thrift/server.py | 34 ++++++++++++++++++++--- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/scielomanager/thrift/scielomanager.thrift b/scielomanager/thrift/scielomanager.thrift index d570630e..e32344c5 100644 --- a/scielomanager/thrift/scielomanager.thrift +++ b/scielomanager/thrift/scielomanager.thrift @@ -132,6 +132,12 @@ struct JournalMission { 2: optional string description; } +struct JournalTimeline { + 1: required string since; + 2: required string status; + 3: optional string reason; +} + /* * Journal representa um conjunto de metadados de um periódico. Os dados são * compatíveis com o modelo de dados definidos em models.py entretanto apenas @@ -168,6 +174,7 @@ struct Journal { 26: optional list missions; 27: optional list issues; 28: optional list collections; + 29: optional list timeline; } /* @@ -342,7 +349,7 @@ service JournalManagerServices { * */ - Journal getJournal(1:i64 journal_id) throws (1:ServerError srv_err, + Journal getJournal(1:i64 journal_id, 2: optional i64 collection_id) throws (1:ServerError srv_err, 2:BadRequestError req_err, 3:DoesNotExist match_err); /* diff --git a/scielomanager/thrift/server.py b/scielomanager/thrift/server.py index 20e76c24..2db5ae79 100644 --- a/scielomanager/thrift/server.py +++ b/scielomanager/thrift/server.py @@ -9,7 +9,7 @@ from journalmanager import tasks from thrift import spec from scielomanager import connectors -from journalmanager.models import Journal, Issue, Collection +from journalmanager.models import Journal, Issue, Collection, JournalTimeline from editorialmanager.models import EditorialBoard from django.core.exceptions import ObjectDoesNotExist @@ -232,6 +232,22 @@ def issue_from_model(data): return issue +def journal_timeline_from_model(jtl): + + timeline = [] + + for item in jtl: + timeline.append( + spec.JournalTimeline( + since=item.since.isoformat(), + status=item.status, + reason=item.reason + ) + ) + + return timeline + + class RPCHandler(object): """Implementação do serviço `JournalManagerServices`. """ @@ -330,17 +346,27 @@ def addArticleAsset(self, aid, filename, content, meta): LOGGER.exception(exc) raise spec.ServerError() - def getJournal(self, journal_id): + def getJournal(self, journal_id, collection_id=None): try: - data = Journal.objects.get(pk=journal_id) - return journal_from_model(data) + journal_model = Journal.objects.get(pk=journal_id) + journal_struct = journal_from_model(journal_model) except Journal.DoesNotExist: raise spec.DoesNotExist() except Exception as exc: LOGGER.ServerError(exc) raise spec.Server() + journal_struct.timeline = [] + + if collection_id: + jtl_model = JournalTimeline.objects.filter( + journal=journal_model, collection=collection_id).order_by('since') + + journal_struct.timeline = journal_timeline_from_model(jtl_model) + + return journal_struct + def getIssue(self, issue_id): try: From 795df7d970c0fbd5c08707fc2954df220c60c619 Mon Sep 17 00:00:00 2001 From: fabiobatalha Date: Wed, 22 Jun 2016 13:48:59 -0300 Subject: [PATCH 4/8] =?UTF-8?q?Ajustes=20em=20vers=C3=A3o=20do=20thrift?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scielomanager/thrift/scielomanager.thrift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scielomanager/thrift/scielomanager.thrift b/scielomanager/thrift/scielomanager.thrift index e32344c5..23c8c4cb 100644 --- a/scielomanager/thrift/scielomanager.thrift +++ b/scielomanager/thrift/scielomanager.thrift @@ -31,7 +31,7 @@ namespace py scielomanager * IMPORTANTE! Alterar o valor de VERSION após qualquer alteração na interface. * Regras em: http://semver.org/lang/pt-BR/ */ -const string VERSION = "2.0.0" +const string VERSION = "2.1.0" # From b0777ea64f83b1674634dd119e3d30407bbcbc8c Mon Sep 17 00:00:00 2001 From: fabiobatalha Date: Mon, 18 Jul 2016 16:08:11 -0300 Subject: [PATCH 5/8] Ajustes em rpc_services --- scielomanager/thrift/server.py | 28 +++++++++---------- .../tools/import_data/requirements.txt | 2 +- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/scielomanager/thrift/server.py b/scielomanager/thrift/server.py index 2db5ae79..29458bee 100644 --- a/scielomanager/thrift/server.py +++ b/scielomanager/thrift/server.py @@ -16,7 +16,6 @@ LOGGER = logging.getLogger(__name__) ARTICLE_ES_CLIENT = connectors.ArticleElasticsearch() -TODAY = datetime.datetime.now().isoformat()[:10] LIMIT = 100 ERRNO_NS = { @@ -355,7 +354,7 @@ def getJournal(self, journal_id, collection_id=None): raise spec.DoesNotExist() except Exception as exc: LOGGER.ServerError(exc) - raise spec.Server() + raise spec.ServerError() journal_struct.timeline = [] @@ -376,7 +375,7 @@ def getIssue(self, issue_id): raise spec.DoesNotExist() except Exception as exc: LOGGER.ServerError(exc) - raise spec.Server() + raise spec.ServerError() def getCollection(self, collection_id): @@ -387,16 +386,16 @@ def getCollection(self, collection_id): raise spec.DoesNotExist() except Exception as exc: LOGGER.ServerError(exc) - raise spec.Server() + raise spec.ServerError() - def getJournals(self, collection_id, from_date, until_date, limit, offset): + def getJournals(self, collection_id, from_date=None, until_date=None, limit=None, offset=None): query = {} limit = limit or LIMIT offset = offset or 0 if from_date or until_date: from_date = from_date or '0001-01-01' - until_date = until_date or TODAY + until_date = until_date or datetime.datetime.now().isoformat()[:10] query = { "created__range": [from_date, until_date] } @@ -408,18 +407,18 @@ def getJournals(self, collection_id, from_date, until_date, limit, offset): data = [journal_from_model(i) for i in Journal.objects.filter(**query)[offset:offset+limit]] except Exception as exc: LOGGER.ServerError(exc) - raise spec.Server() + raise spec.ServerError() return data - def getIssues(self, journal_id, from_date, until_date, limit, offset): + def getIssues(self, journal_id, from_date=None, until_date=None, limit=None, offset=None): query = {} limit = limit or LIMIT offset = offset or 0 if from_date or until_date: from_date = from_date or '0001-01-01' - until_date = until_date or TODAY + until_date = until_date or datetime.datetime.now().isoformat()[:10] query = { "created__range": [from_date, until_date] } @@ -431,18 +430,17 @@ def getIssues(self, journal_id, from_date, until_date, limit, offset): data = [issue_from_model(i) for i in Issue.objects.filter(**query)[offset:offset+limit]] except Exception as exc: LOGGER.ServerError(exc) - raise spec.Server() + raise spec.ServerError() return data - def getCollections(self, from_date, until_date, limit, offset): + def getCollections(self, from_date=None, until_date=None, limit=None, offset=None): query = {} limit = limit or LIMIT offset = offset or 0 - if from_date or until_date: from_date = from_date or '0001-01-01' - until_date = until_date or TODAY + until_date = until_date or datetime.datetime.now().isoformat()[:10] query = { "created__range": [from_date, until_date] } @@ -451,6 +449,6 @@ def getCollections(self, from_date, until_date, limit, offset): data = [collection_from_model(i) for i in Collection.objects.filter(**query)[offset:offset+limit]] except Exception as exc: LOGGER.ServerError(exc) - raise spec.Server() + raise spec.ServerError() - return data \ No newline at end of file + return data diff --git a/scielomanager/tools/import_data/requirements.txt b/scielomanager/tools/import_data/requirements.txt index e9d6d5ef..33b24515 100644 --- a/scielomanager/tools/import_data/requirements.txt +++ b/scielomanager/tools/import_data/requirements.txt @@ -1 +1 @@ --e git+https://github.com/scieloorg/xylose@1.3.4#egg=xylose +-e git+https://github.com/scieloorg/xylose@1.7.5#egg=xylose From 5922b96a1e0e8233c4f0cca52190bae941d9236a Mon Sep 17 00:00:00 2001 From: Gustavo Fonseca Date: Tue, 16 Aug 2016 18:42:55 -0300 Subject: [PATCH 6/8] =?UTF-8?q?Corrige=20o=20coment=C3=A1rio=20logo=20acim?= =?UTF-8?q?a=20da=20struct=20Collection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scielomanager/thrift/scielomanager.thrift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scielomanager/thrift/scielomanager.thrift b/scielomanager/thrift/scielomanager.thrift index 23c8c4cb..497c0214 100644 --- a/scielomanager/thrift/scielomanager.thrift +++ b/scielomanager/thrift/scielomanager.thrift @@ -95,7 +95,7 @@ struct Article { } /* - * Collection representa um conjunto de metadados de um periódico. Os dados são + * Collection representa um conjunto de metadados de uma coleção. Os dados são * compatíveis com o modelo de dados definidos em models.py entretanto apenas * alguns metadados estão disponíveis. * From ee7752b496d25811e63d76df204f4c51013a32a6 Mon Sep 17 00:00:00 2001 From: Jamil Atta Junior Date: Wed, 24 Aug 2016 15:48:16 -0300 Subject: [PATCH 7/8] Tornando alguns labels traduziveis :-() --- .../templates/board/role_type_translate.html | 2 + .../includes/journal_detail_info.html | 2 +- .../templates/journal/edit_journal.html | 2 + scielomanager/journalmanager/choices.py | 10 +- scielomanager/journalmanager/forms.py | 17 +- scielomanager/journalmanager/models.py | 8 +- .../templates/journalmanager/add_issue.html | 2 + .../templates/journalmanager/add_journal.html | 4 + .../journalmanager/add_pressrelease.html | 4 + .../templates/journalmanager/add_section.html | 2 + .../templates/journalmanager/add_sponsor.html | 2 + .../templates/journalmanager/add_user.html | 2 + .../includes/form_field_row.html | 5 +- .../locale/en_US/LC_MESSAGES/django.po | 788 +++++------ .../locale/es_ES/LC_MESSAGES/django.po | 1220 ++++++++++------- .../locale/pt_BR/LC_MESSAGES/django.po | 905 ++++++------ 16 files changed, 1584 insertions(+), 1391 deletions(-) diff --git a/scielomanager/editorialmanager/templates/board/role_type_translate.html b/scielomanager/editorialmanager/templates/board/role_type_translate.html index 9b35c724..e1cb5383 100644 --- a/scielomanager/editorialmanager/templates/board/role_type_translate.html +++ b/scielomanager/editorialmanager/templates/board/role_type_translate.html @@ -96,6 +96,8 @@

$('#{{ formset.prefix }} tbody tr input').addClass('span12'); //multiple-formsets $('#{{ formset.prefix }} tbody tr').formset({ + addText: "{% trans 'add another' %}", + deleteText: "{% trans 'remove' %}", formCssClass: 'dynamic-{{ formset.prefix }}-form', prefix: '{{ formset.prefix }}' }); diff --git a/scielomanager/editorialmanager/templates/includes/journal_detail_info.html b/scielomanager/editorialmanager/templates/includes/journal_detail_info.html index f7b60345..33ab25e6 100644 --- a/scielomanager/editorialmanager/templates/includes/journal_detail_info.html +++ b/scielomanager/editorialmanager/templates/includes/journal_detail_info.html @@ -21,7 +21,7 @@

{{ journal.title }}

{{ journal.collections.all|join:', ' }}
  • - Download full board as CSV file + {% trans 'Download full board as CSV file' %}
  • {% modal 'Journal Details' %} diff --git a/scielomanager/editorialmanager/templates/journal/edit_journal.html b/scielomanager/editorialmanager/templates/journal/edit_journal.html index 080f02cc..1392af68 100644 --- a/scielomanager/editorialmanager/templates/journal/edit_journal.html +++ b/scielomanager/editorialmanager/templates/journal/edit_journal.html @@ -138,6 +138,8 @@

    {% trans "Editor" %}: