summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorNavaL <mnandri@thoughtworks.com>2016-01-18 18:41:27 +0100
committerNavaL <mnandri@thoughtworks.com>2016-01-18 18:51:58 +0100
commitd1ae71f6bab08d6339b72e4fe6b817404f64b0b2 (patch)
treeba56571b71a2750cf39e007add28b5559e021631 /service
parentdfd5897b632f846f64b57108895fbbbe1a817290 (diff)
migrating account settings resource to use services factory
Issue #576
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/resources/root_resource.py3
-rw-r--r--service/pixelated/resources/user_settings_resource.py14
2 files changed, 7 insertions, 10 deletions
diff --git a/service/pixelated/resources/root_resource.py b/service/pixelated/resources/root_resource.py
index 2adde991..affa3713 100644
--- a/service/pixelated/resources/root_resource.py
+++ b/service/pixelated/resources/root_resource.py
@@ -38,7 +38,6 @@ class RootResource(Resource):
def initialize(self, services_factory, keymanager, search_engine, mail_service, draft_service, feedback_service):
self.account_email = mail_service.account_email
-
self.putChild('assets', File(self._static_folder))
self.putChild('keys', KeysResource(services_factory))
self.putChild(AttachmentsResource.BASE_URL, AttachmentsResource(services_factory))
@@ -48,7 +47,7 @@ class RootResource(Resource):
self.putChild('mails', MailsResource(services_factory))
self.putChild('mail', MailResource(services_factory))
self.putChild('feedback', FeedbackResource(services_factory))
- self.putChild('user-settings', UserSettingsResource(self.account_email))
+ self.putChild('user-settings', UserSettingsResource(services_factory))
self._mode = MODE_RUNNING
diff --git a/service/pixelated/resources/user_settings_resource.py b/service/pixelated/resources/user_settings_resource.py
index 034dca15..5b3f0051 100644
--- a/service/pixelated/resources/user_settings_resource.py
+++ b/service/pixelated/resources/user_settings_resource.py
@@ -13,18 +13,16 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
-import json
-from twisted.web.resource import Resource
-from pixelated.resources import respond_json
+from pixelated.resources import respond_json, BaseResource
-class UserSettingsResource(Resource):
+class UserSettingsResource(BaseResource):
isLeaf = True
- def __init__(self, account_email):
- Resource.__init__(self)
- self.account_email = account_email
+ def __init__(self, services_factory):
+ BaseResource.__init__(self, services_factory)
def render_GET(self, request):
- return respond_json({'account_email': self.account_email}, request)
+ _account_email = self.mail_service(request).account_email
+ return respond_json({'account_email': _account_email}, request)