diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2012-02-23 14:37:15 +0000 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2012-02-23 14:41:55 +0000 |
commit | dca6cffd6e687ef171cc70a7de392080f3c05a1b (patch) | |
tree | 89816de1ffbfe49a64e65d8298ab61f933c7f36d /lib/extras.py | |
parent | f782470d7109c62101e40422923bc9dfec28cfc9 (diff) | |
download | psycopg2-dca6cffd6e687ef171cc70a7de392080f3c05a1b.tar.gz |
Dropped custom array parsing for UUID[]
Use the C generic array parsing exposed by new_array_type().
Diffstat (limited to 'lib/extras.py')
-rw-r--r-- | lib/extras.py | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/lib/extras.py b/lib/extras.py index 3237cab..e1091e2 100644 --- a/lib/extras.py +++ b/lib/extras.py @@ -473,18 +473,9 @@ def register_uuid(oids=None, conn_or_curs=None): oid1 = oids oid2 = 2951 - def parseUUIDARRAY(data, cursor): - if data is None: - return None - elif data == '{}': - return [] - else: - return [((len(x) > 0 and x != 'NULL') and uuid.UUID(x) or None) - for x in data[1:-1].split(',')] - _ext.UUID = _ext.new_type((oid1, ), "UUID", lambda data, cursor: data and uuid.UUID(data) or None) - _ext.UUIDARRAY = _ext.new_type((oid2,), "UUID[]", parseUUIDARRAY) + _ext.UUIDARRAY = _ext.new_array_type((oid2,), "UUID[]", _ext.UUID) _ext.register_type(_ext.UUID, conn_or_curs) _ext.register_type(_ext.UUIDARRAY, conn_or_curs) |