[Zope] ZSQL insert: None, '' and null behaviour

Matt Goodall m.g.goodall@ntlworld.com
11 Nov 2001 21:52:29 +0000


Hi,

Can anyone give me a good reason why an object with value None, used to
insert data into a database inserts the text string 'None' rather than a
NULL value? It seems to me that None is pretty much equivalent to SQL's
NULL.

I found an excellent document,
http://www.zope.org/Members/jshell/ZSQLMethods-InsertingData, which
explains how to get things to work (use type=nb and optional in the
sqlvar tag) but it doesn't work for values of None, only empty strings.

I am now going to "fix" all the code I have but I would love to
understand why I need to (in my opinion) code around this.

If it makes any difference I'm using Red Hat Linux 7.2, Python 2.1.1,
Zope 2.4.2, PostgreSQL 7.1.3 and psycopg from CVS. I get the same
behaviour on FreeBSD, Python 2.1.1, PostgreSQL 7.0.3 and psycopg 0.99.7
(IIRC).

Thanks, Matt