harvest.py 5.08 KB
Newer Older
1 2 3
""" Harvest Controllers

"""
4
import traceback
5

legac's avatar
legac committed
6 7 8 9 10 11
from harvest_tools import (Articles,
                           Notes,
                           Preprints,
                           Proceedings,
                           Reports,
                           Talks,
12
                           Thesis)
13

14
def articles():
15
    """Scan the cds/invenio stores to find articles published during year range
tux091's avatar
tux091 committed
16
    and for a given team. Insert them in the database if they don't exist.
tux091's avatar
tux091 committed
17
    
18 19 20 21
    The scanning is steered using the current request arguments as well as
    the harvest parameters associated to this action.

    Search arguments are defined and via the harvester selector. 
22

23
    """
tux091's avatar
tux091 committed
24
    try:
legac's avatar
legac committed
25
        tool = Articles(debug=False)
26
        tool.process(db)
27
        
28
    except BaseException, e:
29 30 31 32
        msg  = '<br><br><hr/>'
        msg += CODE(traceback.format_exc()).xml()
        msg += '<hr/>'
        return msg
tux091's avatar
tux091 committed
33
    
34
    response.view = 'harvest/layout.html'
35
    return tool.report()
tux091's avatar
tux091 committed
36 37


legac's avatar
legac committed
38 39 40 41 42
def notes():
    """Scan the cds/invenio stores to find notes published during a year 
    range and for a given team. Insert them in the database if they don't
    exist.
    
43 44 45 46
    The scanning is steered using the current request arguments as well as
    the harvest parameters associated to this action.

    Search arguments are defined and via the harvester selector. 
legac's avatar
legac committed
47 48 49

    """
    try:
legac's avatar
legac committed
50
        tool = Notes(debug=False)
51
        tool.process(db)
legac's avatar
legac committed
52 53 54 55 56 57 58 59
        
    except BaseException, e:
        msg  = '<br><br><hr/>'
        msg += CODE(traceback.format_exc()).xml()
        msg += '<hr/>'
        return msg

    response.view = 'harvest/layout.html'
60
    return tool.report()
legac's avatar
legac committed
61 62
    
    
63 64 65 66 67
def preprints():
    """Scan the cds/invenio stores to find preprints not yet published.
    the scan is performed during a year range for a given team. 
    New record are inserted in the database if they don't exist.
    
68 69
    The scanning is steered using the current request arguments as well as
    the harvest parameters associated to this action.
70

71
    Search arguments are defined and via the harvester selector. 
72 73 74
    
    """
    try:
legac's avatar
legac committed
75
        tool = Preprints(debug=False)
76
        tool.process(db)
77 78

    except BaseException, e:
79 80 81 82
        msg  = '<br><br><hr/>'
        msg += CODE(traceback.format_exc()).xml()
        msg += '<hr/>'
        return msg
83 84
    
    response.view = 'harvest/layout.html'
85
    return tool.report()
86 87


88
def proceedings():
89 90
    """Scan the cds/invenio stores to find conference proceedings published 
    during a year range for a given team. Insert them in the database 
91
    if they don't exist.
92
    
93 94
    The scanning is steered using the current request arguments as well as
    the harvest parameters associated to this action.
95

96
    Search arguments are defined and via the harvester selector. 
97
    
tux091's avatar
tux091 committed
98
    """
tux091's avatar
tux091 committed
99
    try:
legac's avatar
legac committed
100
        tool = Proceedings(debug=False)
101
        tool.process(db)
102 103
        
    except BaseException, e:
104 105 106 107
        msg  = '<br><br><hr/>'
        msg += CODE(traceback.format_exc()).xml()
        msg += '<hr/>'
        return msg
108

109
    response.view = 'harvest/layout.html'
110
    return tool.report()
111 112


Renaud Le Gac's avatar
Renaud Le Gac committed
113
def reports():
114 115 116
    """Scan the cds/invenio stores to find reports published during a year 
    range and for a given team. Insert them in the database if they don't
    exist.
Renaud Le Gac's avatar
Renaud Le Gac committed
117
    
118 119
    The scanning is steered using the current request arguments as well as
    the harvest parameters associated to this action.
120

121
    Search arguments are defined and via the harvester selector. 
Renaud Le Gac's avatar
Renaud Le Gac committed
122 123 124
    
    """
    try:
legac's avatar
legac committed
125
        tool = Reports(debug=False)
126
        tool.process(db)
Renaud Le Gac's avatar
Renaud Le Gac committed
127 128
        
    except BaseException, e:
129 130 131 132
        msg  = '<br><br><hr/>'
        msg += CODE(traceback.format_exc()).xml()
        msg += '<hr/>'
        return msg
Renaud Le Gac's avatar
Renaud Le Gac committed
133

134
    response.view = 'harvest/layout.html'
135
    return tool.report()
Renaud Le Gac's avatar
Renaud Le Gac committed
136 137
    
    
138
def talks():
139 140
    """Scan the cds/invenio stores to find conference talks for a given 
    year range and team. Insert them in the database if they don't exist.
141
    
142 143
    The scanning is steered using the current request arguments as well as
    the harvest parameters associated to this action.
144

145
    Search arguments are defined and via the harvester selector. 
146 147 148
    
    """
    try:
legac's avatar
legac committed
149
        tool = Talks(debug=False)
150
        tool.process(db)
151 152
        
    except BaseException, e:
153 154 155 156
        msg  = '<br><br><hr/>'
        msg += CODE(traceback.format_exc()).xml()
        msg += '<hr/>'
        return msg
157

158
    response.view = 'harvest/layout.html'
159
    return tool.report()
160 161 162 163 164 165 166


def theses():
    """Scan the cds/invenio stores to find theses.
    the scan is performed during a year range for a given team. 
    New record are inserted in the database if they don't exist.
    
167 168
    The scanning is steered using the current request arguments as well as
    the harvest parameters associated to this action.
169

170
    Search arguments are defined and via the harvester selector. 
171 172
    
    """
legac's avatar
legac committed
173
    try:
legac's avatar
legac committed
174
        tool = Thesis(debug=False)
175
        tool.process(db)
legac's avatar
legac committed
176 177 178 179 180 181 182 183 184
        
    except BaseException, e:
        msg  = '<br><br><hr/>'
        msg += CODE(traceback.format_exc()).xml()
        msg += '<hr/>'
        return msg

    response.view = 'harvest/layout.html'
    return tool.report()