From 066d49b2c1c8319a5b7805b4a68a8ee2b1c59ad1 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Tue, 22 Jan 2013 22:18:08 +0100 Subject: [PATCH] user.get('moo') -> user.moo User fields are always existent, so there is no need to .get() them, just use them directly. Signed-off-by: Sebastian Spaeth --- mediagoblin/decorators.py | 4 ++-- mediagoblin/edit/views.py | 8 ++++---- mediagoblin/submit/views.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py index 804fab7e..09235614 100644 --- a/mediagoblin/decorators.py +++ b/mediagoblin/decorators.py @@ -32,11 +32,11 @@ def require_active_login(controller): @wraps(controller) def new_controller_func(request, *args, **kwargs): if request.user and \ - request.user.get('status') == u'needs_email_verification': + request.user.status == u'needs_email_verification': return redirect( request, 'mediagoblin.user_pages.user_home', user=request.user.username) - elif not request.user or request.user.get('status') != u'active': + elif not request.user or request.user.status != u'active': next_url = urljoin( request.urlgen('mediagoblin.auth.login', qualified=True), diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py index 24b0b69b..25a617fd 100644 --- a/mediagoblin/edit/views.py +++ b/mediagoblin/edit/views.py @@ -191,8 +191,8 @@ def edit_profile(request, url_user=None): user = url_user form = forms.EditProfileForm(request.form, - url=user.get('url'), - bio=user.get('bio')) + url=user.url, + bio=user.bio) if request.method == 'POST' and form.validate(): user.url = unicode(request.form['url']) @@ -218,8 +218,8 @@ def edit_profile(request, url_user=None): def edit_account(request): user = request.user form = forms.EditAccountForm(request.form, - wants_comment_notification=user.get('wants_comment_notification'), - license_preference=user.get('license_preference')) + wants_comment_notification=user.wants_comment_notification, + license_preference=user.license_preference) if request.method == 'POST': form_validated = form.validate() diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py index 4055d394..def7e839 100644 --- a/mediagoblin/submit/views.py +++ b/mediagoblin/submit/views.py @@ -41,7 +41,7 @@ def submit_start(request): First view for submitting a file. """ submit_form = submit_forms.SubmitStartForm(request.form, - license=request.user.get('license_preference')) + license=request.user.license_preference) if request.method == 'POST' and submit_form.validate(): if not ('file' in request.files -- 2.25.1