From d1a64326456d67d43ac99f28c2c45c7e9996be07 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Wed, 7 Sep 2011 23:23:44 -0500 Subject: [PATCH] Avoiding using '$or' query modifier since that's newer-mongo only. --- mediagoblin/auth/views.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index c18bfa34..666426e6 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -200,9 +200,12 @@ def forgot_password(request): fp_form = auth_forms.ForgotPassForm(request.POST) if request.method == 'POST' and fp_form.validate(): - user = request.db.User.one( - {'$or': [{'username': request.POST['username']}, - {'email': request.POST['username']}]}) + # '$or' not available till mongodb 1.5.3 + user = request.db.User.find_one( + {'username': request.POST['username']}) + if not user: + user = request.db.User.find_one( + {'email': request.POST['username']}) if user: user['fp_verification_key'] = unicode(uuid.uuid4()) -- 2.25.1