Browse Source
[IMP] only commit where absolutely necessary, mute pylint there
pull/469/head
Holger Brunn
9 years ago
No known key found for this signature in database
GPG Key ID: 1C9760FECA3AE18
4 changed files with
6 additions and
4 deletions
-
database_cleanup/models/purge_columns.py
-
database_cleanup/models/purge_models.py
-
database_cleanup/models/purge_modules.py
-
database_cleanup/models/purge_tables.py
|
@ -46,7 +46,9 @@ class CleanupPurgeLineColumn(models.TransientModel): |
|
|
IdentifierAdapter(line.name) |
|
|
IdentifierAdapter(line.name) |
|
|
)) |
|
|
)) |
|
|
line.write({'purged': True}) |
|
|
line.write({'purged': True}) |
|
|
self.env.cr.commit() |
|
|
|
|
|
|
|
|
# we need this commit because the ORM will deadlock if |
|
|
|
|
|
# we still have a pending transaction |
|
|
|
|
|
self.env.cr.commit() # pylint: disable=invalid-commit |
|
|
return True |
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -93,7 +93,6 @@ class CleanupPurgeLineModel(models.TransientModel): |
|
|
self.env['ir.model'].browse([row[0]])\ |
|
|
self.env['ir.model'].browse([row[0]])\ |
|
|
.with_context(**context_flags).unlink() |
|
|
.with_context(**context_flags).unlink() |
|
|
line.write({'purged': True}) |
|
|
line.write({'purged': True}) |
|
|
self.env.cr.commit() |
|
|
|
|
|
return True |
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -49,7 +49,9 @@ class CleanupPurgeLineModule(models.TransientModel): |
|
|
return True |
|
|
return True |
|
|
self.logger.info('Purging modules %s', ', '.join(module_names)) |
|
|
self.logger.info('Purging modules %s', ', '.join(module_names)) |
|
|
modules.write({'state': 'to remove'}) |
|
|
modules.write({'state': 'to remove'}) |
|
|
self.env.cr.commit() |
|
|
|
|
|
|
|
|
# we need this commit because reloading the registry would roll back |
|
|
|
|
|
# our changes |
|
|
|
|
|
self.env.cr.commit() # pylint: disable=invalid-commit |
|
|
RegistryManager.new(self.env.cr.dbname, update_module=True) |
|
|
RegistryManager.new(self.env.cr.dbname, update_module=True) |
|
|
modules.unlink() |
|
|
modules.unlink() |
|
|
return self.write({'purged': True}) |
|
|
return self.write({'purged': True}) |
|
|
|
@ -62,7 +62,6 @@ class CleanupPurgeLineTable(models.TransientModel): |
|
|
self.env.cr.execute( |
|
|
self.env.cr.execute( |
|
|
"DROP TABLE %s", (IdentifierAdapter(line.name),)) |
|
|
"DROP TABLE %s", (IdentifierAdapter(line.name),)) |
|
|
line.write({'purged': True}) |
|
|
line.write({'purged': True}) |
|
|
self.env.cr.commit() |
|
|
|
|
|
return True |
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|