diff --git a/docs/settings.rst b/docs/settings.rst index 7b0e082..e35f562 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -98,6 +98,8 @@ behavior without touching the code: Boolean. Whether to display the Gist button for re-pasting to GitHub. Default: ``True`` + ..warning: This feature was removed in v2.11. + ``DPASTE_DEFAULT_GIST_NAME`` String. The filename used when pasting a snippet on Github Gist. Default: ``dpaste.de_snippet.py`` diff --git a/dpaste/templates/dpaste/snippet_details.html b/dpaste/templates/dpaste/snippet_details.html index 31f349e..0b50c3d 100644 --- a/dpaste/templates/dpaste/snippet_details.html +++ b/dpaste/templates/dpaste/snippet_details.html @@ -67,10 +67,6 @@ {% if snippet.expire_type != 3 %} {% trans "View Raw" %} {% endif %} - {% if gist %} - {% trans "Gist" %} - {% endif %} {% if snippet.lexer != 'text' %} Wordwrap {% endif %} diff --git a/dpaste/urls/dpaste.py b/dpaste/urls/dpaste.py index b1a745b..ea0ddb9 100644 --- a/dpaste/urls/dpaste.py +++ b/dpaste/urls/dpaste.py @@ -15,6 +15,5 @@ urlpatterns = [ url(r'^(?P[a-zA-Z0-9]{%d,})/?$' % L, views.SnippetDetailView.as_view(), name='snippet_details'), url(r'^(?P[a-zA-Z0-9]{%d,})/delete/$' % L, views.SnippetDeleteView.as_view(), name='snippet_delete'), - url(r'^(?P[a-zA-Z0-9]{%d,})/gist/$' % L, views.snippet_gist, name='snippet_gist'), url(r'^(?P[a-zA-Z0-9]{%d,})/raw/?$' % L, views.SnippetRawView.as_view(), name='snippet_details_raw'), ] diff --git a/dpaste/views.py b/dpaste/views.py index b1e6e46..4d2591c 100644 --- a/dpaste/views.py +++ b/dpaste/views.py @@ -227,37 +227,6 @@ class SnippetDiffView(TemplateView): return ctx -def snippet_gist(request, snippet_id): # pragma: no cover - """ - Put a snippet on Github Gist. - """ - if not getattr(settings, 'DPASTE_ENABLE_GIST', True): - raise Http404('Gist creation is disabled on this installation.') - - snippet = get_object_or_404(Snippet, secret_id=snippet_id) - data = { - 'description': getattr(settings, 'DPASTE_DEFAULT_GIST_DESCRIPTION', ''), - 'public': False, - 'files': { - getattr(settings, 'DPASTE_DEFAULT_GIST_NAME', 'dpaste.de_snippet.py'): { - 'content': snippet.content, - } - } - } - - try: - payload = json.dumps(data) - response = requests.post('https://api.github.com/gists', data=payload) - response_dict = response.json() - gist_url = response_dict.get('html_url') - - # Github could be down, could return invalid JSON, it's rare - except: - return HttpResponse('Creating a Github Gist failed. Sorry, please go back and try again.') - - return HttpResponseRedirect(gist_url) - - # ----------------------------------------------------------------------------- # Static pages # -----------------------------------------------------------------------------