Abstract out MailMover from mail selection#249
Open
kyrias wants to merge 3 commits intoafewmail:masterfrom
Open
Abstract out MailMover from mail selection#249kyrias wants to merge 3 commits intoafewmail:masterfrom
kyrias wants to merge 3 commits intoafewmail:masterfrom
Conversation
Contributor
Author
|
With this implementation, the fully query-based mover ends up as just: class QueryMailMover(AbstractMailMover):
def __init__(self, max_age=0, *args, **kwargs):
super(QueryMailMover, self).__init__(*args, **kwargs)
self.query = '{subquery}'
if max_age:
days = timedelta(int(max_age))
start = date.today() - days
now = datetime.now()
self.query += ' AND {start}..{now}'.format(start=start.strftime('%s'),
now=now.strftime('%s'))
def find_matching(self, rule_name, query):
main_query = self.query.format(subquery=query)
for message in self.db.do_query(main_query).search_messages():
for fname in [fname for fname in message.get_filenames()]:
yield (message, fname) |
Contributor
Author
|
Nevermind, I had just forgotten to hook it up in |
8719253 to
7efa7a2
Compare
This allows implementing multiple move strategies. Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
7efa7a2 to
6eac6ea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New iteration of #147.