Branch: refs/heads/master Author: Enrico Tröger enrico.troeger@uvena.de Committer: Enrico Tröger enrico.troeger@uvena.de Date: Tue, 14 May 2013 22:25:19 UTC Commit: 56a91ea400068767ed1003173c6b5801f9d1c026 https://github.com/geany/www.geany.org/commit/56a91ea400068767ed1003173c6b58...
Log Message: ----------- Fix using the correct Site object for the response URL
Modified Paths: -------------- pastebin/views.py
Modified: pastebin/views.py 16 files changed, 12 insertions(+), 4 deletions(-) =================================================================== @@ -3,12 +3,12 @@ # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. -# +# # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see http://www.gnu.org/licenses/.
@@ -234,6 +234,14 @@ def guess_lexer(request):
#---------------------------------------------------------------------- +def _get_site(request): + if hasattr(request, 'site'): + return request.site + else: + return Site.objects.get_current() + + +#---------------------------------------------------------------------- @require_POST @csrf_exempt def api_create(request): @@ -246,7 +254,7 @@ def api_create(request): except SnippetValidationError, e: return HttpResponseBadRequest(unicode(e), content_type=u'text/plain')
- site = Site.objects.get_current() + site = _get_site(request) absolute_url = snippet.get_absolute_url() - result = u'http://%s%s' % (site.domain, absolute_url) + result = u'http://%s%s/' % (site.domain, absolute_url) return HttpResponse(result, content_type=u'text/plain')
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).