summaryrefslogtreecommitdiff
path: root/lib/extras.py
diff options
context:
space:
mode:
authorFederico Di Gregorio <fog@initd.org>2008-09-23 09:11:11 +0200
committerFederico Di Gregorio <fog@initd.org>2008-09-23 09:11:11 +0200
commit56f6001d6df966227623351f5e8b755ee561db6a (patch)
tree08adcc6c4a60e554e89749dbfcfae62ae18e3af3 /lib/extras.py
parentb92601306e9bf7627ee7a19382492fa4bf511d57 (diff)
downloadpsycopg2-56f6001d6df966227623351f5e8b755ee561db6a.tar.gz
Support for NULLs in UUID
Diffstat (limited to 'lib/extras.py')
-rw-r--r--lib/extras.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/extras.py b/lib/extras.py
index 91ab9ab..67a67f2 100644
--- a/lib/extras.py
+++ b/lib/extras.py
@@ -306,7 +306,7 @@ try:
"""Create the UUID type and an uuid.UUID adapter."""
if not oid: oid = 2950
_ext.UUID = _ext.new_type((oid, ), "UUID",
- lambda data, cursor: uuid.UUID(data))
+ lambda data, cursor: data and uuid.UUID(data) or None)
_ext.register_type(_ext.UUID)
_ext.register_adapter(uuid.UUID, UUID_adapter)
return _ext.UUID
@@ -321,4 +321,4 @@ except ImportError, e:
raise e
-__all__ = [ k for k in locals().keys() if not k.startswith('_') ] \ No newline at end of file
+__all__ = [ k for k in locals().keys() if not k.startswith('_') ]