summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/pixelated/resources/attachments_resource.py5
-rw-r--r--service/test/unit/resources/test_attachments_resource.py3
2 files changed, 7 insertions, 1 deletions
diff --git a/service/pixelated/resources/attachments_resource.py b/service/pixelated/resources/attachments_resource.py
index fc3efee7..09715282 100644
--- a/service/pixelated/resources/attachments_resource.py
+++ b/service/pixelated/resources/attachments_resource.py
@@ -16,6 +16,7 @@
import cgi
import io
import re
+import logging
from twisted.internet import defer
from twisted.protocols.basic import FileSender
@@ -26,6 +27,8 @@ from twisted.web.server import NOT_DONE_YET
from pixelated.resources import respond_json_deferred
+logger = logging.getLogger(__name__)
+
class AttachmentResource(Resource):
isLeaf = True
@@ -95,7 +98,7 @@ class AttachmentsResource(Resource):
respond_json_deferred(response_json, request, status_code=201)
def error_handler(error):
- print error
+ logger.error(error)
respond_json_deferred({"message": "Something went wrong. Attachment not saved."}, request, status_code=500)
deferred.addCallback(send_location)
diff --git a/service/test/unit/resources/test_attachments_resource.py b/service/test/unit/resources/test_attachments_resource.py
index d7a35351..8beb02fa 100644
--- a/service/test/unit/resources/test_attachments_resource.py
+++ b/service/test/unit/resources/test_attachments_resource.py
@@ -1,5 +1,6 @@
import json
import unittest
+import logging
from mock import patch, MagicMock
from mockito import mock, when, verify
@@ -9,6 +10,8 @@ from twisted.web.test.requesthelper import DummyRequest
from pixelated.resources.attachments_resource import AttachmentsResource
from test.unit.resources import DummySite
+logging.getLogger('pixelated.resources.attachments_resource').addHandler(logging.NullHandler())
+
class AttachmentsResourceTest(unittest.TestCase):