aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2011-09-07 23:23:44 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2011-09-07 23:23:44 -0500
commitd1a64326456d67d43ac99f28c2c45c7e9996be07 (patch)
tree9b654dd37b5b3a8daab4650b75dcb17b099f0437
parentf03fef4ea8ec106f698936e2ffce02d58105f802 (diff)
downloadmediagoblin-d1a64326456d67d43ac99f28c2c45c7e9996be07.tar.lz
mediagoblin-d1a64326456d67d43ac99f28c2c45c7e9996be07.tar.xz
mediagoblin-d1a64326456d67d43ac99f28c2c45c7e9996be07.zip
Avoiding using '$or' query modifier since that's newer-mongo only.
-rw-r--r--mediagoblin/auth/views.py9
1 files 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())