webob.HTTPFound --> MG.tools.redirect

Transition away from webob.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2012-11-16 11:05:08 +01:00
parent 62d14bf50b
commit 950124e640
3 changed files with 8 additions and 13 deletions

View File

@ -17,8 +17,6 @@
import uuid
import datetime
from webob import exc
from mediagoblin import messages
from mediagoblin import mg_globals
from mediagoblin.tools.response import render_to_response, redirect, render_404
@ -129,7 +127,7 @@ def login(request):
request.session.save()
if request.form.get('next'):
return exc.HTTPFound(location=request.form['next'])
return redirect(request, location=request.form['next'])
else:
return redirect(request, "index")

View File

@ -14,7 +14,6 @@
# 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/>.
from webob import exc
from cgi import FieldStorage
from datetime import datetime
@ -76,8 +75,8 @@ def edit_media(request, media):
media.save()
return exc.HTTPFound(
location=media.url_for_self(request.urlgen))
return redirect(request,
location=media.url_for_self(request.urlgen))
if request.user.is_admin \
and media.uploader != request.user.id \
@ -158,8 +157,8 @@ def edit_attachments(request, media):
% (request.form['attachment_name']
or request.files['attachment_file'].filename))
return exc.HTTPFound(
location=media.url_for_self(request.urlgen))
return redirect(request,
location=media.url_for_self(request.urlgen))
return render_to_response(
request,
'mediagoblin/edit/attachments.html',

View File

@ -14,7 +14,6 @@
# 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/>.
from webob import exc
import logging
import datetime
@ -167,8 +166,7 @@ def media_post_comment(request, media):
media_uploader.wants_comment_notification):
send_comment_email(media_uploader, comment, media, request)
return exc.HTTPFound(
location=media.url_for_self(request.urlgen))
return redirect(request, location=media.url_for_self(request.urlgen))
@get_user_media_entry
@ -302,8 +300,8 @@ def media_confirm_delete(request, media):
messages.add_message(
request, messages.ERROR,
_("The media was not deleted because you didn't check that you were sure."))
return exc.HTTPFound(
location=media.url_for_self(request.urlgen))
return redirect(request,
location=media.url_for_self(request.urlgen))
if ((request.user.is_admin and
request.user.id != media.uploader)):