ositah 25.6.dev1__py3-none-any.whl → 25.9.dev2__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.

Files changed (42) hide show
  1. ositah/app.py +17 -17
  2. ositah/apps/analysis.py +785 -785
  3. ositah/apps/configuration/callbacks.py +916 -916
  4. ositah/apps/configuration/main.py +546 -546
  5. ositah/apps/configuration/parameters.py +74 -74
  6. ositah/apps/configuration/tools.py +112 -112
  7. ositah/apps/export.py +1209 -1191
  8. ositah/apps/validation/callbacks.py +240 -240
  9. ositah/apps/validation/main.py +89 -89
  10. ositah/apps/validation/parameters.py +25 -25
  11. ositah/apps/validation/tables.py +646 -646
  12. ositah/apps/validation/tools.py +552 -552
  13. ositah/assets/arrow_down_up.svg +3 -3
  14. ositah/assets/ositah.css +53 -53
  15. ositah/assets/sort_ascending.svg +4 -4
  16. ositah/assets/sort_descending.svg +5 -5
  17. ositah/assets/sorttable.js +499 -499
  18. ositah/main.py +449 -449
  19. ositah/ositah.example.cfg +229 -229
  20. ositah/static/style.css +53 -53
  21. ositah/templates/base.html +22 -22
  22. ositah/templates/bootstrap_login.html +38 -38
  23. ositah/templates/login_form.html +26 -26
  24. ositah/utils/agents.py +124 -124
  25. ositah/utils/authentication.py +287 -287
  26. ositah/utils/cache.py +19 -19
  27. ositah/utils/core.py +13 -13
  28. ositah/utils/exceptions.py +64 -64
  29. ositah/utils/hito_db.py +51 -51
  30. ositah/utils/hito_db_model.py +253 -253
  31. ositah/utils/menus.py +339 -339
  32. ositah/utils/period.py +139 -139
  33. ositah/utils/projects.py +1179 -1178
  34. ositah/utils/teams.py +42 -42
  35. ositah/utils/utils.py +474 -474
  36. {ositah-25.6.dev1.dist-info → ositah-25.9.dev2.dist-info}/METADATA +149 -150
  37. ositah-25.9.dev2.dist-info/RECORD +46 -0
  38. {ositah-25.6.dev1.dist-info → ositah-25.9.dev2.dist-info}/licenses/LICENSE +29 -29
  39. ositah-25.6.dev1.dist-info/RECORD +0 -46
  40. {ositah-25.6.dev1.dist-info → ositah-25.9.dev2.dist-info}/WHEEL +0 -0
  41. {ositah-25.6.dev1.dist-info → ositah-25.9.dev2.dist-info}/entry_points.txt +0 -0
  42. {ositah-25.6.dev1.dist-info → ositah-25.9.dev2.dist-info}/top_level.txt +0 -0
@@ -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