Commit 216b7026 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Apply 2to3 converter to remaining modules.

parent 615dcd15
# -*- coding: utf-8 -*-
""" auth """ auth
* Customise the authentication * Customise the authentication
......
# -*- coding: utf-8 -*-
"""a collections of functions to be used in _before_delete, before_insert """a collections of functions to be used in _before_delete, before_insert
and _before_update callbacks. and _before_update callbacks.
""" """
from check_tools import (duplicate_article, from .check_tools import (duplicate_article,
duplicate_conference, duplicate_conference,
duplicate_report) duplicate_report)
from gluon import current from gluon import current
...@@ -26,14 +25,16 @@ def INHIBIT_CASCADE_DELETE(set_records): ...@@ -26,14 +25,16 @@ def INHIBIT_CASCADE_DELETE(set_records):
bool: ``True`` when the delete is inhibited bool: ``True`` when the delete is inhibited
""" """
db, T = current.db, current.T setquery = set_records.query
field = set_records.query.first
# protection # protection
# the query of the set should be "table.id == 45" # the query of the set should be "table.id == 45"
if field._db._adapter.EQ != set_records.query.op: if setquery.op.__name__ != "eq":
return False return False
db = current.db
field = setquery.first
# protection # protection
# check that the table is ones of the publication reference tables # check that the table is ones of the publication reference tables
tables = (db.authors_roles, tables = (db.authors_roles,
...@@ -51,10 +52,10 @@ def INHIBIT_CASCADE_DELETE(set_records): ...@@ -51,10 +52,10 @@ def INHIBIT_CASCADE_DELETE(set_records):
# inhibit the delete if publications use the reference field # inhibit the delete if publications use the reference field
query = get_where_query(db.publications) query = get_where_query(db.publications)
query = (query) & (set_records.query) query = (query) & (setquery)
if db(query).count(): if db(query).count():
field._table[CALLBACK_ERRORS] = T(MSG_DUPLICATE) field._table[CALLBACK_ERRORS] = current.T(MSG_DUPLICATE)
return True return True
return False return False
......
# -*- coding: utf-8 -*-
"""a collection of tools to check rows. """a collection of tools to check rows.
""" """
import re import re
import regex
from . import regex
from gluon import current from gluon import current
from plugin_dbui import (UNDEF, from plugin_dbui import (UNDEF,
UNDEF_ID, UNDEF_ID,
......
# -*- coding: utf-8 -*-
""" countries """ countries
List of countries extract from the geographical database www.geonames.org: List of countries extract from the geographical database www.geonames.org:
......
# -*- coding: utf-8 -*-
"""a collections of functions to correct entries in the database. """a collections of functions to correct entries in the database.
""" """
......
# -*- coding: utf-8 -*-
"""A collection of tools to build graphs in controllers. """A collection of tools to build graphs in controllers.
""" """
...@@ -7,9 +6,9 @@ import pandas as pd ...@@ -7,9 +6,9 @@ import pandas as pd
from gluon import current from gluon import current
from model_selector import MONTH_SUBMIT, YEAR_PUBLISH from io import StringIO
from .model_selector import MONTH_SUBMIT, YEAR_PUBLISH
from pandas import DataFrame, DatetimeIndex, to_datetime from pandas import DataFrame, DatetimeIndex, to_datetime
from StringIO import StringIO
DATE_PUB = "Publication date" DATE_PUB = "Publication date"
...@@ -345,7 +344,7 @@ def query_publications(db, is_publish, **kwargs): ...@@ -345,7 +344,7 @@ def query_publications(db, is_publish, **kwargs):
elif year_end and not year_start: elif year_end and not year_start:
query = publications.submitted[0:4] <= year_end query = publications.submitted[0:4] <= year_end
for k, v in di.iteritems(): for k, v in di.items():
if k in ("Graph_selectorYear_start", "Graph_selectorYear_end"): if k in ("Graph_selectorYear_start", "Graph_selectorYear_end"):
continue continue
......
# -*- coding: utf-8 -*-
"""A collection of functions to polish the representation of a """A collection of functions to polish the representation of a
publication in a list. publication in a list.
......
# -*- coding: utf-8 -*-
"""Definitions of the App tables """Definitions of the App tables
""" """
from callbacks import INHIBIT_CASCADE_DELETE from .callbacks import INHIBIT_CASCADE_DELETE
from gluon import current from gluon import current
from gluon.storage import Storage from gluon.storage import Storage
......
# -*- coding: utf-8 -*-
"""Definitions of the core tables """Definitions of the core tables
""" """
from callbacks import (INHIBIT_CASCADE_DELETE, from .callbacks import (INHIBIT_CASCADE_DELETE,
INHIBIT_DUPLICATE_PUBLICATION, INHIBIT_DUPLICATE_PUBLICATION,
INHIBIT_PUBLICATION_DELETE_ON_OK, INHIBIT_PUBLICATION_DELETE_ON_OK,
INHIBIT_PUBLICATION_UPDATE_ON_OK) INHIBIT_PUBLICATION_UPDATE_ON_OK)
from filters import (CLEAN_COLLABORATION, from .filters import (CLEAN_COLLABORATION,
CLEAN_COLLABORATION_SYNONYM, CLEAN_COLLABORATION_SYNONYM,
CLEAN_THESIS_DEFENSE) CLEAN_THESIS_DEFENSE)
...@@ -28,7 +27,7 @@ from plugin_dbui import (CLEAN_COMMA, ...@@ -28,7 +27,7 @@ from plugin_dbui import (CLEAN_COMMA,
UNDEF_ID) UNDEF_ID)
from pydal import Field from pydal import Field
from regex import (REG_COLLABORATION, from .regex import (REG_COLLABORATION,
REG_CONF_DATES, REG_CONF_DATES,
REG_DEFENSE, REG_DEFENSE,
REG_SUBMITTED, REG_SUBMITTED,
......
# -*- coding: utf-8 -*-
"""Definitions of the harveser's tables """Definitions of the harveser's tables
""" """
from callbacks import (INHIBIT_CASCADE_DELETE, from .callbacks import (INHIBIT_CASCADE_DELETE,
INHIBIT_CONTROLLER_INSERT, INHIBIT_CONTROLLER_INSERT,
INHIBIT_CONTROLLER_UPDATE, INHIBIT_CONTROLLER_UPDATE,
INHIBIT_HARVESTER) INHIBIT_HARVESTER)
......
# -*- coding: utf-8 -*-
"""Definitions of the report's tables """Definitions of the report's tables
""" """
from callbacks import INHIBIT_CASCADE_DELETE from .callbacks import INHIBIT_CASCADE_DELETE
from gluon.validators import IS_IN_DB, IS_IN_SET from gluon.validators import IS_IN_DB, IS_IN_SET
from plugin_dbui import (CLEAN_SPACES, from plugin_dbui import (CLEAN_SPACES,
......
# -*- coding: utf-8 -*-
"""Definitions of the selector(s) """Definitions of the selector(s)
""" """
...@@ -10,8 +9,8 @@ from gluon.validators import (IS_IN_DB, ...@@ -10,8 +9,8 @@ from gluon.validators import (IS_IN_DB,
IS_IN_SET, IS_IN_SET,
IS_MATCH) IS_MATCH)
from harvest_tools import DRY_RUN from .harvest_tools import DRY_RUN
from model_harvester import CONTROLLERS, STORES from .model_harvester import CONTROLLERS, STORES
from pydal import Field from pydal import Field
......
# *-* coding: utf-8 *-*
""" A collections of regular expression defining rules validating """ A collections of regular expression defining rules validating
fields content. fields content.
......
# -*- coding: utf-8 -*-
"""A collection of tools to build reports in controllers. """A collection of tools to build reports in controllers.
""" """
import re import re
from list_postprocessing import (clean, from .list_postprocessing import (clean,
highlight_my_authors, highlight_my_authors,
highlight_my_speaker, highlight_my_speaker,
remove_undef) remove_undef)
...@@ -178,7 +177,7 @@ def ref_url(name="List"): ...@@ -178,7 +177,7 @@ def ref_url(name="List"):
""" """
li = [] li = []
for (k, v) in request.vars.iteritems(): for k, v in request.vars.items():
if k.startswith(name) and len(v): if k.startswith(name) and len(v):
li.append("%s=%s" % (k, v)) li.append("%s=%s" % (k, v))
pass pass
......
# -*- coding: utf-8 -*-
"""User Interface for the App tables """User Interface for the App tables
""" """
......
# -*- coding: utf-8 -*-
"""User Interface for the authentication tables """User Interface for the authentication tables
""" """
......
# -*- coding: utf-8 -*-
"""User Interface for the core tables """User Interface for the core tables
""" """
from auth import USER from .auth import USER
from gluon import current from gluon import current
from plugin_dbui import (FieldsModifier, from plugin_dbui import (FieldsModifier,
FormModifier, FormModifier,
......
# -*- coding: utf-8 -*-
"""User Interface for the harvester tables """User Interface for the harvester tables
""" """
......
# -*- coding: utf-8 -*-
"""User Interface for the report tables """User Interface for the report tables
""" """
......
# -*- coding: utf-8 -*-
"""User Interface for the selector tables """User Interface for the selector tables
""" """
from auth import ADMIN from .auth import ADMIN
from gluon import current from gluon import current
from harvest_tools import DRY_RUN from .harvest_tools import DRY_RUN
from plugin_dbui import (FieldsModifier, from plugin_dbui import (FieldsModifier,
FormModifier) FormModifier)
......
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