def __init__ (self, path, prefix = None, root = None) : if not sos.path.isdir (path) : sos.mkdir (path) self.parser = Lib.Parser () self.__super.__init__ (path, prefix = prefix, root = root) for s in self._subdirs (path) : self._new_subbox (s)
def message_from_file(filename, parser=None): if parser is None: parser = Lib.Parser() with open(filename, "rb") as fp: email = parser.parse(fp) email._pma_parsed_body = True return PMA.Message(email, sos.path.split(filename)[-1])
def __init__ ( self, maildir, host, user , passwd = None , port = 110 , poll_interval = 10 ### in seconds , ** kw ) : self.maildir = maildir self.host = host self.port = port self.user = user self.passwd = passwd self.poll_interval = poll_interval self.finish = False self.parser = Lib.Parser () self.__super.__init__ (** kw)
def messages_from_args(args, base_dirs): parser = Lib.Parser() for arg in args: matches = tuple \ ( TFL.CAO.Rel_Path.resolved_paths (base_dirs, arg, single_match = False, skip_missing = True) ) if not matches and sos.path.exists(arg): matches = [arg] if len(matches) == 1: yield PMA.message_from_file(matches[0], parser) elif matches: print \ ( "Multiple matches for %r: choose one of\n %s" % (arg, "\n ".join (matches)) ) else: tail = ("in\n %s" % "\n ".join (base_dirs)) \ if base_dirs else "" print("No match found for %r%s" % (arg, tail))