summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-10-04 13:29:01 -0500
committerDan McGee <dan@archlinux.org>2010-10-04 13:29:01 -0500
commit5e509529f00bd50ddfc6638d92c601209664d5d8 (patch)
treef153d41727cfd44ba3f4d3221c034e5ffdb8ed1f
parented49122429276ea1ee9b5b07507e9a3ba3f71cf2 (diff)
reporead: ignore nicknames in name matching code
-rw-r--r--devel/management/commands/reporead.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py
index 7c468001..544c4ecb 100644
--- a/devel/management/commands/reporead.py
+++ b/devel/management/commands/reporead.py
@@ -137,6 +137,10 @@ def find_user(userstring):
# one of the two name fields.
name_q = Q()
for token in name.split():
+ # ignore quoted parts; e.g. nicknames in strings
+ if re.match(r'^[\'"].*[\'"]$', token):
+ print "token match:", token
+ continue
name_q &= (Q(first_name__icontains=token) |
Q(last_name__icontains=token))
return User.objects.get(name_q)