From b509ff2f5faa63cca507505ede3d6708bfc4a8fa Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Tue, 9 Jun 2015 17:33:06 -0300 Subject: AttachmentsResource don't need querier anymore, RootResource doesn't need it too --- service/pixelated/resources/attachments_resource.py | 12 ++++++------ service/pixelated/resources/root_resource.py | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'service/pixelated/resources') diff --git a/service/pixelated/resources/attachments_resource.py b/service/pixelated/resources/attachments_resource.py index e0ba1bd1..83c7156d 100644 --- a/service/pixelated/resources/attachments_resource.py +++ b/service/pixelated/resources/attachments_resource.py @@ -27,15 +27,15 @@ class AttachmentResource(Resource): isLeaf = True - def __init__(self, attachment_id, querier): + def __init__(self, mail_service, attachment_id): Resource.__init__(self) self.attachment_id = attachment_id - self.querier = querier + self.mail_service = mail_service def render_GET(self, request): encoding = request.args.get('encoding', [None])[0] filename = request.args.get('filename', [self.attachment_id])[0] - attachment = self.querier.attachment(self.attachment_id, encoding) + attachment = self.mail_service.attachment(self.attachment_id, encoding) request.setHeader(b'Content-Type', b'application/force-download') request.setHeader(b'Content-Disposition', bytes('attachment; filename=' + filename)) @@ -57,9 +57,9 @@ class AttachmentResource(Resource): class AttachmentsResource(Resource): - def __init__(self, querier): + def __init__(self, mail_service): Resource.__init__(self) - self.querier = querier + self.mail_service = mail_service def getChild(self, attachment_id, request): - return AttachmentResource(attachment_id, self.querier) + return AttachmentResource(self.mail_service, attachment_id) diff --git a/service/pixelated/resources/root_resource.py b/service/pixelated/resources/root_resource.py index 4c0c47ac..c1111269 100644 --- a/service/pixelated/resources/root_resource.py +++ b/service/pixelated/resources/root_resource.py @@ -21,10 +21,10 @@ class RootResource(Resource): return self return Resource.getChild(self, path, request) - def initialize(self, querier, keymanager, search_engine, mail_service, draft_service): + def initialize(self, keymanager, search_engine, mail_service, draft_service): self.putChild('assets', File(self._static_folder)) self.putChild('keys', KeysResource(keymanager)) - self.putChild('attachment', AttachmentsResource(querier)) + self.putChild('attachment', AttachmentsResource(mail_service)) self.putChild('contacts', ContactsResource(search_engine)) self.putChild('features', FeaturesResource()) self.putChild('tags', TagsResource(search_engine)) @@ -32,7 +32,6 @@ class RootResource(Resource): self.putChild('mail', MailResource(mail_service)) def _get_static_folder(self): - static_folder = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", "web-ui", "app")) # this is a workaround for packaging if not os.path.exists(static_folder): -- cgit v1.2.3