aboutsummaryrefslogtreecommitdiffstats
path: root/servo/lib
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-09-25 19:36:44 +0300
committerFilipp Lepalaan <filipp@mac.com>2015-09-25 19:36:44 +0300
commite807f83375e4f2c8b74658b22cf96e5a331f7409 (patch)
tree650fd41826aaa0f427a58eafb70a13b5897e4b7b /servo/lib
parent0d0ae66c37aa921ab31685ba4cbe74856d9e33c1 (diff)
downloadServo-e807f83375e4f2c8b74658b22cf96e5a331f7409.tar.gz
Servo-e807f83375e4f2c8b74658b22cf96e5a331f7409.tar.bz2
Servo-e807f83375e4f2c8b74658b22cf96e5a331f7409.zip
Added shortcuts
Diffstat (limited to 'servo/lib')
-rw-r--r--servo/lib/utils.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/servo/lib/utils.py b/servo/lib/utils.py
index a6b9e78..f2e0c21 100644
--- a/servo/lib/utils.py
+++ b/servo/lib/utils.py
@@ -1,15 +1,28 @@
# -*- coding: utf-8 -*-
import json
+import subprocess
from django.db.models import Model
+from django.http import HttpResponse
from django.core.serializers.json import DjangoJSONEncoder
+def csv_response(data):
+ """
+ Shortcut for sending a CSV response
+ """
+ return HttpResponse(data, content_type='text/csv')
+
+def json_response(data):
+ """
+ Shortcut for sending a JSON response
+ """
+ return HttpResponse(json.dumps(data), content_type='application/json')
+
def strip_keypass(keypass, infile, outfile):
"""
Strips a passphrase from a private key
"""
- import subprocess
subprocess.call(['openssl', 'rsa', '-passin', 'pass:' + keypass,
'-in', infile, '-out', outfile])