Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
56877278
Commit
56877278
authored
Sep 30, 2015
by
LE GAC Renaud
Browse files
Sphinx documentation for the Msg class.
parent
75fdf47c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
70 deletions
+94
-70
docs/api/generated/harvest_tools.msg.Msg.rst
docs/api/generated/harvest_tools.msg.Msg.rst
+21
-0
docs/api/generated/msg/harvest_tools.msg.Msg.idle.rst
docs/api/generated/msg/harvest_tools.msg.Msg.idle.rst
+6
-0
docs/api/generated/msg/harvest_tools.msg.Msg.load.rst
docs/api/generated/msg/harvest_tools.msg.Msg.load.rst
+6
-0
docs/api/generated/msg/harvest_tools.msg.Msg.modify.rst
docs/api/generated/msg/harvest_tools.msg.Msg.modify.rst
+6
-0
docs/api/generated/msg/harvest_tools.msg.Msg.reject.rst
docs/api/generated/msg/harvest_tools.msg.Msg.reject.rst
+6
-0
docs/api/harvester.rst
docs/api/harvester.rst
+8
-0
modules/harvest_tools/msg.py
modules/harvest_tools/msg.py
+41
-70
No files found.
docs/api/generated/harvest_tools.msg.Msg.rst
0 → 100644
View file @
56877278
harvest_tools.msg.Msg
=====================
.. currentmodule:: harvest_tools.msg
.. autoclass:: Msg
.. rubric:: Methods
.. autosummary::
:toctree: msg/
~Msg.idle
~Msg.load
~Msg.modify
~Msg.reject
docs/api/generated/msg/harvest_tools.msg.Msg.idle.rst
0 → 100644
View file @
56877278
harvest_tools.msg.Msg.idle
==========================
.. currentmodule:: harvest_tools.msg
.. automethod:: Msg.idle
\ No newline at end of file
docs/api/generated/msg/harvest_tools.msg.Msg.load.rst
0 → 100644
View file @
56877278
harvest_tools.msg.Msg.load
==========================
.. currentmodule:: harvest_tools.msg
.. automethod:: Msg.load
\ No newline at end of file
docs/api/generated/msg/harvest_tools.msg.Msg.modify.rst
0 → 100644
View file @
56877278
harvest_tools.msg.Msg.modify
============================
.. currentmodule:: harvest_tools.msg
.. automethod:: Msg.modify
\ No newline at end of file
docs/api/generated/msg/harvest_tools.msg.Msg.reject.rst
0 → 100644
View file @
56877278
harvest_tools.msg.Msg.reject
============================
.. currentmodule:: harvest_tools.msg
.. automethod:: Msg.reject
\ No newline at end of file
docs/api/harvester.rst
View file @
56877278
...
...
@@ -36,6 +36,14 @@ Helper functions
format_author_fr
learn_my_authors
Logger
^^^^^^
.. currentmodule:: harvest_tools.msg
.. autosummary::
:toctree: generated/
Msg
Classes
^^^^^^^
...
...
modules/harvest_tools/msg.py
View file @
56877278
...
...
@@ -10,48 +10,31 @@ from invenio_tools import OAI_URL
class
Msg
(
Storage
):
"""Message and action taken for a publication.
- The publication is found by an harvester tool, in a store.
- The action refers to the database.
Fours action are defined:
- C{idle}
- C{load}
- C{modify}
- C{reject}
The class contains the attributes:
- C{action}: action taken
- C{collection}: the harvester collection
- C{harvester}: the harvester encoded as a JSON string
- C{record_id}; the store identifier of the record
- C{title}: title of the publication
- C{txt}: text of the message
- C{url}: url of the record
- C{year}: year of the publication
"""Action taken for a publication and its associated explanation.
"""
Note:
Actions are defined with respect to the database:
* *idle* do nothing.
* *load* the record is insert in the database.
* *modify* an existing record is modified.
* *reject* the record is rejected.
Args:
collection (unicode): the harvester collection used to
search the record.
harvester (gluon.dal.Row): the database harvester used to scan the
store.
record_id (int): the record identifier in the store.
title (unicode): the title of the publication.
"""
def
__init__
(
self
,
collection
=
None
,
harvester
=
None
,
record_id
=
None
,
title
=
None
):
"""
@type collection: str
@param collection: the collection containing the record
@type harvester: gluon.dal.Row or gluon.storage.Storage
@param harvester: the current harvester used to retrieve the record.
@type record_id: int
@param record_id: the store identifier of the record
@type title: str
@param title: the title associated to the record
"""
self
.
action
=
None
self
.
collection
=
collection
...
...
@@ -67,64 +50,52 @@ class Msg(Storage):
self
.
year
=
None
def
idle
(
self
,
txt
,
year
=
None
,
translate
=
True
):
"""Set the action as idle and the
message
as
C{
txt
}
.
"""Set the action as
*
idle
*
and the
explanation
as
``
txt
``
.
@type txt: unicode
@param txt: message
@type year: unicode
@param year: year of the publication
@type translate: boolean
@param translate: translate the txt according to the current language
Args:
txt (unicode): message associated to the action.
year (unicode): year of the publication
translate (bool): translate the message according to the
current language.
"""
self
.
action
=
'idle'
self
.
_set
(
txt
,
year
,
translate
)
def
load
(
self
,
txt
,
year
=
None
,
translate
=
True
):
"""Set the action as C{load} and the message as C{txt}.
@type txt: unicode
@param txt: message
@type year: unicode
@param year: year of the publication
"""Set the action as *load* and the explanation as ``txt``.
@type translate: boolean
@param translate: translate the txt according to the current language
Args:
txt (unicode): message associated to the action.
year (unicode): year of the publication
translate (bool): translate the message according to the
current language.
"""
self
.
action
=
'load'
self
.
_set
(
txt
,
year
,
translate
)
def
modify
(
self
,
txt
,
year
=
None
,
translate
=
True
):
"""Set the action as
C{
modify
}
and the
message
as
C{
txt
}
.
"""Set the action as
*
modify
*
and the
explanation
as
``
txt
``
.
@type txt: unicode
@param txt: message
@type year: unicode
@param year: year of the publication
@type translate: boolean
@param translate: translate the txt according to the current language
Args:
txt (unicode): message associated to the action.
year (unicode): year of the publication
translate (bool): translate the message according to the
current language.
"""
self
.
action
=
'modify'
self
.
_set
(
txt
,
year
,
translate
)
def
reject
(
self
,
txt
,
year
=
None
,
translate
=
True
):
"""Set the action as C{reject} set the message as C{txt}.
@type txt: unicode
@param txt: message
@type year: unicode
@param year: year of the publication
"""Set the action as *reject* set the explanation as ``txt``.
@type translate: boolean
@param translate: translate the txt according to the current language
Args:
txt (unicode): message associated to the action.
year (unicode): year of the publication
translate (bool): translate the message according to the
current language.
"""
self
.
action
=
'reject'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment