Browse Source

[FIX] fixed, last review remarks

pull/203/head
archetipo 9 years ago
parent
commit
75b7d1b496
  1. 3
      auto_backup/README.rst
  2. 2
      auto_backup/__init__.py
  3. 5
      auto_backup/__openerp__.py
  4. 22
      auto_backup/model/backup_scheduler.py

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:

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')

Loading…
Cancel
Save