mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 16:12:51 +11:00
Merge pull request #58 from interlegis/master
Fixing TypeError when creating gist
This commit is contained in:
commit
3944c4db90
1 changed files with 3 additions and 3 deletions
|
@ -209,10 +209,10 @@ def snippet_gist(request, snippet_id): # pragma: no cover
|
||||||
"""
|
"""
|
||||||
snippet = get_object_or_404(Snippet, secret_id=snippet_id)
|
snippet = get_object_or_404(Snippet, secret_id=snippet_id)
|
||||||
data = {
|
data = {
|
||||||
'description': 'the description for this gist',
|
'description': getattr(settings, 'DPASTE_DEFAULT_GIST_DESCRIPTION', 'the description for this gist'),
|
||||||
'public': False,
|
'public': False,
|
||||||
'files': {
|
'files': {
|
||||||
'dpaste.de_snippet.py': {
|
getattr(settings, 'DPASTE_DEFAULT_GIST_NAME', 'dpaste.de_snippet.py'): {
|
||||||
'content': snippet.content,
|
'content': snippet.content,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ def snippet_gist(request, snippet_id): # pragma: no cover
|
||||||
try:
|
try:
|
||||||
payload = json.dumps(data)
|
payload = json.dumps(data)
|
||||||
response = requests.post('https://api.github.com/gists', data=payload)
|
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')
|
gist_url = response_dict.get('html_url')
|
||||||
|
|
||||||
# Github could be down, could return invalid JSON, it's rare
|
# Github could be down, could return invalid JSON, it's rare
|
||||||
|
|
Loading…
Reference in a new issue