Mercurial > p > roundup > code
annotate roundup/anypy/dbm_.py @ 4905:6e313bdf6b69 routing
routing: Add new roundup.web namespace with router component
This branch is to untangle hardcoded Roundup URL scheme, make
it more readable and customizable with extensions.
Right now it doesn't seem possible to write extension that
renders static HTML page at /about without modifying Roundup
DB, and this web component should not depend on DB schema.
| author | anatoly techtonik <techtonik@gmail.com> |
|---|---|
| date | Tue, 15 Jul 2014 13:33:43 +0300 |
| 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 |
