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
ae7b0168
Commit
ae7b0168
authored
Jul 07, 2013
by
LE GAC Renaud
Browse files
More general form of check_tool since they are working on dictionary.
Improve also their logic.
parent
8af57673
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
71 deletions
+113
-71
languages/fr-fr.py
languages/fr-fr.py
+3
-1
modules/check_tools.py
modules/check_tools.py
+110
-70
No files found.
languages/fr-fr.py
View file @
ae7b0168
...
...
@@ -84,6 +84,7 @@
'Conference speaker is missing'
:
"L'orateur n'est pas défini"
,
'Conference title is not defined'
:
"Le titre de la conférence n'est pas défini"
,
'Conference town is not defined'
:
"La ville de la conférence n'est pas défine"
,
'Conference_Url'
:
'URL de la Conférence'
,
'Configuration'
:
'Configuration'
,
'contains'
:
'contiens'
,
'Controller'
:
'Controller'
,
...
...
@@ -128,6 +129,7 @@
'Email sent'
:
'Email sent'
,
'Email verification'
:
'Email verification'
,
'enter a number between %(min)g and %(max)g'
:
'enter a number between %(min)g and %(max)g'
,
'enter a valid URL'
:
'Entrer un URL valide'
,
'enter an integer between %(min)g and %(max)g'
:
'entrez un entier entre %(min)g et %(max)g'
,
'enter an integer greater than or equal to %(min)g'
:
'entrez un entier plus grand ou égual à %(min)g'
,
'Error !!!'
:
'Erreur !!!'
,
...
...
@@ -248,7 +250,7 @@
'Organisation'
:
'Organisation'
,
'Origin'
:
'Origin'
,
'Pages'
:
'Pages'
,
'Pages range is not defined'
:
"
Les Pages ne sont pas définies
"
,
'Pages range is not defined'
:
'
Les Pages ne sont pas définies
'
,
'Parameter for fuzzy string search.'
:
'Paramètre pour la comparaison des chaînes de caractères.'
,
'Password'
:
'Password'
,
'Password changed'
:
'Password changed'
,
...
...
modules/check_tools.py
View file @
ae7b0168
...
...
@@ -21,7 +21,7 @@ REG_HTML = re.compile('&[a-z]+;')
def
check_publication
(
row
):
"""Check the
fields of a
publication.
"""Check the publication
fields
.
@type row: gluon.dal.Row
@param row: record defining a publication. Its contains the publications
...
...
@@ -93,7 +93,7 @@ def check_publication(row):
text
=
T
(
"Preprint number is not defined"
)
li
.
append
(
text
)
ids
=
duplicate_article
(
row
)
ids
=
duplicate_article
(
row
.
publications
)
if
ids
:
text
=
T
(
"Possible duplicate entries [%s]"
)
%
', '
.
join
(
ids
)
li
.
append
(
text
)
...
...
@@ -121,7 +121,7 @@ def check_publication(row):
text
=
T
(
"Conference speaker is missing"
)
li
.
append
(
text
)
ids
=
duplicate_conference
(
row
)
ids
=
duplicate_conference
(
row
.
publications
)
if
ids
:
text
=
T
(
"Possible duplicate entries [%s]"
)
%
', '
.
join
(
ids
)
li
.
append
(
text
)
...
...
@@ -133,7 +133,7 @@ def check_publication(row):
text
=
T
(
"Report number is missing"
)
li
.
append
(
text
)
ids
=
duplicate_report
(
row
)
ids
=
duplicate_report
(
row
.
publications
)
if
ids
:
text
=
T
(
"Possible duplicate entries [%s]"
)
%
', '
.
join
(
ids
)
li
.
append
(
text
)
...
...
@@ -141,12 +141,41 @@ def check_publication(row):
return
li
def
duplicate_article
(
row
):
def
_extend_ids
(
db
,
query
,
ids
):
"""helper functions
@type db: gluon.dal.DAL
@param db:
@type query: gluon.dal.query
@param query:
@type ids: list of string
@param ids: the current list of ids
@note: the current list of publication ids will be extend by those
corresponding to the C{query}. The id are unique in the list.
"""
set
=
db
(
query
)
if
set
.
count
():
for
row
in
set
.
select
():
id
=
str
(
row
.
publications
.
id
)
if
id
not
in
ids
:
ids
.
append
(
id
)
def
duplicate_article
(
publication
):
"""Look for duplicate article.
The comparison is performed on article published by the given team
using the following criteria:
@type row: gluon.dal.Row
@param row: record defining a publication. Its contains the publications
table as well as its reference tables.
- title, publishers, volume and pages
- publisher, volume and pages
- publisher and title
@type publication: dict or gluon.storage.Storage
@param publication: contains the publication fields and theirs values
@rtype: list
@return: list of ids corresponding to duplicate entries
...
...
@@ -155,52 +184,45 @@ def duplicate_article(row):
ids
=
[]
db
=
current
.
globalenv
[
'db'
]
qcat
=
(
db
.
categories
.
code
==
'ACL'
)
|
(
db
.
categories
.
code
==
'ACLN'
)
qmain
=
get_where_query
(
db
.
publications
)
qmain
=
((
qmain
)
&
(
db
.
publications
.
id
!=
row
.
publications
.
id
))
qmain
=
((
qmain
)
&
(
db
.
categories
.
code
==
'ACL'
))
qmain
=
((
qmain
)
&
(
db
.
teams
.
team
==
row
.
teams
.
team
))
qmain
=
((
qmain
)
&
(
db
.
publications
.
id_publishers
==
row
.
publications
.
id_publishers
))
qmain
=
((
qmain
)
&
(
qcat
))
qmain
=
((
qmain
)
&
(
db
.
publications
.
id_teams
==
publication
[
'id_teams'
]))
qmain
=
((
qmain
)
&
(
db
.
publications
.
id_publishers
==
publication
[
'id_publishers'
]))
# look for publications with the same title, review and team
query
=
((
qmain
)
&
(
db
.
publications
.
title
==
row
.
publications
.
title
))
query
=
((
query
)
&
(
db
.
publications
.
volume
==
row
.
publications
.
volume
))
query
=
((
query
)
&
(
db
.
publications
.
pages
==
row
.
publications
.
pages
))
if
'id'
in
publication
:
qmain
=
((
qmain
)
&
(
db
.
publications
.
id
!=
publication
[
'id'
]))
set
=
db
(
query
)
if
set
.
count
():
for
xrow
in
set
.
select
():
ids
.
append
(
str
(
xrow
.
publications
.
id
))
# less stringent test same review and team
query
=
((
qmain
)
&
(
db
.
publications
.
volume
==
row
.
publications
.
volume
))
query
=
((
query
)
&
(
db
.
publications
.
pages
==
row
.
publications
.
pages
))
# title, publishers, volume and pages
query
=
((
qmain
)
&
(
db
.
publications
.
title
==
publication
[
'title'
]))
query
=
((
query
)
&
(
db
.
publications
.
volume
==
publication
[
'volume'
]))
query
=
((
query
)
&
(
db
.
publications
.
pages
==
publication
[
'pages'
]))
_extend_ids
(
db
,
query
,
ids
)
set
=
db
(
query
)
if
set
.
count
():
for
xrow
in
set
.
select
():
xid
=
str
(
xrow
.
publications
.
id
)
if
xid
not
in
ids
:
ids
.
append
(
xid
)
# less stringent test same title and team
query
=
((
qmain
)
&
(
db
.
publications
.
title
==
row
.
publications
.
title
))
set
=
db
(
query
)
if
set
.
count
():
for
xrow
in
set
.
select
():
xid
=
str
(
xrow
.
publications
.
id
)
if
xid
not
in
ids
:
ids
.
append
(
xid
)
# publisher, volume and pages
query
=
((
qmain
)
&
(
db
.
publications
.
volume
==
publication
[
'volume'
]))
query
=
((
query
)
&
(
db
.
publications
.
pages
==
publication
[
'pages'
]))
_extend_ids
(
db
,
query
,
ids
)
# publisher and title
query
=
((
qmain
)
&
(
db
.
publications
.
title
==
publication
[
'title'
]))
_extend_ids
(
db
,
query
,
ids
)
return
ids
def
duplicate_conference
(
row
):
def
duplicate_conference
(
publication
):
"""Look for duplicate talk / proceeding.
The comparison is performed on conference talk/proceeding published
by the given team using the following criteria:
@type row: gluon.dal.Row
@param row: record defining a publication. Its contains the publications
table as well as its reference tables.
- title, conference title, conference date and conference town
- title, conference date and conference town
- title, conference title and conference town
@type publication: dict or gluon.storage.Storage
@param publication: contains the publication fields and theirs values
@rtype: list
@return: list of ids corresponding to duplicate entries
...
...
@@ -209,29 +231,46 @@ def duplicate_conference(row):
ids
=
[]
db
=
current
.
globalenv
[
'db'
]
query
=
get_where_query
(
db
.
publications
)
query
=
((
query
)
&
(
db
.
publications
.
id
!=
row
.
publications
.
id
))
query
=
((
query
)
&
((
db
.
categories
.
code
==
'ACTI'
)
|
(
db
.
categories
.
code
==
'COM'
)))
query
=
((
query
)
&
(
db
.
teams
.
team
==
row
.
teams
.
team
))
query
=
((
query
)
&
(
db
.
publications
.
conference_title
==
row
.
publications
.
conference_title
))
query
=
((
query
)
&
(
db
.
publications
.
conference_dates
==
row
.
publications
.
conference_dates
))
query
=
((
query
)
&
(
db
.
publications
.
conference_town
==
row
.
publications
.
conference_town
))
query
=
((
query
)
&
(
db
.
publications
.
title
==
row
.
publications
.
title
))
qcat
=
(
db
.
categories
.
code
==
'ACTI'
)
|
\
(
db
.
categories
.
code
==
'ACTN'
)
|
\
(
db
.
categories
.
code
==
'COM'
)
qmain
=
get_where_query
(
db
.
publications
)
qmain
=
((
qmain
)
&
(
qcat
))
qmain
=
((
qmain
)
&
(
db
.
publications
.
id_teams
==
publication
[
'id_teams'
]))
qmain
=
((
qmain
)
&
(
db
.
publications
.
title
==
publication
[
'title'
]))
if
'id'
in
publication
:
qmain
=
((
qmain
)
&
(
db
.
publications
.
id
!=
publication
[
'id'
]))
# title, conference title, conference date and conference town
query
=
((
qmain
)
&
(
db
.
publications
.
conference_title
==
publication
[
'conference_title'
]))
query
=
((
query
)
&
(
db
.
publications
.
conference_dates
==
publication
[
'conference_dates'
]))
query
=
((
query
)
&
(
db
.
publications
.
conference_town
==
publication
[
'conference_town'
]))
_extend_ids
(
db
,
query
,
ids
)
# title, conference date and conference town
query
=
((
query
)
&
(
db
.
publications
.
conference_dates
==
publication
[
'conference_dates'
]))
query
=
((
query
)
&
(
db
.
publications
.
conference_town
==
publication
[
'conference_town'
]))
_extend_ids
(
db
,
query
,
ids
)
# title, conference title and conference town
query
=
((
qmain
)
&
(
db
.
publications
.
conference_title
==
publication
[
'conference_title'
]))
query
=
((
query
)
&
(
db
.
publications
.
conference_town
==
publication
[
'conference_town'
]))
_extend_ids
(
db
,
query
,
ids
)
set
=
db
(
query
)
if
set
.
count
():
for
xrow
in
set
.
select
():
ids
.
append
(
str
(
xrow
.
publications
.
id
))
return
ids
def
duplicate_report
(
row
):
def
duplicate_report
(
publication
):
"""Look for duplicate report.
The comparison is performed on report published by the given team
using the following criteria:
@type row: gluon.dal.Row
@param row: record defining a publication. Its contains the publications
table as well as its reference tables.
- title
@type publication: dict or gluon.storage.Storage
@param publication: contains the publication fields and theirs values
@rtype: list
@return: list of ids corresponding to duplicate entries
...
...
@@ -240,16 +279,17 @@ def duplicate_report(row):
ids
=
[]
db
=
current
.
globalenv
[
'db'
]
query
=
get_where_query
(
db
.
publications
)
query
=
((
query
)
&
(
db
.
publications
.
id
!=
row
.
publications
.
id
))
query
=
((
query
)
&
(
db
.
categories
.
code
==
'AP'
))
query
=
((
query
)
&
(
db
.
teams
.
team
==
row
.
teams
.
team
))
query
=
((
query
)
&
(
db
.
publications
.
title
==
row
.
publications
.
title
))
qcat
=
db
.
categories
.
code
==
'AP'
set
=
db
(
query
)
if
set
.
count
():
for
xrow
in
set
.
select
():
ids
.
append
(
str
(
xrow
.
publications
.
id
))
qmain
=
get_where_query
(
db
.
publications
)
qmain
=
((
qmain
)
&
(
qcat
))
qmain
=
((
qmain
)
&
(
db
.
publications
.
id_teams
==
publication
[
'id_teams'
]))
qmain
=
((
qmain
)
&
(
db
.
publications
.
title
==
publication
[
'title'
]))
if
'id'
in
publication
:
qmain
=
((
qmain
)
&
(
db
.
publications
.
id
!=
publication
[
'id'
]))
_extend_ids
(
db
,
qmain
,
ids
)
return
ids
\ No newline at end of file
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