示例#1
0
    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)
示例#2
0
    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)
示例#3
0
    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)
示例#4
0
 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)