mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-10-31 07:47:30 +03:00 
			
		
		
		
	First parameter of register_json defaults to None
This commit is contained in:
		
							parent
							
								
									024f0dbada
								
							
						
					
					
						commit
						26d71b4cba
					
				|  | @ -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. | ||||
| 
 | ||||
|  |  | |||
|  | @ -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""") | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user