mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-25 10:23:43 +03:00
register_uuid takes more iterables types as oids argument
Also added docs for the function parameters.
This commit is contained in:
parent
9ffa1f4b59
commit
36b6c80ed1
|
@ -455,14 +455,21 @@ class UUID_adapter(object):
|
|||
__str__ = getquoted
|
||||
|
||||
def register_uuid(oids=None, conn_or_curs=None):
|
||||
"""Create the UUID type and an uuid.UUID adapter."""
|
||||
"""Create the UUID type and an uuid.UUID adapter.
|
||||
|
||||
:param oids: oid for the PostgreSQL :sql:`uuid` type, or 2-items sequence
|
||||
with oids of the type and the array. If not specified, use PostgreSQL
|
||||
standard oids.
|
||||
:param conn_or_curs: where to register the typecaster. If not specified,
|
||||
register it globally.
|
||||
"""
|
||||
|
||||
import uuid
|
||||
|
||||
if not oids:
|
||||
oid1 = 2950
|
||||
oid2 = 2951
|
||||
elif type(oids) == list:
|
||||
elif isinstance(oids, (list, tuple)):
|
||||
oid1, oid2 = oids
|
||||
else:
|
||||
oid1 = oids
|
||||
|
|
Loading…
Reference in New Issue
Block a user