From 5f00017757d3f2fa3e942f9c49cc636f66e7a35a Mon Sep 17 00:00:00 2001 From: Aman Jain Date: Mon, 20 Mar 2017 13:33:48 +0530 Subject: [PATCH 01/13] records: typo fix Signed-off-by: Aman Jain --- zenodo/modules/records/serializers/bibtex.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zenodo/modules/records/serializers/bibtex.py b/zenodo/modules/records/serializers/bibtex.py index 50a2f7103..59fdaef53 100644 --- a/zenodo/modules/records/serializers/bibtex.py +++ b/zenodo/modules/records/serializers/bibtex.py @@ -65,14 +65,14 @@ class MissingRequiredFieldError(Exception): """Base class for exceptions in this module. The exception should be raised when the specific, - required filed doesn't exist in the record. + required field doesn't exist in the record. """ def _init_(self, field): self.field = field def _str_(self): - return "Missing filed: " + self.field + return "Missing field: " + self.field class Bibtex(object): From 1dae13b12c1fa59cfed3040da51aa3708a2e3f9e Mon Sep 17 00:00:00 2001 From: dosydon Date: Sun, 2 Apr 2017 01:26:29 +0900 Subject: [PATCH 02/13] records: addition of venue bibtex field to conference papers * Adds serialization and test for 'venue' field in inproceedings (Addresses #855) Signed-off-by: Shuwa Miura --- tests/unit/records/test_bibtex_serializer.py | 24 ++++++++++++++++++++ zenodo/modules/records/serializers/bibtex.py | 11 ++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/tests/unit/records/test_bibtex_serializer.py b/tests/unit/records/test_bibtex_serializer.py index f7b1cf612..e76e4fe69 100644 --- a/tests/unit/records/test_bibtex_serializer.py +++ b/tests/unit/records/test_bibtex_serializer.py @@ -302,6 +302,8 @@ def test_format_inproceedings(full_record): """ address = {Staszkowka},\n""" """ month = feb,\n""" """ note = {notes},\n""" + """ venue = """ + """{Harvard-Smithsonian Center for Astrophysics},\n""" """ doi = {10.1234/foo.bar},\n""" """ url = {https://doi.org/10.1234/foo.bar}\n""" """}""") @@ -322,6 +324,8 @@ def test_format_inproceedings(full_record): """ address = {Staszkowka},\n""" """ month = feb,\n""" """ note = {notes},\n""" + """ venue = """ + """{Harvard-Smithsonian Center for Astrophysics},\n""" """ doi = {10.1234/foo.bar},\n""" """ url = {https://doi.org/10.1234/foo.bar}\n""" """}""") @@ -329,6 +333,26 @@ def test_format_inproceedings(full_record): del full_record['imprint'] full_record['part_of']['publisher'] = "hello" + bibtex = ("""@inproceedings{doe_2014_12345,\n""" + """ author = {Doe, John and\n""" + """ Doe, Jane and\n""" + """ Smith, John and\n""" + """ Nowak, Jack},\n""" + """ title = {Test title},\n""" + """ booktitle = {Bum},\n""" + """ year = 2014,\n""" + """ pages = 30,\n""" + """ publisher = {hello},\n""" + """ month = feb,\n""" + """ note = {notes},\n""" + """ venue = """ + """{Harvard-Smithsonian Center for Astrophysics},\n""" + """ doi = {10.1234/foo.bar},\n""" + """ url = {https://doi.org/10.1234/foo.bar}\n""" + """}""") + assert bibtex == Bibtex(full_record).format() + + del full_record['meeting'] bibtex = ("""@inproceedings{doe_2014_12345,\n""" """ author = {Doe, John and\n""" """ Doe, Jane and\n""" diff --git a/zenodo/modules/records/serializers/bibtex.py b/zenodo/modules/records/serializers/bibtex.py index 59fdaef53..f68c889e1 100644 --- a/zenodo/modules/records/serializers/bibtex.py +++ b/zenodo/modules/records/serializers/bibtex.py @@ -199,7 +199,7 @@ def _format_inproceedings(self): """ name = "inproceedings" req_fields = ['author', 'title', 'booktitle', 'year'] - opt_fields = ['pages', 'publisher', 'address', 'month', 'note'] + opt_fields = ['pages', 'publisher', 'address', 'month', 'note', 'venue'] ign_fields = ['doi', 'url'] return self._format_entry(name, req_fields, opt_fields, ign_fields) @@ -269,6 +269,7 @@ def _fetch_fields(self, req_fields, opt_fields=None, ign_fields=None): 'school': self._get_school, 'title': self._get_title, 'url': self._get_url, + 'venue': self._get_venue, 'volume': self._get_volume, 'year': self._get_year, 'doi': self._get_doi @@ -476,6 +477,14 @@ def _get_url(self): return "https://doi.org/%s" % self.record['doi'] \ if "doi" in self.record else "" + def _get_venue(self): + """Return conference's venue.""" + if "meeting" in self.record and\ + "place" in self.record["meeting"]: + return self.record["meeting"]["place"] + else: + return "" + def _get_volume(self): """Return the volume of a journal or multi-volume book.""" return self.record.get("journal", {}).get("volume", "") From 85d7e43aa693727a45773760a172725908f8f377 Mon Sep 17 00:00:00 2001 From: Xiao Meng Date: Mon, 3 Apr 2017 00:39:24 -0700 Subject: [PATCH 03/13] docs: typos fix in the development guide --- docs/development/guide.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/development/guide.rst b/docs/development/guide.rst index 74b62400d..5ca54c641 100644 --- a/docs/development/guide.rst +++ b/docs/development/guide.rst @@ -43,15 +43,15 @@ Uninstall the installed PyPI version of the module and install the local one: .. note:: The ``-e`` flag in the ``pip install`` is important for the development. - This way the module will be installed in "editable" mode, meaning that - you will be able edit the code in directly in - ``~/src/invenio-communities``, and have the changes be immediately + This way, the module will be installed in the "editable" mode, meaning that + you will be able to edit the code directly in + ``~/src/invenio-communities``, and have the changes immediately available in the installed library inside the virtual environment. If you now restart the Zenodo application, the relevant ``invenio_communities`` module code should be executed from the locally stored repository in ``~/src/invenio-communities/``. -If you now change the code in ~/src/invenio-communities/ the changes +If you now change the code in ``~/src/invenio-communities/``, the changes should be propagated to the Zenodo application. .. note:: @@ -60,20 +60,20 @@ should be propagated to the Zenodo application. module, it's usually much newer version than the release (PyPI) version. This means that if the Zenodo-specified version of the module (see `setup.py `_) is far behind the master branch, you can expect some incompatibilities - or strange behaviour. + or strange behaviours. Making a contribution ~~~~~~~~~~~~~~~~~~~~~ If the feature you've implemented involves only the changes in Zenodo repository, you will only need to create one PR to Zenodo. If the changes -involve also any of the Invenio modules, you will also have to create a PR in +also involve any Invenio modules, you will also have to create a PR in that corresponding Invenio repository on GitHub. The recommended way to create a PR is to first fork the repository on GitHub (both Zenodo and Invenio repositories), push the changes to your fork's -feature branch and create a PR on GitHub against -``[upstream-repository]:[master]`` and ``[your-fork]:[feature-branch]`` +feature branch ``[your-fork]:[feature-branch]`` and create a PR on GitHub against +``[upstream-repository]:[master]``. In the Zenodo PR, please refer to any relevant Invenio PR on which it depends so the Zenodo reviewers can also review the Invenio PR changes. From c58795acf8be9a05e12f6aad1f3a93f29198d13b Mon Sep 17 00:00:00 2001 From: Xiao Meng Date: Mon, 3 Apr 2017 12:41:50 -0700 Subject: [PATCH 04/13] docs: add notes for Mac and Windows users. --- INSTALL.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/INSTALL.rst b/INSTALL.rst index c0c37a229..45e8a9cc3 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -228,6 +228,22 @@ Create the database and Elasticsearch indices in a new shell session: $ workon zenodo (zenodo)$ ./scripts/init.sh +.. note:: + + Here we assume all four services (db, es, mp, cache) are bound to + localhost. If you fail to connect those services, it is likely + you are running docker through ``docker-machine`` and those services are + bound to other IP addresses. In this case, you can redirect localhost ports + to docker ports as follows. + + ``ssh -L 6379:localhost:6379 -L 5432:localhost:5432 -L 9200:localhost:9200 -L 5672:localhost:5672 docker@$(docker-machine ip)`` + + The problems usually occur among Mac and Windows users. A better solution + is to install the native apps `Docker for Mac `_ + or `Docker for Windows `_ + (available since Docker v1.12) if possible, + which binds docker to localhost by default. + Demo records ~~~~~~~~~~~~ Next, load some demo data (licenses, funders, grants, records). From f992887391e027f9b18b85bc334a3eaeb421312d Mon Sep 17 00:00:00 2001 From: Xiao Meng Date: Mon, 3 Apr 2017 13:02:40 -0700 Subject: [PATCH 05/13] docs: mention the location of config.py --- INSTALL.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.rst b/INSTALL.rst index 45e8a9cc3..ca4db1bcc 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -231,7 +231,7 @@ Create the database and Elasticsearch indices in a new shell session: .. note:: Here we assume all four services (db, es, mp, cache) are bound to - localhost. If you fail to connect those services, it is likely + localhost (see ``zenodo/config.py``). If you fail to connect those services, it is likely you are running docker through ``docker-machine`` and those services are bound to other IP addresses. In this case, you can redirect localhost ports to docker ports as follows. From 66928cf06f6b90aa97dee1bef036b534cf465d43 Mon Sep 17 00:00:00 2001 From: Xiao Meng Date: Mon, 3 Apr 2017 13:17:46 -0700 Subject: [PATCH 06/13] docs: minor changes. --- INSTALL.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.rst b/INSTALL.rst index ca4db1bcc..09ff77347 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -238,7 +238,7 @@ Create the database and Elasticsearch indices in a new shell session: ``ssh -L 6379:localhost:6379 -L 5432:localhost:5432 -L 9200:localhost:9200 -L 5672:localhost:5672 docker@$(docker-machine ip)`` - The problems usually occur among Mac and Windows users. A better solution + The problem usually occurs among Mac and Windows users. A better solution is to install the native apps `Docker for Mac `_ or `Docker for Windows `_ (available since Docker v1.12) if possible, From 9fb728bb9a0bc5aed2dbb25d6ac40fdc43e36bf3 Mon Sep 17 00:00:00 2001 From: Lars Holm Nielsen Date: Tue, 4 Apr 2017 15:55:54 +0200 Subject: [PATCH 07/13] scripts: reindexing fix * Fixes issue with reindexing not taking deleted records into account. (closes #1016) --- scripts/index.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/index.sh b/scripts/index.sh index a0e5ea0f1..3fb1d8d70 100755 --- a/scripts/index.sh +++ b/scripts/index.sh @@ -22,5 +22,8 @@ # waive the privileges and immunities granted to it by virtue of its status # as an Intergovernmental Organization or submit itself to any jurisdiction. -zenodo index reindex +zenodo migration reindex -t recid +zenodo migration reindex -t frdoi +zenodo migration reindex -t od_lic +zenodo migration reindex -t grant zenodo index run -c 4 -d From d19d9ee2d44270575e436da3e5c2ee40573a215d Mon Sep 17 00:00:00 2001 From: Alexander Ioannidis Date: Tue, 18 Apr 2017 18:00:14 +0200 Subject: [PATCH 08/13] docker: fix ElasticHQ installation issue Signed-off-by: Alexander Ioannidis --- docker/es/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/es/Dockerfile b/docker/es/Dockerfile index 8de08dcc5..450bcc8bd 100644 --- a/docker/es/Dockerfile +++ b/docker/es/Dockerfile @@ -1,3 +1,3 @@ FROM elasticsearch:2.3 -RUN plugin install royrusso/elasticsearch-HQ/2.0.3 +RUN plugin install royrusso/elasticsearch-HQ/v2.0.3 RUN plugin install mapper-attachments From 89b0b8c979390087c6ab873693233aede36b87b6 Mon Sep 17 00:00:00 2001 From: Alexander Ioannidis Date: Thu, 20 Apr 2017 15:05:31 +0200 Subject: [PATCH 09/13] docker: remove read_only from rabbitmq * Fixes issue with container creation for newer versions of the rabbitmq docker image. Signed-off-by: Alexander Ioannidis --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9dbe4ff2a..8e8685e68 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -113,7 +113,6 @@ mq: ports: - "15672:15672" - "5672:5672" - read_only: true es: build: ./docker/es/ restart: "always" From 501d2d8fb1f89d5a192657b1ca59920bfa1e010e Mon Sep 17 00:00:00 2001 From: Lars Holm Nielsen Date: Tue, 2 May 2017 09:57:21 +0200 Subject: [PATCH 10/13] records: citation fixes * Fixes issue with software having "[dataset]" in the default ciation. Based on discussion with CSL developers, the best is to use article for software instead of dataset as then the type is not included in the citation. * Fixes issue with reports not having a DOI in the default APA citation. (closes #1074) Signed-off-by: Lars Holm Nielsen --- zenodo/modules/records/data/objecttypes.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zenodo/modules/records/data/objecttypes.json b/zenodo/modules/records/data/objecttypes.json index b78597a16..851276d80 100644 --- a/zenodo/modules/records/data/objecttypes.json +++ b/zenodo/modules/records/data/objecttypes.json @@ -123,7 +123,7 @@ "datacite": {"general": "Software"}, "eurepo": "info:eu-repo/semantics/other", "schema.org": "http://schema.org/Code", - "csl": "dataset" + "csl": "article" }, { "$schema": "https://zenodo.org/schemas/records/objecttype-v1.0.0.json", @@ -250,7 +250,7 @@ "datacite": {"general": "Text", "type": "Report"}, "eurepo": "info:eu-repo/semantics/report", "parent": {"$ref": "http://zenodo.org/objecttypes/publication"}, - "csl": "report" + "csl": "article" }, { "$schema": "https://zenodo.org/schemas/records/objecttype-v1.0.0.json", From a8ac82ef8338146bc5a1e33e59c2e3fcec99bf13 Mon Sep 17 00:00:00 2001 From: Alexander Ioannidis Date: Tue, 2 May 2017 10:36:01 +0200 Subject: [PATCH 11/13] tests: change csl result type Signed-off-by: Alexander Ioannidis --- tests/unit/records/test_schemas_csl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/records/test_schemas_csl.py b/tests/unit/records/test_schemas_csl.py index cf58a5328..15674a74c 100644 --- a/tests/unit/records/test_schemas_csl.py +++ b/tests/unit/records/test_schemas_csl.py @@ -39,7 +39,7 @@ def test_minimal(app, minimal_record, recid_pid): d = datetime.utcnow().date() assert obj == { 'id': '123', - 'type': 'dataset', + 'type': 'article', 'title': 'Test', 'abstract': 'My description', 'author': [ From bb24cc930127579493356e2467e277c99eb5aa72 Mon Sep 17 00:00:00 2001 From: Aman Jain Date: Mon, 8 May 2017 15:07:19 +0530 Subject: [PATCH 12/13] docs: typo fix (#1082) Signed-off-by: Aman Jain --- INSTALL.rst | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/INSTALL.rst b/INSTALL.rst index 09ff77347..2b9727fdc 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -15,8 +15,9 @@ For this guide you will need to install Docker installation is not necessary, although highly recommended. If you can't use docker you can run Zenodo and all of the required services -directly in your system. Take a look at ``docker-compose.yml`` file to find out -what is required and how the configuration looks like. +directly in your system. Take a look at +`docker-compose.yml `_ +file to find out what is required and how the configuration looks like. For development you will need to set-up an configure four services: PostgreSQL (``db``), Elasticsearch (``es``), Redis (``cache``) and RabbitMQ (``mq``). @@ -191,7 +192,7 @@ As before, there is a script which does that (this time without sudo): Running services ~~~~~~~~~~~~~~~~ -To run Zenodo locally, you will need to have some services runninig on your +To run Zenodo locally, you will need to have some services running on your machine. At minimum you must have PostgreSQL, Elasticsearch 2.x, Redis and RabbitMQ. You can either install all of those from your system package manager and run @@ -212,7 +213,7 @@ To run only the essential services using docker, execute the following: $ cd ~/src/zenodo $ docker-compose up db es mq cache -This should bring up four docker nodes with PostgreSQL (db) Elasticsearch (es), +This should bring up four docker nodes with PostgreSQL (db), Elasticsearch (es), RabbitMQ (mq), and Redis (cache). Keep this shell session alive. Initialization @@ -230,8 +231,9 @@ Create the database and Elasticsearch indices in a new shell session: .. note:: - Here we assume all four services (db, es, mp, cache) are bound to - localhost (see ``zenodo/config.py``). If you fail to connect those services, it is likely + Here we assume all four services (db, es, mq, cache) are bound to localhost + (see `zenodo/config.py `_). + If you fail to connect those services, it is likely you are running docker through ``docker-machine`` and those services are bound to other IP addresses. In this case, you can redirect localhost ports to docker ports as follows. @@ -281,7 +283,7 @@ Finally, run the Zenodo application: (zenodo)$ zenodo run If you go to http://localhost:5000, you should see an instance of Zenodo, -similar to the production instance at https://zenodo.org +similar to the production instance at https://zenodo.org. .. note:: @@ -301,5 +303,5 @@ similar to the production instance at https://zenodo.org Badges ~~~~~~ In order for the DOI badges to work you must have the Cairo SVG library and the -DejaVu Sans font installed on your system . Please see `Invenio-Formatter +DejaVu Sans font installed on your system. Please see `Invenio-Formatter `_ for details. From 5c76963ca79bd033029c76b1f1b44d2735fd928a Mon Sep 17 00:00:00 2001 From: Aman Jain Date: Mon, 8 May 2017 18:49:33 +0530 Subject: [PATCH 13/13] docs: updated license dates (#1083) * Updated License term from 2009-2016 to 2009-2017. Signed-off-by: Aman Jain --- README.rst | 4 ++-- docs/license.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index d88ddd6c8..c89127458 100644 --- a/README.rst +++ b/README.rst @@ -37,7 +37,7 @@ .. image:: https://img.shields.io/github/license/zenodo/zenodo.svg :target: https://github.com/zenodo/zenodo/blob/master/LICENSE - + .. image:: https://badges.gitter.im/Join%20Chat.svg :alt: Join the chat at https://gitter.im/zenodo/zenodo :target: https://gitter.im/zenodo/zenodo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge @@ -65,7 +65,7 @@ See https://zenodo.readthedocs.io/ License ======= -Copyright (C) 2009-2016 CERN. +Copyright (C) 2009-2017 CERN. Zenodo is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/docs/license.rst b/docs/license.rst index b8c270a22..83f62ec7c 100644 --- a/docs/license.rst +++ b/docs/license.rst @@ -6,7 +6,7 @@ License does not apply to the name Zenodo (TM) and the Zenodo logo which are trademarked by CERN. Thus if you instantiate the software you must change the branding to your own. -Copyright (C) 2009-2016 CERN. +Copyright (C) 2009-2017 CERN. Zenodo is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as