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
tev
plugin_event
Commits
328cd14f
Commit
328cd14f
authored
Nov 21, 2016
by
LE GAC Renaud
Browse files
Update classes defining the model to replace the method create by a constructor.
parent
33868299
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
44 deletions
+36
-44
modules/plugin_tev/model_core.py
modules/plugin_tev/model_core.py
+22
-25
modules/plugin_tev/model_report.py
modules/plugin_tev/model_report.py
+7
-9
modules/plugin_tev/model_selector.py
modules/plugin_tev/model_selector.py
+7
-10
No files found.
modules/plugin_tev/model_core.py
View file @
328cd14f
...
...
@@ -13,34 +13,16 @@ from pydal import Field
class
EvtModelCore
(
object
):
"""The core tables.
"""Create the history table and its foreign tables, including
alias table for object and people categories.
"""
@
staticmethod
def
_protect
(
table
):
"""protect the content of the table.
* Record containing the UNDEF string can not be update or delete.
* Inhibit cascade delte for foreign elements
Args:
table (pyDAL.Table): database table
Args:
db (pyDAL.DAL): database connection
T (): language translator
"""
table
.
_before_delete
.
append
(
INHIBIT_CASCADE_DELETE
)
table
.
_before_delete
.
append
(
dbui
.
INHIBIT_DELETE_UNDEF
)
table
.
_before_update
.
append
(
dbui
.
INHIBIT_UPDATE_UNDEF
)
@
staticmethod
def
create
(
db
,
T
):
"""Create all tables belonging to the core, including
alias table for object and people categories.
Args:
db (pyDAL.DAL): database connection
T (): language translator
"""
def
__init__
(
self
,
db
,
T
):
"""
# foreign tables
EvtModelCore
.
domains
(
db
,
T
)
EvtModelCore
.
events
(
db
,
T
)
...
...
@@ -59,6 +41,21 @@ class EvtModelCore(object):
db
.
object_categories
.
with_alias
(
"alias_object_categories"
)
db
.
people_categories
.
with_alias
(
"alias_people_categories"
)
@
staticmethod
def
_protect
(
table
):
"""protect the content of the table.
* Record containing the UNDEF string can not be update or delete.
* Inhibit cascade delte for foreign elements
Args:
table (pyDAL.Table): database table
"""
table
.
_before_delete
.
append
(
INHIBIT_CASCADE_DELETE
)
table
.
_before_delete
.
append
(
dbui
.
INHIBIT_DELETE_UNDEF
)
table
.
_before_update
.
append
(
dbui
.
INHIBIT_UPDATE_UNDEF
)
@
staticmethod
def
domains
(
db
,
T
):
"""domains table
...
...
modules/plugin_tev/model_report.py
View file @
328cd14f
...
...
@@ -78,18 +78,16 @@ TP_SORTERS = \
class
EvtModelReport
(
object
):
"""The report tables.
"""Create the tables for the reporting: lists, metrics1d, metrics2d,
and graphs.
"""
@
staticmethod
def
create
(
db
,
T
):
"""Create all the tables for reporting.
Args:
db (pyDAL.DAL): database connection
T (): language translator
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
"""
def
__init__
(
self
,
db
,
T
):
"""
EvtModelReport
.
graphs
(
db
,
T
)
EvtModelReport
.
lists
(
db
,
T
)
EvtModelReport
.
metrics1d
(
db
,
T
)
...
...
modules/plugin_tev/model_selector.py
View file @
328cd14f
...
...
@@ -12,19 +12,16 @@ TP_DATA = "The field history.data contains the given value."
class
EvtModelSelector
(
object
):
"""
T
he selector
tables
.
"""
Create the table defining t
he selector.
"""
@
staticmethod
d
ef
create
(
virtdb
,
db
,
T
):
"""Create all the tables for selec
tor
.
Args:
virtdb (pyDAL.DAL): connection to the virtual database
d
b (pyDAL.DAL): database connection
T (): language transla
tor
Args:
virtdb (pyDAL.DAL): connection to the virtual database
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
"""
def
__init__
(
self
,
virtdb
,
db
,
T
):
"""
EvtModelSelector
.
selector
(
virtdb
,
db
,
T
)
@
staticmethod
...
...
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