Mercurial > p > roundup > code
changeset 1549:a53a7e197360
fixed rdbms email address lookup (case insensitivity)
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 24 Mar 2003 04:47:44 +0000 |
| parents | c36df13925f9 |
| children | 9b9917b7719b |
| files | CHANGES.txt roundup/backends/rdbms_common.py test/test_mailgw.py |
| diffstat | 3 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Mon Mar 24 02:56:30 2003 +0000 +++ b/CHANGES.txt Mon Mar 24 04:47:44 2003 +0000 @@ -82,6 +82,7 @@ - fixed sqlite rollback/caching bug (sf bug 689383) - fixed rdbms table update detection logic (sf bug 703297) - fixed detection of bad date specs (sf bug 691439) +- fixed rdbms email address lookup (case insensitivity) 2003-02-27 0.5.6
--- a/roundup/backends/rdbms_common.py Mon Mar 24 02:56:30 2003 +0000 +++ b/roundup/backends/rdbms_common.py Mon Mar 24 04:47:44 2003 +0000 @@ -1,4 +1,4 @@ -# $Id: rdbms_common.py,v 1.47 2003-03-21 04:02:13 richard Exp $ +# $Id: rdbms_common.py,v 1.48 2003-03-24 04:47:44 richard Exp $ ''' Relational database (SQL) backend common code. Basics: @@ -1718,7 +1718,7 @@ args.append(requirements[propname].lower()) # generate the where clause - s = ' and '.join(['_%s=%s'%(col, self.db.arg) for col in where]) + s = ' and '.join(['lower(_%s)=%s'%(col, self.db.arg) for col in where]) sql = 'select id from _%s where %s'%(self.classname, s) self.db.sql(sql, tuple(args)) l = [x[0] for x in self.db.sql_fetchall()]
--- a/test/test_mailgw.py Mon Mar 24 02:56:30 2003 +0000 +++ b/test/test_mailgw.py Mon Mar 24 04:47:44 2003 +0000 @@ -8,9 +8,10 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# $Id: test_mailgw.py,v 1.41 2003-03-13 09:27:24 kedder Exp $ +# $Id: test_mailgw.py,v 1.42 2003-03-24 04:47:44 richard Exp $ import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib +import rfc822 # Note: Should parse emails according to RFC2822 instead of performing a # literal string comparision. Parsing the messages allows the tests to work for @@ -20,7 +21,7 @@ #except ImportError : # import rfc822 as email -from roundup.mailgw import MailGW, Unauthorized +from roundup.mailgw import MailGW, Unauthorized, uidFromAddress from roundup import init, instance # TODO: make this output only enough equal lines for context, not all of @@ -909,6 +910,14 @@ self.compareStrings(self.db.msg.get(messageid, 'content'), expect) + def testUserLookup(self): + i = self.db.user.create(username='user1', address='user1@foo.com') + self.assertEqual(uidFromAddress(self.db, ('', 'user1@foo.com'), 0), i) + self.assertEqual(uidFromAddress(self.db, ('', 'USER1@foo.com'), 0), i) + i = self.db.user.create(username='user2', address='USER2@foo.com') + self.assertEqual(uidFromAddress(self.db, ('', 'USER2@foo.com'), 0), i) + self.assertEqual(uidFromAddress(self.db, ('', 'user2@foo.com'), 0), i) + def suite(): l = [unittest.makeSuite(MailgwTestCase), ]
