Esempio n. 1
0
 def _load_public_config(self):
     self.pub_config = ConfigDict(_rules=CONFIG_RULES)
     try:
         conffile = os.path.join(self.workdir, 'mailpile.rc')
         with open(conffile) as fd:
             self.pub_config.parse_config(None, fd.read(), source=conffile)
         self.base_url = 'http://%s:%s%s/' % (self.pub_config.sys.http_host,
                                              self.pub_config.sys.http_port,
                                              self.pub_config.sys.http_path)
     except:
         import traceback
         sys.stderr.write(traceback.format_exc())
Esempio n. 2
0
def autotag_configs(config):
    done = []
    for at_config in config.prefs.autotag:
        yield at_config
        done.append(at_config.match_tag)
    for tid, tag_info in config.tags.iteritems():
        auto_tagging = tag_info.auto_tag
        if (tid not in done
                and auto_tagging.lower() not in ('', 'off', 'false')):
            at_config = ConfigDict(_rules=AUTO_TAG_CONFIG)
            at_config.match_tag = tid
            at_config.tagger = auto_tagging
            yield at_config
Esempio n. 3
0
def autotag_configs(config):
    done = []
    for at_config in config.prefs.autotag:
        yield at_config
        done.append(at_config.match_tag)

    taggers = [k for k in TAGGERS.keys() if k != '_default']
    if not taggers:
        return

    for tid, tag_info in config.tags.iteritems():
        auto_tagging = (tag_info.auto_tag or '')
        if (tid not in done and auto_tagging.lower() not in AUTO_TAG_DISABLED):
            at_config = ConfigDict(_rules=AUTO_TAG_CONFIG)
            at_config.match_tag = tid
            if auto_tagging not in taggers:
                auto_tagging = taggers[0]
            at_config.tagger = auto_tagging
            at_config.trainer = auto_tagging
            yield at_config
Esempio n. 4
0
                'process_new': (_('Is a potential source of new mail'), bool,
                                True),
                'apply_tags': (_('Tags applied to messages'), str, []),
                'max_mailboxes': (_('Max mailboxes to add'), int, 100),
            }),
            'mailbox': (_('Mailboxes'), {
                'name': (_('The name of this mailbox'), str, ''),
                'path': (_('Mailbox source path'), str, ''),
                'policy':
                (_('Mailbox policy'),
                 ['unknown', 'ignore', 'read', 'move', 'sync',
                  'inherit'], 'inherit'),
                'local': (_('Local mailbox path'), 'bin', ''),
                'process_new': (_('Is a source of new mail'), bool, True),
                'primary_tag': (_('A tag representing this mailbox'), str, ''),
                'apply_tags': (_('Tags applied to messages'), str, []),
            }, {})
        },
        {}
    ]
}

if __name__ == "__main__":
    import mailpile.config.defaults
    from mailpile.config.base import ConfigDict

    print '%s' % (ConfigDict(
        _name='mailpile',
        _comment='Base configuration',
        _rules=mailpile.config.defaults.CONFIG_RULES).as_config_bytes(), )