Author: ianb
Date: 2005-04-16 12:56:47 -0600 (Sat, 16 Apr 2005)
New Revision: 2353
Modified:
WSGIKit/trunk/docs/TodoTutorial.txt
Log:
Comment assert and fixed bug in .destroy; added note about SQLObject constraints
Modified: WSGIKit/trunk/docs/TodoTutorial.txt
===================================================================
--- WSGIKit/trunk/docs/TodoTutorial.txt 2005-04-15 21:15:46 UTC (rev 2352)
+++ WSGIKit/trunk/docs/TodoTutorial.txt 2005-04-16 18:56:47 UTC (rev 2353)
@@ -434,6 +434,15 @@
Now we have to actually create the tables; we'll use the
``sqlobject-admin`` script to help us with this. First::
+.. note::
+
+ SQLObject is, among other things, a database abstraction layer. So
+ it tries to use as many of the capabilities as it can of the
+ underlying database, but gloss over other issues. In this case,
+ the ``todo_list_id`` column is a foreign key, but the SQL we show
+ is for SQLite, and SQLite doesn't have foreign key constraints. On
+ PostgreSQL the ``CREATE`` statement would look different.
+
.. comment (Run it)
>>> run('sqlobject-admin sql -f server.conf -m todo_sql.db')
@@ -735,8 +744,10 @@
... def destroy(self):
... id = int(self.request.field('item_id'))
... item = TodoItem.get(id)
- ... assert item.todo_list.id == self.options.list.id
- ... desc = description
+ ... assert item.todo_list.id == self.options.list.id, (
+ ... "You are trying to delete %s, which does not "
+ ... "belong to the list %s" % (item, self.options.list))
+ ... desc = item.description
... item.destroySelf()
... self.message("Item %s removed" % desc)
... self.sendRedirectAndEnd(
|