# Copyright (C) 2016 Linaro Limited # # Author: Stevan Radakovic # # This file is part of Lava Server. # # Lava Server is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License version 3 # as published by the Free Software Foundation # # Lava Server 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 General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with Lava Server. If not, see . from django.http import HttpResponseNotAllowed def post_only(func): def decorated(request, *args, **kwargs): if request.method != 'POST': return HttpResponseNotAllowed('Only POST here') return func(request, *args, **kwargs) return decorated