mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Pamhyr2: Some fixes to prepare db update to 0.1.0.
This commit is contained in:
1 parent
d8fe1d8b81
commit
16350b4dec
6 files changed
+42
-41
No files matched your search
@@ -105,7 +105,7 @@ class SQLModel(SQL):
|
||||
|
||||
ok = True
|
||||
for obj in objs:
|
||||
ok &= obj._db_save(fn)
|
||||
ok &= obj._db_save(fn, data={})
|
||||
|
||||
self.commit()
|
||||
return ok
|
||||
@@ -116,7 +116,7 @@ class SQLModel(SQL):
|
||||
def _count(self):
|
||||
raise NotImplementedMethodeError(self, self._count)
|
||||
|
||||
def _save_count(self, objs, data=None):
|
||||
def _save_count(self, objs, data={}):
|
||||
counter = {
|
||||
"insert": 0,
|
||||
"update": 0,
|
||||
@@ -137,7 +137,7 @@ class SQLModel(SQL):
|
||||
|
||||
ok = True
|
||||
for obj in objs:
|
||||
ok &= obj._db_save(fn)
|
||||
ok &= obj._db_save(fn, data=data)
|
||||
|
||||
logger.debug(counter)
|
||||
|
||||
@@ -218,8 +218,12 @@ class SQLSubModel(PamhyrID):
|
||||
raise NotImplementedMethodeError(cls, cls._db_load)
|
||||
|
||||
def _save_submodel(self, execute, objs, data=None):
|
||||
ok = True
|
||||
|
||||
for o in objs:
|
||||
o._db_save(execute, data=data)
|
||||
ok &= o._db_save(execute, data=data)
|
||||
|
||||
return ok
|
||||
|
||||
def _db_save(self, execute, data=None):
|
||||
"""Save class data to data base
|
||||
|
||||
Reference in new issue
Block a user