aboutsummaryrefslogtreecommitdiffstats
path: root/cloud_mdir_sync/maildir.py
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2020-02-05 11:37:54 -0400
committerJason Gunthorpe <jgg@mellanox.com>2020-02-07 11:25:26 -0400
commitbf72ac2c33516a951b7b156c10c4e753c781bfc2 (patch)
tree81e73d76e882546d8a4c6bc122b34bbbe492eebf /cloud_mdir_sync/maildir.py
parentfc7ff9fe8288b07442ae9c9a501190d935c1a5d7 (diff)
downloadcloud_mdir_sync-bf72ac2c33516a951b7b156c10c4e753c781bfc2.tar.gz
cloud_mdir_sync-bf72ac2c33516a951b7b156c10c4e753c781bfc2.tar.bz2
cloud_mdir_sync-bf72ac2c33516a951b7b156c10c4e753c781bfc2.zip
Lift Mailbox.cfg out of the sub classes
Make sure it is always set Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'cloud_mdir_sync/maildir.py')
-rw-r--r--cloud_mdir_sync/maildir.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/cloud_mdir_sync/maildir.py b/cloud_mdir_sync/maildir.py
index 7f298fb..ffb9d77 100644
--- a/cloud_mdir_sync/maildir.py
+++ b/cloud_mdir_sync/maildir.py
@@ -24,15 +24,14 @@ class MailDirMailbox(mailbox.Mailbox):
| messages.Message.FLAG_DELETED)
cfg: config.Config
- def __init__(self, directory):
- super().__init__()
+ def __init__(self, cfg: config.Config, directory: str):
+ super().__init__(cfg)
self.dfn = os.path.expanduser(directory)
for sub in ["tmp", "cur", "new"]:
os.makedirs(os.path.join(self.dfn, sub), mode=0o700, exist_ok=True)
- async def setup_mbox(self, cfg: config.Config):
- self.cfg = cfg
- cfg.watch_manager.add_watch(
+ async def setup_mbox(self):
+ self.cfg.watch_manager.add_watch(
path=[
os.path.join(self.dfn, "cur"),
os.path.join(self.dfn, "new")