~psycopg/psycopg/2.0.x

« back to all changes in this revision

Viewing changes to lib/extensions.py

  • Committer: Federico Di Gregorio
  • Date: 2005-01-20 05:49:40 UTC
  • Revision ID: fog-7e871bddd10637cd35a35849556d0b49b4be53b4
License changes. Fixes. Added register_adapter().

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""
 
2
psycopg extensions to the DBAPI-2.0
 
3
 
 
4
This module holds all the extensions to the DBAPI-2.0 provided by psycopg:
 
5
 
 
6
    connection -- the new-type inheritable connection class
 
7
    cursor -- the new-type inheritable cursor class
 
8
    adapt() -- exposes the PEP-246 compatile adapting machanism used
 
9
     by psycopg to adapt Python types to PostgreSQL ones
 
10
"""
1
11
# psycopg/extensions.py - DBAPI-2.0 extensions specific to psycopg
2
12
#
3
13
# Copyright (C) 2003-2004 Federico Di Gregorio  <fog@debian.org>
29
39
 
30
40
from _psycopg import adapt, adapters, encodings, connection, cursor
31
41
from _psycopg import string_types, binary_types, new_type, register_type
 
42
from _psycopg import ISQLQuote
 
43
 
 
44
 
 
45
def register_adapter(typ, callable):
 
46
    """Register 'callable' as an ISQLQuote adapter for type 'typ'."""
 
47
    adapters[(typ, ISQLQuote)] = callable