def _compute_server_env(self): for fetchmail in self: global_section_name = 'incoming_mail' key_types = { 'port': int, 'is_ssl': lambda a: bool(int(a or 0)), 'attach': lambda a: bool(int(a or 0)), 'original': lambda a: bool(int(a or 0)), } # default vals config_vals = { 'port': 993, 'is_ssl': 0, 'attach': 0, 'original': 0, } if serv_config.has_section(global_section_name): config_vals.update(serv_config.items(global_section_name)) custom_section_name = '.'.join( (global_section_name, fetchmail.name)) if serv_config.has_section(custom_section_name): config_vals.update(serv_config.items(custom_section_name)) for key, to_type in key_types.items(): if config_vals.get(key): config_vals[key] = to_type(config_vals[key]) fetchmail.update(config_vals)
def _compute_server_env(self): for server in self: global_section_name = 'outgoing_mail' # default vals config_vals = {'smtp_port': 587} if serv_config.has_section(global_section_name): config_vals.update((serv_config.items(global_section_name))) custom_section_name = '.'.join((global_section_name, server.name)) if serv_config.has_section(custom_section_name): config_vals.update(serv_config.items(custom_section_name)) if config_vals.get('smtp_port'): config_vals['smtp_port'] = int(config_vals['smtp_port']) server.update(config_vals)
def _compute_server_env(self): for provider in self: provider_section_name = provider._get_provider_section_name() vals = {} if serv_config.has_section(provider_section_name): vals.update({'managed_by_env': True}) vals.update(serv_config.items(provider_section_name)) else: vals.update({'managed_by_env': False, 'enabled': False}) provider.update(vals)
def _get_receipt_environment_part(self, part): section_name = 'pos_environment_%s' % part line_list = [] if serv_config.has_section(section_name): # Parse each line for item in serv_config.items(section_name): if '__' not in item[0]: # Universal line line_list.append(item[1]) elif '__%s' % (self.env.user.lang) in item[0]: # depend of the language line_list.append(item[1]) return '\n'.join(line_list)
# Copyright (c) 2015-2016 ACSONE SA/NV (<http://acsone.eu>) # Copyright 2016 Camptocamp SA # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html) import logging from threading import Thread import time from odoo.service import server from odoo.tools import config try: from odoo.addons.server_environment import serv_config if serv_config.has_section('queue_job'): queue_job_config = serv_config['queue_job'] else: queue_job_config = {} except ImportError: queue_job_config = config.misc.get('queue_job', {}) from .runner import QueueJobRunner, _channels _logger = logging.getLogger(__name__) START_DELAY = 5 # Here we monkey patch the Odoo server to start the job runner thread # in the main server process (and not in forked workers). This is # very easy to deploy as we don't need another startup script. class QueueJobRunnerThread(Thread):
# Copyright (c) 2015-2016 ACSONE SA/NV (<http://acsone.eu>) # Copyright 2016 Camptocamp SA # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html) import logging from threading import Thread import time from odoo.service import server from odoo.tools import config try: from odoo.addons.server_environment import serv_config if serv_config.has_section("queue_job"): queue_job_config = serv_config["queue_job"] else: queue_job_config = {} except ImportError: queue_job_config = config.misc.get("queue_job", {}) from .runner import QueueJobRunner, _channels _logger = logging.getLogger(__name__) START_DELAY = 5 # Here we monkey patch the Odoo server to start the job runner thread # in the main server process (and not in forked workers). This is # very easy to deploy as we don't need another startup script.