summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorFederico Di Gregorio <fog@initd.org>2005-02-27 15:03:53 +0000
committerFederico Di Gregorio <fog@initd.org>2005-02-27 15:03:53 +0000
commit4b94e544732c18d327e6496422d661885b019cb8 (patch)
treeb94c922152097f07f21175a7a9d13695f57060e8 /examples
parentbbb6c8f22c249a35052ad23a623fde3f80fb4499 (diff)
downloadpsycopg2-4b94e544732c18d327e6496422d661885b019cb8.tar.gz
Fixed example/myfirstrecipe.py
Diffstat (limited to 'examples')
-rw-r--r--examples/myfirstrecipe.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/myfirstrecipe.py b/examples/myfirstrecipe.py
index 8457c67..0aa1776 100644
--- a/examples/myfirstrecipe.py
+++ b/examples/myfirstrecipe.py
@@ -69,6 +69,7 @@ and on the psycopg 2 wiki:
import psycopg
import psycopg.extensions
from psycopg.extensions import adapt as psycoadapt
+from psycopg.extensions import register_adapter
class AsIs(object):
"""An adapter that just return the object 'as is'.
@@ -99,9 +100,9 @@ class SQL_IN(object):
__str__ = getquoted
# add our new adapter class to psycopg list of adapters
-psycopg.extensions.adapters[tuple] = SQL_IN
-psycopg.extensions.adapters[float] = AsIs
-psycopg.extensions.adapters[int] = AsIs
+register_adapter(tuple, SQL_IN)
+register_adapter(float, AsIs)
+register_adapter(int, AsIs)
# usually we would call:
#