user.get('moo') -> user.moo
authorSebastian Spaeth <Sebastian@SSpaeth.de>
Tue, 22 Jan 2013 21:18:08 +0000 (22:18 +0100)
committerSebastian Spaeth <Sebastian@SSpaeth.de>
Tue, 22 Jan 2013 21:18:08 +0000 (22:18 +0100)
User fields are always existent, so there is no need to .get() them,
just use them directly.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
mediagoblin/decorators.py
mediagoblin/edit/views.py
mediagoblin/submit/views.py

index 804fab7e17e3c3cd8d89d9528feeb84061bb86b9..092356144931b1121d94e2ce380cf3dcd1af9125 100644 (file)
@@ -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),
index 24b0b69b63644ac1ec273ecb4c227fad2aa689b0..25a617fd3fdfab3dc537442661a54286ae96e05d 100644 (file)
@@ -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()
index 4055d394c4cad9bb131d6019139e859e19f56b28..def7e839dbad3921c702e0c88beb63ab2aff1f7d 100644 (file)
@@ -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