db1_publications.py 5.49 KB
Newer Older
1
# -*- coding: utf-8 -*-
2
""" publications
3 4 5

"""
tp_authors = \
6
T("List of authors separated by comma: J. Doe, P.-Y. Smith")
7

LE GAC Renaud's avatar
LE GAC Renaud committed
8 9
tp_authors_institute = \
T("List of authors belonging to your institute, separated by comma: P.-Y. Doe, J. Smith")
10

11
tp_conference_dates = \
12
T("Dates of the conference: 9-10 Oct 2012 or 29 Oct - 3 Nov 2012 or 3 Dec 2012")
13

tux091's avatar
tux091 committed
14
tp_conference_title = \
15
T("The title of the conference. Use the latex syntax for symbol: $\\alpha$")
tux091's avatar
tux091 committed
16 17

tp_conference_url = \
18
T("The URL of the conference: http://....")
tux091's avatar
tux091 committed
19

20
tp_directors = \
21
T("List of directors separated by comma: J. Doe, P.-Y. Smith")
22 23

tp_defense = \
24
T("Date of defense: 13 Dec 2011")
25

26
tp_first_author = \
27
T("The name of the first author: J. Doe")
28

29
tp_origin = \
30
T("The URL of the associated record in cds or inspirehep: http://cds.cern.ch/record/1669557")
31

32
tp_pages = \
33
T("Number for the first pages or a range 69-80")
34 35

tp_preprint = \
36
T("Preprint identifier separated by comma: arXiv:0906.1516")
37 38

tp_report_numbers = \
39
T("Report identifier separated by comma: LHCb-PROC-2008-04")
40
 
41
tp_submitted = \
42
T("Date of submission to a publisher: 2011-12-13 or 2011-12")
43

44
tp_speaker = \
45
T("The name of the speaker: P.-Y. Smith")
46

tux091's avatar
tux091 committed
47
tp_title = \
48
T("The title of the publication. Use the latex syntax for symbol: $\\alpha$")
tux091's avatar
tux091 committed
49

50
tp_universities = \
51
T("List of university separated by comma")
52

tux091's avatar
tux091 committed
53
tp_url = \
54
T("The URL pointing to the pdf file of the the publication (open access): http://arxiv.org/pdf/1103.2465")
tux091's avatar
tux091 committed
55

56
tp_volume = \
57
T("The volume number: 123 or 64-65")
tux091's avatar
tux091 committed
58

59 60 61
tp_year = \
T("Year of the publication")

62
db.define_table("publications",
63
    Field("title", "text", comment=tp_title, notnull=True),
64
    Field("first_author", "string", length=255, comment=tp_first_author, notnull=True),
65
    Field("authors", "text", comment=tp_authors, notnull=True),
66
    Field("id_collaborations", "reference collaborations", default=undef_id, label="Collaboration"),
67
    Field("id_publishers", "reference publishers", default=undef_id, label="Revue"),
68
    Field("year", "integer", comment=tp_year, notnull=True),
69 70 71 72
    Field("volume", "string", length=255, comment=tp_volume, default=""),
    Field("pages", "string", length=255, comment=tp_pages, default=""),
    Field("submitted", "string", length=255, comment=tp_submitted, notnull=True),
    Field("preprint", "string", length=255, comment=tp_preprint, default=""),
73
    Field("publication_url", "string", length=255, comment=tp_url, default="", label="PDF file url"),
74
    Field("conference_title", "text", comment=tp_conference_title, default="", label='Title'),
75 76 77
    Field("conference_url", "string", length=255, comment=tp_conference_url, default="", label='url'),
    Field("conference_dates", "string", length=255, comment=tp_conference_dates, default="", label='Dates'),
    Field("conference_town", "string", length=255, default="", label='Town'),
78
    Field("id_countries", "reference countries", default=undef_id, label='Country'),
79 80
    Field("conference_speaker", "string", length=255, comment=tp_speaker, default="", label='Speaker'),
    Field("report_numbers", "string", length=255, comment=tp_report_numbers, default="", label="Number(s)"),
81
    Field("id_reports", "reference reports", default=undef_id, label="Type"),
82 83 84 85 86 87
    Field("universities", "string", length=255, comment=tp_universities, default=""),
    Field("directors", "string", length=255, comment=tp_directors, default=""),
    Field("defense", "string", length=255, comment=tp_defense, default=""),
    Field("book_isbn", "string", length=255, label="ISBN", default=""),
    Field("book_issn", "string", length=255, label="ISSN", default=""),
    Field("book_chapters", "string", length=255, default="", label="Chapter(s)"),
LE GAC Renaud's avatar
LE GAC Renaud committed
88
    Field("authors_institute", "text", comment=tp_authors_institute, notnull=True, label="Authors"),
89
    Field("id_authors_roles", "reference authors_roles", default=undef_id, label="Role"),
90 91
    Field("id_teams", "reference teams", label='Team', notnull=True),
    Field("id_projects", "reference projects", label='Project', notnull=True),
92 93
    Field("id_categories", "reference categories", default=undef_id, label='Category'),
    Field("id_status", "reference status", default=undef_id, label="Status"),
94
    Field("origin", "string", length=255, comment=tp_origin, writable=False),
95
    migrate="publications.table")
96

97
db.publications._before_delete.append(INHIBIT_PUBLICATION_DELETE_ON_OK)
LE GAC Renaud's avatar
LE GAC Renaud committed
98
db.publications._before_insert.append(INHIBIT_DUPLICATE_PUBLICATION)
99
db.publications._before_update.append(INHIBIT_PUBLICATION_UPDATE_ON_OK)
100

LE GAC Renaud's avatar
LE GAC Renaud committed
101
db.publications.authors.filter_in = dbui.CLEAN_COMMA
LE GAC Renaud's avatar
LE GAC Renaud committed
102
db.publications.authors_institute.filter_in = dbui.CLEAN_COMMA
103 104
db.publications.conference_title.filter_in = dbui.CLEAN_SPACES
db.publications.conference_town.filter_in = dbui.CLEAN_SPACES
105
db.publications.defense.filter_in = filters.CLEAN_THESIS_DEFENSE
LE GAC Renaud's avatar
LE GAC Renaud committed
106
db.publications.first_author.filter_in = dbui.CLEAN_COMMA
107
db.publications.title.filter_in = dbui.CLEAN_SPACES
108 109

db.publications.authors.requires = IS_LENGTH(65535)
110 111

# rule: 30 Dec 2012
112
db.publications.defense.requires = IS_EMPTY_OR(IS_MATCH(REG_DEFENSE))
113
db.publications.id_publishers.requires = IS_IN_DB(db, 'publishers.abbreviation')
114 115

# rule: 10-14 Dec 2012 or 28 Jun - 4 Jul 2012
116
db.publications.conference_dates.requires = IS_EMPTY_OR(IS_MATCH(REG_CONF_DATES))
117

118
db.publications.conference_url.requires = IS_EMPTY_OR(IS_URL())
119
db.publications.origin.requires = IS_EMPTY_OR(IS_URL())
120
db.publications.publication_url.requires = IS_EMPTY_OR(IS_URL())
121 122

# rule: 2012-12 or 2012-12-31
123
db.publications.submitted.requires = IS_MATCH(REG_SUBMITTED)
124

125
db.publications.year.requires = IS_INT_IN_RANGE(1900, year+1)