Mercurial > p > roundup > code
annotate roundup/anypy/dbm_.py @ 4531:ddff9669361b
Fix matching of incoming email addresses to the alternate_addresses field...
...of a user -- this would match substrings, e.g. if the user has
discuss-support@example.com as an alternate email and an incoming mail
is addressed to support@example.com this would (wrongly) match.
Note: I *think* I've seen this discussed somewhere but couldn't find it,
neither in the tracker nor in recent discussions on the mailinglists.
So if someone remembers an issue which now should be closed, please
tell me :-)
| author | Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net> |
|---|---|
| date | Wed, 24 Aug 2011 14:43:52 +0000 |
| parents | 0d9369d35483 |
| children | d5da643b3d25 |
| rev | line source |
|---|---|
| 4360 | 1 # In Python 3 the "anydbm" module was renamed to be "dbm" which is now a |
| 2 # package containing the various implementations. The "wichdb" module's | |
| 3 # whichdb() function was moved to the new "dbm" module. | |
| 4 | |
|
4383
0d9369d35483
fix up some pre-Python2.6 compatibility issues in the *dbm interface
Richard Jones <richard@users.sourceforge.net>
parents:
4360
diff
changeset
|
5 import sys |
|
0d9369d35483
fix up some pre-Python2.6 compatibility issues in the *dbm interface
Richard Jones <richard@users.sourceforge.net>
parents:
4360
diff
changeset
|
6 if sys.version_info[:2] < (2, 6): |
|
0d9369d35483
fix up some pre-Python2.6 compatibility issues in the *dbm interface
Richard Jones <richard@users.sourceforge.net>
parents:
4360
diff
changeset
|
7 def key_in(db, key): |
|
0d9369d35483
fix up some pre-Python2.6 compatibility issues in the *dbm interface
Richard Jones <richard@users.sourceforge.net>
parents:
4360
diff
changeset
|
8 return db.has_key(key) |
|
0d9369d35483
fix up some pre-Python2.6 compatibility issues in the *dbm interface
Richard Jones <richard@users.sourceforge.net>
parents:
4360
diff
changeset
|
9 else: |
|
0d9369d35483
fix up some pre-Python2.6 compatibility issues in the *dbm interface
Richard Jones <richard@users.sourceforge.net>
parents:
4360
diff
changeset
|
10 def key_in(db, key): |
|
0d9369d35483
fix up some pre-Python2.6 compatibility issues in the *dbm interface
Richard Jones <richard@users.sourceforge.net>
parents:
4360
diff
changeset
|
11 return key in db |
|
0d9369d35483
fix up some pre-Python2.6 compatibility issues in the *dbm interface
Richard Jones <richard@users.sourceforge.net>
parents:
4360
diff
changeset
|
12 |
| 4360 | 13 try: |
| 14 # old school first because <3 had a "dbm" module too... | |
| 15 import anydbm | |
| 16 from whichdb import whichdb | |
| 17 except ImportError: | |
| 18 # python 3+ | |
| 19 import dbm as anydbm | |
| 20 whichdb = anydbm.whichdb |
