Commit 6c68b927 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Sphinx documentation for the Articles class.

parent 1b2c0a84
harvest_tools.articles.Articles.check_record
============================================
.. currentmodule:: harvest_tools.articles
.. automethod:: Articles.check_record
\ No newline at end of file
harvest_tools.articles.Articles.decode_xml
==========================================
.. currentmodule:: harvest_tools.articles
.. automethod:: Articles.decode_xml
\ No newline at end of file
harvest_tools.articles.Articles.get_create_collaboration
========================================================
.. currentmodule:: harvest_tools.articles
.. automethod:: Articles.get_create_collaboration
\ No newline at end of file
harvest_tools.articles.Articles.get_create_publisher
====================================================
.. currentmodule:: harvest_tools.articles
.. automethod:: Articles.get_create_publisher
\ No newline at end of file
harvest_tools.articles.Articles.get_record_by_fields
====================================================
.. currentmodule:: harvest_tools.articles
.. automethod:: Articles.get_record_by_fields
\ No newline at end of file
harvest_tools.articles.Articles.get_record_by_origin
====================================================
.. currentmodule:: harvest_tools.articles
.. automethod:: Articles.get_record_by_origin
\ No newline at end of file
harvest_tools.articles.Articles.insert_record
=============================================
.. currentmodule:: harvest_tools.articles
.. automethod:: Articles.insert_record
\ No newline at end of file
harvest_tools.articles.Articles.process_url
===========================================
.. currentmodule:: harvest_tools.articles
.. automethod:: Articles.process_url
\ No newline at end of file
harvest_tools.articles.Articles.process_xml
===========================================
.. currentmodule:: harvest_tools.articles
.. automethod:: Articles.process_xml
\ No newline at end of file
harvest_tools.articles.Articles.report
======================================
.. currentmodule:: harvest_tools.articles
.. automethod:: Articles.report
\ No newline at end of file
harvest_tools.articles.Articles
===============================
.. currentmodule:: harvest_tools.articles
.. autoclass:: Articles
.. rubric:: Methods
.. autosummary::
:toctree: articles/
~Articles.check_record
~Articles.decode_xml
~Articles.get_create_collaboration
~Articles.get_create_publisher
~Articles.get_record_by_fields
~Articles.get_record_by_origin
~Articles.insert_record
~Articles.process_url
~Articles.process_xml
~Articles.report
......@@ -8,3 +8,10 @@ Harvesters
:toctree: generated/
Automaton
.. currentmodule:: harvest_tools.articles
.. autosummary::
:toctree: generated/
Articles
......@@ -33,14 +33,14 @@ class Articles(Automaton):
self.id_preprint = get_id(self.db.categories, code="PRE")
def check_record(self, record):
"""Check the content of the article in order to fix non conformities.
"""Check the content of the article in order to fix non-conformities.
@type record: L{Record}
@param record:
Args:
record (RecordPubli): the MARC12 record describing the article.
@rtype: bool
@return: C{False} when a non conformity is found and can not be
corrected.
Returns:
bool: ``False`` when a non conformity is found and
can not be corrected.
"""
if not Automaton.check_record(self, record):
......@@ -85,23 +85,26 @@ class Articles(Automaton):
title=None,
volume=None,
year=None):
"""Get an existing record using the origin field.
- Transform a preprint into article.
- Actions are logged.
@keyword id_publisher:
@keyword oai_url:
@keyword pages:
@keyword publication_url:
@keyword title:
@keyword volume:
@keyword year:
@rtype: tuple
@return: the tuple (id, status). The id of the record or None.
The status is equal to one when the existing record was modified
zero otherwise
"""Get an existing record using the origin field and its value
defined in the ``oai_url`` keyword argument.
The other arguments are used to transform the corresponding preprint
into an article.
Args:
oai_url (unicode): the OAI identifier of the article.
id_publisher (int): identifier of the publisher in the database.
my_authors (unicode): authors of my institute separated by a comma.
pages (unicode): the page reference.
publication_url (unicode): the URL of the publications
title (unicode): the title of the publication.
volume (unicode): the volume reference.
year (unicode): the year of publication.
Returns:
tuple: ``(id, status)`` which contains the ``id`` of the record.
It is equal to ``None`` when nothing is found.
The ``status`` is equal to one when the existing preprint was
modified into article, zero otherwise
"""
if self.dbg:
......@@ -143,26 +146,30 @@ class Articles(Automaton):
title=None,
volume=None,
year=None):
"""Get a record matching the fields: id_projects,
id_publishers, id_teams, pages, volume and year.
- Fix the field origin when a match is found.
- Transform a preprint into article.
- Actions are logged.
@keyword id_publisher:
@keyword oai_url:
@keyword pages:
@keyword publication_url:
@keyword preprint_number:
@keyword title:
@keyword volume:
@keyword year:
@rtype: tuple
@return: the tuple (id, status). The id of the record or None.
The status is equal to one when the existing record was modified
zero otherwise
"""Get the record matching the input fields
Note:
Fix the field origin when a match is found.
Note:
Transform a preprint into article.
Args:
id_publisher (int): identifier of the publisher in the database.
my_authors (unicode): authors of my institute separated by a comma.
oai_url (unicode): the URL defining the OAI.
pages (unicode): the page reference.
publication_url (unicode): the URL of the publications
preprint_number (unicode): the preprint number
title (unicode): the title of the publication.
volume (unicode): the volume reference.
year (unicode): the year of publication.
Returns:
tuple: ``(id, status)`` which contains the ``id`` of the record.
It is equal to ``None`` when nothing is found.
The ``status`` is equal to one when the existing preprint was
modified into article, zero otherwise
"""
if self.dbg:
......@@ -222,14 +229,16 @@ class Articles(Automaton):
def insert_record(self, record):
"""Insert an article in the database.
The method assume that erratum are removed.
@type record: L{Record}
@param record:
Note:
The method assumes that erratum are removed.
Args:
record (RecordPubli): the MARC12 record describing the article.
@rtype: int
@return: one when the record is inserted / updated in the database
zero otherwise.
Returns:
int: one when the record is inserted / updated in the database,
zero otherwise.
"""
db = self.db
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment