Contact: fumanchu@aminus.org

Log in as guest/geniusql to create tickets

root/trunk/geniusql/typerefs.py

Revision 55 (checked in by fumanchu, 5 years ago)

sqlserver and msaccess now work.

  • Property svn:eol-style set to native
Line 
1 """References to optional types (such as fixedpoint and decimal).
2
3 If a given type module cannot be imported, the module name will be None.
4
5 Rather than have each module that needs to (optionally) handle various
6 types do the ImportError dance, they can just import this module and do:
7
8     if typerefs.decimal:
9         handle_decimal()
10 """
11
12
13 try:
14     # Builtin in Python 2.6?
15     decimal
16 except NameError:
17     try:
18         # Module in Python 2.3+
19         import decimal
20     except ImportError:
21         decimal = None
22
23 try:
24     import fixedpoint
25 except ImportError:
26     fixedpoint = None
27
28 try:
29     # Builtin in Python 2.4+
30     set
31 except NameError:
32     try:
33         # Module in Python 2.3
34         from sets import Set as set
35     except ImportError:
36         set = None
Note: See TracBrowser for help on using the browser.