<commit_before># coding: utf-8
# Copyright 2014 <NAME> @ Akretion <<EMAIL>>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import models, fields, api
from openerp.exceptions import Warning as UserError
from openerp.tools.config import config


def _get_authorized_password():
    """ You can define your own authorized keys
    """
    return [config.get("secure_uninstall")]


class BaseModuleUpgrade(models.TransientModel):
    _inherit = 'base.module.upgrade'

    uninstall_password = fields.Char(
        string='Password',
        help="'secure_uninstall' value from Odoo configuration file ")

    @api.multi
    def upgrade_module(self):
        for elm in self:
            if not config.get("secure_uninstall"):
                raise UserError(
                    "Missing configuration key\n--------------------\n"
                    "'secure_uninstall' configuration key "
                    "is not set in \n"
                    "your Odoo server configuration file: "
                    "please set it a value")
            if elm.uninstall_password not in _get_authorized_password():
                raise UserError(<commit_msg>[IMP] add more logical keys in _get_authorized_password()<commit_after># coding: utf-8
# Copyright 2014 <NAME> @ Akretion <<EMAIL>>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import models, fields, api
from openerp.exceptions import Warning as UserError
from openerp.tools.config import config


def _get_authorized_password():
    """ You can define your own authorized keys
    """
    return [config.get("secure_uninstall"), config.get("admin_passwd")]


class BaseModuleUpgrade(models.TransientModel):
    _inherit = 'base.module.upgrade'

    uninstall_password = fields.Char(
        string='Password',
        help="'secure_uninstall' value from Odoo configuration file ")

    @api.multi
    def upgrade_module(self):
        for elm in self:
            if not config.get("secure_uninstall"):
                raise UserError(
                    "Missing configuration key\n--------------------\n"
                    "'secure_uninstall' configuration key "
                    "is not set in \n"
                    "your Odoo server configuration file: "
                    "please set it a value")
            if elm.uninstall_password not in _get_authorized_password():
                raise UserError(
{'fraction_non_alphanumeric': 0.10737704918032787, 'fraction_numerical': 0.005737704918032787, 'mean_word_length': 2.330150068212824, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5505056', 'n_tokens_mistral': 678, 'n_tokens_neox': 633, 'n_words': 192}