Skip to content

Commit 6cd5768

Browse files
author
Richard Jones
committed
fixed rdbms email address lookup (case insensitivity)
1 parent 4a80a60 commit 6cd5768

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Fixed:
8282
- fixed sqlite rollback/caching bug (sf bug 689383)
8383
- fixed rdbms table update detection logic (sf bug 703297)
8484
- fixed detection of bad date specs (sf bug 691439)
85+
- fixed rdbms email address lookup (case insensitivity)
8586

8687

8788
2003-02-27 0.5.6

roundup/backends/rdbms_common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: rdbms_common.py,v 1.47 2003-03-21 04:02:13 richard Exp $
1+
# $Id: rdbms_common.py,v 1.48 2003-03-24 04:47:44 richard Exp $
22
''' Relational database (SQL) backend common code.
33
44
Basics:
@@ -1718,7 +1718,7 @@ def stringFind(self, **requirements):
17181718
args.append(requirements[propname].lower())
17191719

17201720
# generate the where clause
1721-
s = ' and '.join(['_%s=%s'%(col, self.db.arg) for col in where])
1721+
s = ' and '.join(['lower(_%s)=%s'%(col, self.db.arg) for col in where])
17221722
sql = 'select id from _%s where %s'%(self.classname, s)
17231723
self.db.sql(sql, tuple(args))
17241724
l = [x[0] for x in self.db.sql_fetchall()]

test/test_mailgw.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
# but WITHOUT ANY WARRANTY; without even the implied warranty of
99
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1010
#
11-
# $Id: test_mailgw.py,v 1.41 2003-03-13 09:27:24 kedder Exp $
11+
# $Id: test_mailgw.py,v 1.42 2003-03-24 04:47:44 richard Exp $
1212

1313
import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib
14+
import rfc822
1415

1516
# Note: Should parse emails according to RFC2822 instead of performing a
1617
# literal string comparision. Parsing the messages allows the tests to work for
@@ -20,7 +21,7 @@
2021
#except ImportError :
2122
# import rfc822 as email
2223

23-
from roundup.mailgw import MailGW, Unauthorized
24+
from roundup.mailgw import MailGW, Unauthorized, uidFromAddress
2425
from roundup import init, instance
2526

2627
# TODO: make this output only enough equal lines for context, not all of
@@ -909,6 +910,14 @@ def innerTestQuoting(self, expect):
909910

910911
self.compareStrings(self.db.msg.get(messageid, 'content'), expect)
911912

913+
def testUserLookup(self):
914+
i = self.db.user.create(username='user1', address='[email protected]')
915+
self.assertEqual(uidFromAddress(self.db, ('', '[email protected]'), 0), i)
916+
self.assertEqual(uidFromAddress(self.db, ('', '[email protected]'), 0), i)
917+
i = self.db.user.create(username='user2', address='[email protected]')
918+
self.assertEqual(uidFromAddress(self.db, ('', '[email protected]'), 0), i)
919+
self.assertEqual(uidFromAddress(self.db, ('', '[email protected]'), 0), i)
920+
912921
def suite():
913922
l = [unittest.makeSuite(MailgwTestCase),
914923
]

0 commit comments

Comments
 (0)