First parameter of register_json defaults to None

This commit is contained in:
Daniele Varrazzo 2012-09-19 15:31:28 +01:00
parent 024f0dbada
commit 26d71b4cba
2 changed files with 2 additions and 2 deletions

View File

@ -89,7 +89,7 @@ if json is None:
raise ImportError("no json module available")
def register_json(conn_or_curs, globally=False, loads=None,
def register_json(conn_or_curs=None, globally=False, loads=None,
oid=None, array_oid=None):
"""Create and register typecasters converting :sql:`json` type to Python objects.

View File

@ -935,7 +935,7 @@ class JsonTestCase(unittest.TestCase):
olda = psycopg2.extensions.string_types.get(199)
loads = lambda x: psycopg2.extras.json.loads(x, parse_float=Decimal)
try:
new, newa = psycopg2.extras.register_json(None,
new, newa = psycopg2.extras.register_json(
loads=loads, oid=oid, array_oid=array_oid)
curs = self.conn.cursor()
curs.execute("""select '{"a": 100.0, "b": null}'::json""")