summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2005-11-26 07:47:48 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2005-11-26 07:47:48 +0000
commitad76b5ba3cc01b658e31fb3c4e94340ba0f884d9 (patch)
tree0d6cb668b60959bb67b90508e9e1191e470fb6af /examples
parent62e4870b85627e005746aa5c50327dad801164d6 (diff)
downloadpsycopg2-ad76b5ba3cc01b658e31fb3c4e94340ba0f884d9.tar.gz
* psycopg/psycopgmodule.c: fixed exceptions refcount.
* fixed lots of doctrings and added Epydoc-generated docs support.
Diffstat (limited to 'examples')
-rw-r--r--examples/dialtone.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/examples/dialtone.py b/examples/dialtone.py
index a648e05..3a55686 100644
--- a/examples/dialtone.py
+++ b/examples/dialtone.py
@@ -112,17 +112,14 @@ insert completely new objects inside a database. As you can see objects do
not know anything about the code that is handling them. We specify all the
fields that we need for each object through the persistent_fields dict.
-The most important line of this recipe is this one:
- adapters.update({Album: ObjectMapper, Order: ObjectMapper})
+The most important lines of this recipe are:
+ register_adapter(Album, ObjectMapper)
+ register_adapter(Order, ObjectMapper)
-In this line we notify the system that when we call adapt with an Album instance
+In these line we notify the system that when we call adapt with an Album instance
as an argument we want it to istantiate ObjectMapper passing the Album instance
as argument (self.orig in the ObjectMapper class).
-adapters is just a python dict with a Key that represents the type
-we need to adapt from and a value that is the adapter
-which will adapt to the wanted interface.
-
The output is something like this (for each call to generateInsert):
('INSERT INTO Album (album_id, binary_data, creation_time) VALUES