diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2011-01-01 17:14:54 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2011-01-01 17:14:54 +0100 |
commit | 3e94375cf7d196d4d97a0eba05f7527980c72b6d (patch) | |
tree | ada3416d375591a114285f0cc633c661a582d1f4 /lib/extensions.py | |
parent | ac258169622ca758757e51338443a4cbed1e605d (diff) | |
parent | f9be48d89ea73d5d401b6b5b6a271848f259a1c3 (diff) | |
download | psycopg2-3e94375cf7d196d4d97a0eba05f7527980c72b6d.tar.gz |
Merge branch 'python2' into python3
Conflicts:
ChangeLog
NEWS-2.3
lib/extensions.py
psycopg/microprotocols.c
setup.py
Diffstat (limited to 'lib/extensions.py')
-rw-r--r-- | lib/extensions.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/extensions.py b/lib/extensions.py index 43092fb..e9b6813 100644 --- a/lib/extensions.py +++ b/lib/extensions.py @@ -138,6 +138,19 @@ class SQL_IN(object): __str__ = getquoted +class NoneAdapter(object): + """Adapt None to NULL. + + This adapter is not used normally as a fast path in mogrify uses NULL, + but it makes easier to adapt composite types. + """ + def __init__(self, obj): + pass + + def getquoted(self): + return "NULL" + + # Add the "cleaned" version of the encodings to the key. # When the encoding is set its name is cleaned up from - and _ and turned # uppercase, so an encoding not respecting these rules wouldn't be found in the @@ -146,4 +159,5 @@ for k, v in encodings.items(): k = k.replace('_', '').replace('-', '').upper() encodings[k] = v + __all__ = filter(lambda k: not k.startswith('_'), locals().keys()) |