示例#1
0
def new_dispatch(*args):
    i = LooseVersion(release.major_version) < LooseVersion('8.0') and 1 or 0
    method = args[i]
    if method in additional_methods:
        params = args[i + 1]
        admin_passwd, params = params[0], params[1:]
        check_super(admin_passwd)
        return getattr(NewServices, method)(*params)
    return native_dispatch(*args)
示例#2
0
 def restore(self, master_pwd, backup_file, name, copy=False):
     try:
         data_file = None
         db.check_super(master_pwd)
         with tempfile.NamedTemporaryFile(delete=False) as data_file:
             backup_file.save(data_file)
         db.restore_db(name, data_file.name, str2bool(copy))
         return http.local_redirect('/web/v2/manager')
     except Exception as e:
         error = "Database restore error: %s" % (str(e) or repr(e))
         return self._render_template(error=error)
     finally:
         if data_file:
             os.unlink(data_file.name)
示例#3
0
 def restore(self, master_pwd, backup_file, name, copy=False):
     insecure = odoo.tools.config.verify_admin_password('admin')
     if insecure and master_pwd:
         dispatch_rpc('db', 'change_admin_password', ["admin", master_pwd])
     try:
         data_file = None
         db.check_super(master_pwd)
         with tempfile.NamedTemporaryFile(delete=False) as data_file:
             backup_file.save(data_file)
         db.restore_db(name, data_file.name, str2bool(copy))
         return request.redirect('/web/database/manager')
     except Exception as e:
         error = "Database restore error: %s" % (str(e) or repr(e))
         return self._render_template(error=error)
     finally:
         if data_file:
             os.unlink(data_file.name)
示例#4
0
 def check_super(self, passwd):
     return check_super(passwd)
示例#5
0
文件: res_users.py 项目: anybox/odoo
 def check_super(self, passwd):
     return check_super(passwd)