From f094e72788b79d1660875688091bcbb000e0320a Mon Sep 17 00:00:00 2001 From: Marco Rougeth Date: Sun, 4 May 2014 23:52:37 -0300 Subject: [PATCH 1/2] Fixing TypeError when creating gist --- dpaste/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpaste/views.py b/dpaste/views.py index 6e039bf..ff71c89 100644 --- a/dpaste/views.py +++ b/dpaste/views.py @@ -221,7 +221,7 @@ def snippet_gist(request, snippet_id): # pragma: no cover try: payload = json.dumps(data) response = requests.post('https://api.github.com/gists', data=payload) - response_dict = json.loads(response.content) + response_dict = response.json() gist_url = response_dict.get('html_url') # Github could be down, could return invalid JSON, it's rare From f7e954491c75b31b06e7a1eb26d0f8193bc422ad Mon Sep 17 00:00:00 2001 From: Marco Rougeth Date: Mon, 5 May 2014 00:02:54 -0300 Subject: [PATCH 2/2] Abstracting Gist's options --- dpaste/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dpaste/views.py b/dpaste/views.py index ff71c89..11d05ea 100644 --- a/dpaste/views.py +++ b/dpaste/views.py @@ -209,10 +209,10 @@ def snippet_gist(request, snippet_id): # pragma: no cover """ snippet = get_object_or_404(Snippet, secret_id=snippet_id) data = { - 'description': 'the description for this gist', + 'description': getattr(settings, 'DPASTE_DEFAULT_GIST_DESCRIPTION', 'the description for this gist'), 'public': False, 'files': { - 'dpaste.de_snippet.py': { + getattr(settings, 'DPASTE_DEFAULT_GIST_NAME', 'dpaste.de_snippet.py'): { 'content': snippet.content, } }