ositah 25.6.dev1__py3-none-any.whl → 25.9.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ositah might be problematic. Click here for more details.
- ositah/app.py +17 -17
- ositah/apps/analysis.py +785 -785
- ositah/apps/configuration/callbacks.py +916 -916
- ositah/apps/configuration/main.py +546 -546
- ositah/apps/configuration/parameters.py +74 -74
- ositah/apps/configuration/tools.py +112 -112
- ositah/apps/export.py +1208 -1191
- ositah/apps/validation/callbacks.py +240 -240
- ositah/apps/validation/main.py +89 -89
- ositah/apps/validation/parameters.py +25 -25
- ositah/apps/validation/tables.py +646 -646
- ositah/apps/validation/tools.py +552 -552
- ositah/assets/arrow_down_up.svg +3 -3
- ositah/assets/ositah.css +53 -53
- ositah/assets/sort_ascending.svg +4 -4
- ositah/assets/sort_descending.svg +5 -5
- ositah/assets/sorttable.js +499 -499
- ositah/main.py +449 -449
- ositah/ositah.example.cfg +229 -229
- ositah/static/style.css +53 -53
- ositah/templates/base.html +22 -22
- ositah/templates/bootstrap_login.html +38 -38
- ositah/templates/login_form.html +26 -26
- ositah/utils/agents.py +124 -124
- ositah/utils/authentication.py +287 -287
- ositah/utils/cache.py +19 -19
- ositah/utils/core.py +13 -13
- ositah/utils/exceptions.py +64 -64
- ositah/utils/hito_db.py +51 -51
- ositah/utils/hito_db_model.py +253 -253
- ositah/utils/menus.py +339 -339
- ositah/utils/period.py +139 -139
- ositah/utils/projects.py +1178 -1178
- ositah/utils/teams.py +42 -42
- ositah/utils/utils.py +474 -474
- {ositah-25.6.dev1.dist-info → ositah-25.9.dev1.dist-info}/METADATA +149 -150
- ositah-25.9.dev1.dist-info/RECORD +46 -0
- {ositah-25.6.dev1.dist-info → ositah-25.9.dev1.dist-info}/licenses/LICENSE +29 -29
- ositah-25.6.dev1.dist-info/RECORD +0 -46
- {ositah-25.6.dev1.dist-info → ositah-25.9.dev1.dist-info}/WHEEL +0 -0
- {ositah-25.6.dev1.dist-info → ositah-25.9.dev1.dist-info}/entry_points.txt +0 -0
- {ositah-25.6.dev1.dist-info → ositah-25.9.dev1.dist-info}/top_level.txt +0 -0
ositah/utils/exceptions.py
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
# OSITAH exceptions not specific to one of the sub-application
|
|
2
|
-
|
|
3
|
-
from hito_tools.exceptions import EXIT_STATUS_GENERAL_ERROR
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class InvalidCallbackInput(Exception):
|
|
7
|
-
def __init__(self, input_name):
|
|
8
|
-
self.msg = f"internal error: invalid input ({input_name}) in callback"
|
|
9
|
-
self.status = EXIT_STATUS_GENERAL_ERROR
|
|
10
|
-
|
|
11
|
-
def __str__(self):
|
|
12
|
-
return repr(self.msg)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class InvalidDataSource(Exception):
|
|
16
|
-
def __init__(self, source):
|
|
17
|
-
self.msg = f"attempt to use and invalid data source ({source})"
|
|
18
|
-
self.status = EXIT_STATUS_GENERAL_ERROR
|
|
19
|
-
|
|
20
|
-
def __str__(self):
|
|
21
|
-
return repr(self.msg)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class InvalidHitoProjectName(Exception):
|
|
25
|
-
def __init__(self, projects):
|
|
26
|
-
self.msg = (
|
|
27
|
-
f"The following Hito project names don't match the format 'masterproject / project' :"
|
|
28
|
-
f" {', '.join(projects)}"
|
|
29
|
-
)
|
|
30
|
-
self.status = EXIT_STATUS_GENERAL_ERROR
|
|
31
|
-
|
|
32
|
-
def __str__(self):
|
|
33
|
-
return repr(self.msg)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class SessionDataMissing(Exception):
|
|
37
|
-
def __init__(self, session_id=None):
|
|
38
|
-
if session_id:
|
|
39
|
-
session_txt = f" (session={session_id})"
|
|
40
|
-
else:
|
|
41
|
-
session_txt = ""
|
|
42
|
-
self.msg = f"Attempt to use non existing session data{session_txt}"
|
|
43
|
-
self.status = EXIT_STATUS_GENERAL_ERROR
|
|
44
|
-
|
|
45
|
-
def __str__(self):
|
|
46
|
-
return repr(self.msg)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
class ValidationPeriodAmbiguous(Exception):
|
|
50
|
-
def __init__(self, date):
|
|
51
|
-
self.msg = f"Configuration error: several periods matching {date}"
|
|
52
|
-
self.status = EXIT_STATUS_GENERAL_ERROR
|
|
53
|
-
|
|
54
|
-
def __str__(self):
|
|
55
|
-
return repr(self.msg)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
class ValidationPeriodMissing(Exception):
|
|
59
|
-
def __init__(self, date):
|
|
60
|
-
self.msg = f"No defined declaration period matching {date}"
|
|
61
|
-
self.status = EXIT_STATUS_GENERAL_ERROR
|
|
62
|
-
|
|
63
|
-
def __str__(self):
|
|
64
|
-
return repr(self.msg)
|
|
1
|
+
# OSITAH exceptions not specific to one of the sub-application
|
|
2
|
+
|
|
3
|
+
from hito_tools.exceptions import EXIT_STATUS_GENERAL_ERROR
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class InvalidCallbackInput(Exception):
|
|
7
|
+
def __init__(self, input_name):
|
|
8
|
+
self.msg = f"internal error: invalid input ({input_name}) in callback"
|
|
9
|
+
self.status = EXIT_STATUS_GENERAL_ERROR
|
|
10
|
+
|
|
11
|
+
def __str__(self):
|
|
12
|
+
return repr(self.msg)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class InvalidDataSource(Exception):
|
|
16
|
+
def __init__(self, source):
|
|
17
|
+
self.msg = f"attempt to use and invalid data source ({source})"
|
|
18
|
+
self.status = EXIT_STATUS_GENERAL_ERROR
|
|
19
|
+
|
|
20
|
+
def __str__(self):
|
|
21
|
+
return repr(self.msg)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class InvalidHitoProjectName(Exception):
|
|
25
|
+
def __init__(self, projects):
|
|
26
|
+
self.msg = (
|
|
27
|
+
f"The following Hito project names don't match the format 'masterproject / project' :"
|
|
28
|
+
f" {', '.join(projects)}"
|
|
29
|
+
)
|
|
30
|
+
self.status = EXIT_STATUS_GENERAL_ERROR
|
|
31
|
+
|
|
32
|
+
def __str__(self):
|
|
33
|
+
return repr(self.msg)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class SessionDataMissing(Exception):
|
|
37
|
+
def __init__(self, session_id=None):
|
|
38
|
+
if session_id:
|
|
39
|
+
session_txt = f" (session={session_id})"
|
|
40
|
+
else:
|
|
41
|
+
session_txt = ""
|
|
42
|
+
self.msg = f"Attempt to use non existing session data{session_txt}"
|
|
43
|
+
self.status = EXIT_STATUS_GENERAL_ERROR
|
|
44
|
+
|
|
45
|
+
def __str__(self):
|
|
46
|
+
return repr(self.msg)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class ValidationPeriodAmbiguous(Exception):
|
|
50
|
+
def __init__(self, date):
|
|
51
|
+
self.msg = f"Configuration error: several periods matching {date}"
|
|
52
|
+
self.status = EXIT_STATUS_GENERAL_ERROR
|
|
53
|
+
|
|
54
|
+
def __str__(self):
|
|
55
|
+
return repr(self.msg)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class ValidationPeriodMissing(Exception):
|
|
59
|
+
def __init__(self, date):
|
|
60
|
+
self.msg = f"No defined declaration period matching {date}"
|
|
61
|
+
self.status = EXIT_STATUS_GENERAL_ERROR
|
|
62
|
+
|
|
63
|
+
def __str__(self):
|
|
64
|
+
return repr(self.msg)
|
ositah/utils/hito_db.py
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Module defining a few helper functions to access the DB through SQLAlchemy
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
import re
|
|
6
|
-
from uuid import uuid4
|
|
7
|
-
|
|
8
|
-
from flask import g
|
|
9
|
-
from sqlalchemy import event
|
|
10
|
-
from sqlalchemy.engine import Engine
|
|
11
|
-
from sqlalchemy.orm import scoped_session, sessionmaker
|
|
12
|
-
|
|
13
|
-
from ositah.app import app
|
|
14
|
-
from ositah.utils.utils import GlobalParams
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def new_uuid():
|
|
18
|
-
"""
|
|
19
|
-
Wrapper over uuid4() to return the UUID as a string. Allow using a callable in the column
|
|
20
|
-
default attribute (else it is interpreted as constant and the UUID is the same for every row).
|
|
21
|
-
|
|
22
|
-
:return: UUID string
|
|
23
|
-
"""
|
|
24
|
-
return str(uuid4())
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@event.listens_for(Engine, "connect")
|
|
28
|
-
def set_sqlite_pragma(dbapi_connection, connection_record):
|
|
29
|
-
if re.match("sqlite:", app.server.config["SQLALCHEMY_DATABASE_URI"]):
|
|
30
|
-
cursor = dbapi_connection.cursor()
|
|
31
|
-
cursor.execute("PRAGMA foreign_keys=ON")
|
|
32
|
-
cursor.close()
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def get_db(init_session: bool = True) -> None:
|
|
36
|
-
"""
|
|
37
|
-
Return the DB handler if already initialized, else create it and initialize a DB session
|
|
38
|
-
in the application context.
|
|
39
|
-
|
|
40
|
-
:param init_session: if True initialize a session if necessary
|
|
41
|
-
:return: DB handler
|
|
42
|
-
"""
|
|
43
|
-
global_params = GlobalParams()
|
|
44
|
-
|
|
45
|
-
with app.server.app_context():
|
|
46
|
-
if "db" not in g:
|
|
47
|
-
g.db = global_params.hito_db
|
|
48
|
-
if init_session and not g.db.session.bind:
|
|
49
|
-
g.db.session = scoped_session(sessionmaker(g.db.engine))
|
|
50
|
-
|
|
51
|
-
return g.db
|
|
1
|
+
"""
|
|
2
|
+
Module defining a few helper functions to access the DB through SQLAlchemy
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
from uuid import uuid4
|
|
7
|
+
|
|
8
|
+
from flask import g
|
|
9
|
+
from sqlalchemy import event
|
|
10
|
+
from sqlalchemy.engine import Engine
|
|
11
|
+
from sqlalchemy.orm import scoped_session, sessionmaker
|
|
12
|
+
|
|
13
|
+
from ositah.app import app
|
|
14
|
+
from ositah.utils.utils import GlobalParams
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def new_uuid():
|
|
18
|
+
"""
|
|
19
|
+
Wrapper over uuid4() to return the UUID as a string. Allow using a callable in the column
|
|
20
|
+
default attribute (else it is interpreted as constant and the UUID is the same for every row).
|
|
21
|
+
|
|
22
|
+
:return: UUID string
|
|
23
|
+
"""
|
|
24
|
+
return str(uuid4())
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@event.listens_for(Engine, "connect")
|
|
28
|
+
def set_sqlite_pragma(dbapi_connection, connection_record):
|
|
29
|
+
if re.match("sqlite:", app.server.config["SQLALCHEMY_DATABASE_URI"]):
|
|
30
|
+
cursor = dbapi_connection.cursor()
|
|
31
|
+
cursor.execute("PRAGMA foreign_keys=ON")
|
|
32
|
+
cursor.close()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def get_db(init_session: bool = True) -> None:
|
|
36
|
+
"""
|
|
37
|
+
Return the DB handler if already initialized, else create it and initialize a DB session
|
|
38
|
+
in the application context.
|
|
39
|
+
|
|
40
|
+
:param init_session: if True initialize a session if necessary
|
|
41
|
+
:return: DB handler
|
|
42
|
+
"""
|
|
43
|
+
global_params = GlobalParams()
|
|
44
|
+
|
|
45
|
+
with app.server.app_context():
|
|
46
|
+
if "db" not in g:
|
|
47
|
+
g.db = global_params.hito_db
|
|
48
|
+
if init_session and not g.db.session.bind:
|
|
49
|
+
g.db.session = scoped_session(sessionmaker(g.db.engine))
|
|
50
|
+
|
|
51
|
+
return g.db
|