summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b78cacf)
raw | patch | inline | side by side (parent: b78cacf)
author | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 14 Sep 2003 18:55:37 +0000 (18:55 +0000) | ||
committer | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 14 Sep 2003 18:55:37 +0000 (18:55 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1876 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/backends/__init__.py | patch | blob | history | |
roundup/backends/back_anydbm.py | patch | blob | history |
index 16c16f2a2a6548f27dd17b3bbaf17878927b6b1b..d2253015458cbd13a1600dea7db62c387b7c018d 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: __init__.py,v 1.23 2003-04-24 06:55:24 richard Exp $
+# $Id: __init__.py,v 1.24 2003-09-14 18:55:37 jlgijsbers Exp $
''' Container for the hyperdb storage backend implementations.
__all__ = []
-try:
- import sys, anydbm
- if not hasattr(sys, 'version_info') or sys.version_info < (2,1,2):
- import dumbdbm
- # dumbdbm only works in python 2.1.2+
- assert anydbm._defaultmod != dumbdbm
- del anydbm
- del dumbdbm
-except AssertionError:
- print "WARNING: you should upgrade to python 2.1.3"
-except ImportError, message:
- if str(message) != 'No module named anydbm': raise
-else:
- import back_anydbm
- anydbm = back_anydbm
- __all__.append('anydbm')
-
-try:
- import MySQLdb
-except ImportError, message:
- if str(message) != 'No module named MySQLdb': raise
-else:
- import back_mysql
- mysql = back_mysql
- __all__.append('mysql')
-
-try:
- import sqlite
-except ImportError, message:
- if str(message) != 'No module named sqlite': raise
-else:
- import back_sqlite
- sqlite = back_sqlite
- __all__.append('sqlite')
-
-try:
- import bsddb
-except ImportError, message:
- if not str(message).startswith('No module named'): raise
-else:
- import back_bsddb
- bsddb = back_bsddb
- __all__.append('bsddb')
-
-try:
- import bsddb3
-except ImportError, message:
- if str(message) != 'No module named bsddb3': raise
-else:
- import back_bsddb3
- bsddb3 = back_bsddb3
- __all__.append('bsddb3')
-
-try:
- import metakit
-except ImportError, message:
- if str(message) != 'No module named metakit': raise
-else:
- import back_metakit
- metakit = back_metakit
- __all__.append('metakit')
+for backend in ['anydbm', ('mysql', 'MySQLdb'), 'bsddb', 'bsddb3', 'sqlite',
+ 'metakit']:
+ if len(backend) == 2:
+ backend, backend_module = backend
+ else:
+ backend_module = backend
+ try:
+ globals()[backend] = __import__('back_%s' % backend, globals())
+ __all__.append(backend)
+ except ImportError, e:
+ if not str(e).startswith('No module named %s' % backend_module):
+ raise
# vim: set filetype=python ts=4 sw=4 et si
index 33392a754f40abae53b12666a8cad081da94542b..8d7ecd884e66b0110140d442c950f725f8d50ed7 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: back_anydbm.py,v 1.127 2003-09-08 20:39:18 jlgijsbers Exp $
+#$Id: back_anydbm.py,v 1.128 2003-09-14 18:55:37 jlgijsbers Exp $
'''
This module defines a backend that saves the hyperdatabase in a database
chosen by anydbm. It is guaranteed to always be available in python
serious bugs, and is not available)
'''
-import whichdb, anydbm, os, marshal, re, weakref, string, copy
+try:
+ import anydbm, sys
+ # dumbdbm only works in python 2.1.2+
+ if sys.version_info < (2,1,2):
+ import dumbdbm
+ assert anydbm._defaultmod != dumbdbm
+ del dumbdbm
+except AssertionError:
+ print "WARNING: you should upgrade to python 2.1.3"
+
+import whichdb, os, marshal, re, weakref, string, copy
from roundup import hyperdb, date, password, roundupdb, security
from blobfiles import FileStorage
from sessions import Sessions, OneTimeKeys