From 7bb24ce03197e7e4fc561d53ada02bcec73d6057 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Wed, 6 Jan 2016 23:22:33 -0500 Subject: [PATCH] A little bit more refactoring, just to keep things cleaner. --- src/mailman/model/requests.py | 6 ++++-- src/mailman/rest/post_moderation.py | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mailman/model/requests.py b/src/mailman/model/requests.py index 69d8cf199..c7e61299c 100644 --- a/src/mailman/model/requests.py +++ b/src/mailman/model/requests.py @@ -29,6 +29,7 @@ from mailman.database.transaction import dbconnection from mailman.database.types import Enum from mailman.interfaces.pending import IPendable, IPendings from mailman.interfaces.requests import IListRequests, RequestType +from mailman.utilities.queries import QuerySequence from pickle import dumps, loads from sqlalchemy import Column, ForeignKey, Integer, Unicode from sqlalchemy.orm import relationship @@ -87,8 +88,9 @@ class ListRequests: @dbconnection def of_type(self, store, request_type): - return store.query(_Request).filter_by( - mailing_list=self.mailing_list, request_type=request_type) + return QuerySequence( + store.query(_Request).filter_by( + mailing_list=self.mailing_list, request_type=request_type)) @dbconnection def hold_request(self, store, request_type, key, data=None): diff --git a/src/mailman/rest/post_moderation.py b/src/mailman/rest/post_moderation.py index 746503ba9..ca3e228ba 100644 --- a/src/mailman/rest/post_moderation.py +++ b/src/mailman/rest/post_moderation.py @@ -31,7 +31,6 @@ from mailman.rest.helpers import ( CollectionMixin, bad_request, child, etag, no_content, not_found, okay, path_to) from mailman.rest.validator import Validator, enum_validator -from mailman.utilities.queries import QuerySequence from zope.component import getUtility @@ -149,7 +148,7 @@ class HeldMessages(_HeldMessageBase, CollectionMixin): def _get_collection(self, request): requests = IListRequests(self._mlist) - return QuerySequence(requests.of_type(RequestType.held_message)) + return requests.of_type(RequestType.held_message) def on_get(self, request, response): """/lists/listname/held""" -- 2.11.4.GIT