Browse Source

[FIX] fixed, last review remarks

pull/614/head
archetipo 9 years ago
committed by Dave Lasley
parent
commit
76879083ba
  1. 3
      auto_backup/README.rst
  2. 2
      auto_backup/__init__.py
  3. 5
      auto_backup/__openerp__.py
  4. 2
      auto_backup/data/backup_data.xml
  5. 22
      auto_backup/model/backup_scheduler.py
  6. 2
      auto_backup/security/ir.model.access.csv
  7. 2
      auto_backup/view/bkp_conf_view.xml

3
auto_backup/README.rst

@ -1,8 +1,9 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
=================
Automated backups
===========
=================
A tool for all your back-ups, internal and external!

2
auto_backup/__init__.py

@ -22,4 +22,4 @@
from . import model
from . import tests
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

5
auto_backup/__openerp__.py

@ -22,7 +22,7 @@
{
"name": "Database Auto-Backup",
"version": "1.0",
"version": "8.0.1.0.0",
"author": (
"VanRoey.be - Yenthe Van Ginneken, Agile Business Group,"
" Odoo Community Association (OCA)"
@ -30,7 +30,7 @@
"website": "http://www.vanroey.be/applications/bedrijfsbeheer/odoo",
"category": "Tools",
"summary": "Backups data base",
"depends": ['base', 'email_template'],
"depends": ['email_template'],
"demo": [],
"data": [
"view/bkp_conf_view.xml",
@ -40,4 +40,3 @@
"active": False,
"installable": True
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

2
auto_backup/data/backup_data.xml

@ -15,4 +15,4 @@
<field eval="&quot;&quot;&quot;db.backup&quot;&quot;&quot;" name="model"/>
</record>
</data>
</openerp>
</openerp>

22
auto_backup/model/backup_scheduler.py

@ -25,16 +25,15 @@ import time
import datetime
import base64
import re
try:
import pysftp
except ImportError:
pass
from openerp import models, fields, api, _
from openerp.exceptions import except_orm, Warning
from openerp.exceptions import except_orm, Warning as UserError
from openerp import tools
import logging
_logger = logging.getLogger(__name__)
try:
import pysftp
except ImportError:
_logger.debug('Can not import pysftp')
def execute(connector, method, *args):
@ -238,7 +237,7 @@ class db_backup(models.Model):
messageContent + "%s") %
tools.ustr(e))
else:
raise Warning(_(messageTitle), _(messageContent))
raise UserError(_(messageTitle), _(messageContent))
@api.model
def schedule_backup(self):
@ -261,13 +260,12 @@ class db_backup(models.Model):
bkp = ''
bkp = execute(
conn, 'dump', rec.adminpassword, rec.name)
except:
except Exception, e:
_logger.info(
_(
"Couldn't backup database %s. "
"Bad database administrator"
"password for server running at http://%s:%s"
) % (rec.name, rec.host, rec.port))
"Autobackup Couldn't backup database %s. :" +
str(e))
)
return False
bkp = base64.decodestring(bkp)
fp = open(file_path, 'wb')

2
auto_backup/security/ir.model.access.csv

@ -1,2 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_db_backup,access_db_backup,model_db_backup,,1,0,0,0
access_db_backup,access_db_backup,model_db_backup,,1,0,0,0

2
auto_backup/view/bkp_conf_view.xml

@ -105,4 +105,4 @@
<menuitem parent="base.menu_config" action="action_backup_conf_form" id="backup_conf_menu"/>
</data>
</openerp>
</openerp>
Loading…
Cancel
Save