summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorNavaL <mnandri@thoughtworks.com>2016-01-18 18:27:31 +0100
committerNavaL <mnandri@thoughtworks.com>2016-01-18 18:27:31 +0100
commit66a47fa2345775037b127c295f8611534527fadc (patch)
tree6341e95521b0788c979f332edaaf1331733624d8 /service
parentaa5eeee6bab6721f89860690ae76ba70768104e4 (diff)
migrating mail resources to use services factory
Issue #576
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/resources/mail_resource.py12
-rw-r--r--service/pixelated/resources/root_resource.py2
2 files changed, 7 insertions, 7 deletions
diff --git a/service/pixelated/resources/mail_resource.py b/service/pixelated/resources/mail_resource.py
index 3d151777..3661be9d 100644
--- a/service/pixelated/resources/mail_resource.py
+++ b/service/pixelated/resources/mail_resource.py
@@ -1,5 +1,5 @@
import json
-from pixelated.resources import respond_json, respond_json_deferred
+from pixelated.resources import respond_json, respond_json_deferred, BaseResource
from pixelated.support import replier
from twisted.web.resource import Resource
from twisted.web.server import NOT_DONE_YET
@@ -62,11 +62,11 @@ class Mail(Resource):
return NOT_DONE_YET
-class MailResource(Resource):
+class MailResource(BaseResource):
- def __init__(self, mail_service):
- Resource.__init__(self)
- self._mail_service = mail_service
+ def __init__(self, services_factory):
+ BaseResource.__init__(self, services_factory)
def getChild(self, mail_id, request):
- return Mail(mail_id, self._mail_service)
+ _mail_service = self.mail_service(request)
+ return Mail(mail_id, _mail_service)
diff --git a/service/pixelated/resources/root_resource.py b/service/pixelated/resources/root_resource.py
index eefa9835..93f90ee1 100644
--- a/service/pixelated/resources/root_resource.py
+++ b/service/pixelated/resources/root_resource.py
@@ -46,7 +46,7 @@ class RootResource(Resource):
self.putChild('features', FeaturesResource())
self.putChild('tags', TagsResource(services_factory))
self.putChild('mails', MailsResource(services_factory))
- self.putChild('mail', MailResource(mail_service))
+ self.putChild('mail', MailResource(services_factory))
self.putChild('feedback', FeedbackResource(feedback_service))
self.putChild('user-settings', UserSettingsResource(self.account_email))