|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
18 | | -# $Id: __init__.py,v 1.9 2001-12-12 02:30:51 richard Exp $ |
| 18 | +# $Id: __init__.py,v 1.10 2002-01-22 07:08:50 richard Exp $ |
19 | 19 |
|
20 | 20 | __all__ = [] |
21 | 21 |
|
22 | 22 | try: |
23 | | - import anydbm, dumbdbm |
24 | | - # dumbdbm in python 2,2b2, 2.1.1 and earlier is seriously broken |
25 | | - assert anydbm._defaultmod != dumbdbm |
26 | | - del anydbm |
27 | | - del dumbdbm |
| 23 | + import sys |
| 24 | + if not hasattr(sys, 'version_info') or sys.version_info < (2,1,2): |
| 25 | + import anydbm, dumbdbm |
| 26 | + # dumbdbm only works in python 2.1.2+ |
| 27 | + assert anydbm._defaultmod != dumbdbm |
| 28 | + del anydbm |
| 29 | + del dumbdbm |
28 | 30 | import back_anydbm |
29 | 31 | anydbm = back_anydbm |
30 | 32 | __all__.append('anydbm') |
|
49 | 51 |
|
50 | 52 | # |
51 | 53 | # $Log: not supported by cvs2svn $ |
| 54 | +# Revision 1.9 2001/12/12 02:30:51 richard |
| 55 | +# I fixed the problems with people whose anydbm was using the dbm module at the |
| 56 | +# backend. It turns out the dbm module modifies the file name to append ".db" |
| 57 | +# and my check to determine if we're opening an existing or new db just |
| 58 | +# tested os.path.exists() on the filename. Well, no longer! We now perform a |
| 59 | +# much better check _and_ cope with the anydbm implementation module changing |
| 60 | +# too! |
| 61 | +# I also fixed the backends __init__ so only ImportError is squashed. |
| 62 | +# |
52 | 63 | # Revision 1.8 2001/12/10 22:20:01 richard |
53 | 64 | # Enabled transaction support in the bsddb backend. It uses the anydbm code |
54 | 65 | # where possible, only replacing methods where the db is opened (it uses the |
|
0 commit comments