summaryrefslogtreecommitdiff
path: root/lib/extras.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2012-02-23 23:51:28 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2012-02-23 23:51:28 +0000
commit36b6c80ed1b3bcea78b52cd88050a905927c35b3 (patch)
tree7903c499127d342d84de07302b33153295c4ccf4 /lib/extras.py
parent9ffa1f4b596ec70f1227c7b91db0d4440828c088 (diff)
downloadpsycopg2-36b6c80ed1b3bcea78b52cd88050a905927c35b3.tar.gz
register_uuid takes more iterables types as oids argument
Also added docs for the function parameters.
Diffstat (limited to 'lib/extras.py')
-rw-r--r--lib/extras.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/extras.py b/lib/extras.py
index 870b5ca..738af7d 100644
--- a/lib/extras.py
+++ b/lib/extras.py
@@ -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