From: Christopher Allan Webber Date: Thu, 8 Sep 2011 04:23:44 +0000 (-0500) Subject: Avoiding using '$or' query modifier since that's newer-mongo only. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=d1a64326456d67d43ac99f28c2c45c7e9996be07;p=mediagoblin.git Avoiding using '$or' query modifier since that's newer-mongo only. --- 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())