-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make MailMover an ABC and have FolderMailMover as a subclass #147
Conversation
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
67d7603
to
0c4d9e1
Compare
ping? |
Hello @kyrias I have checked the patch, to me it seems ok, but it would be better with a test don't you agree ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add unit test
I also really like this, however, I'm a bit unconfident to merge this as long as we don't have at least some tests for afew's main functions. |
Hey @kyrias , |
Hey, Because owner is not active and MailMover is a big feature for afew, |
Well, as written before, with a proper test suite we don't have to be afraid of merging this. I'd keep this open until we have one. |
Yes @flokli I was expecting this from you so I did not close it but if the owner will not upgrade the PR we finally need to create a new one with the tests |
@@ -25,19 +25,19 @@ | |||
from .Database import Database | |||
from .utils import get_message_summary | |||
from datetime import date, datetime, timedelta | |||
from abc import ABCMeta, abstractmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please sort import alphabetically
@@ -47,7 +47,47 @@ def __init__(self, max_age=0, rename = False, dry_run=False): | |||
self.dry_run = dry_run | |||
self.rename = rename | |||
|
|||
def get_new_name(self, fname, destination): | |||
@abstractmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the base class (ignoring the abstract here) provide a generic moving implementation?
Moving mails is the tricky part in this feature. We shouldn't encourage duplicating that effort.
Hello, @kyrias |
This is as a preparation for implementing a version of #88 as an option. It makes
MailMover
an Abstract Base Class which means that anything deriving from it has to implement the proper methods to be able to instantiate them at all.For an idea of how the end result will work, this PR adds a configuration option called
global.mail_mover_kind
which defaults tofolder
, which is the currentMailMover
behaviour. The follow-up PR with the functionality from #88 will addquery
as an option toglobal.mail_mover_kind
which will read rules from theQueryMailMover
configuration section and apply them as in #88.