[Zope] problem with dtml-var displaying None for NULL from
postgres
Stefan H. Holek
stefan@epy.co.at
Fri, 8 Jun 2001 12:07:45 +0200 (CEST)
On Tue, 5 Jun 2001, Chris Kratz wrote:
> My question is this: we have quite a large number of pages where we use the
> <dtml-var> tag to dump a field from the database (after a select). On the
> previous setup, when the field was NULL in the database, the var tag happily
> did nothing. Now, on the new server, if a Null is found, it prints out None
> instead of nothing. For now, I am manually modifying the pages and wrapping
> each of the var tags with an if tag like this: <dtmil-if field><dtml-var
> field></dtml-if> which gives the expected behavior. This works, but is time
> consuming.
>
> I have examined each of the pieces (Zope/ZPoPyDA/PoPy/PostgreSQL) and cannot
> find an easy way to change this behavior. After reading some related
> information on the mailing list, I think the culprit is most likely the DA.
> Unfortunately, I was not successfull in installing the psycopg DA and the
> current version of egenics mxDateTime so I cannot compare the two DA's
> (ZPoPyDA and psycopgDA).
>
> Is this expected behavior? Is the Zope 2.3.2, Python 1.5.2, ZODBCDA,
> MSAccess configuration simply different in some aspect? Why are we getting
> different behaviors with everything the same except a different database?
> If there is no way around this, is there a faster/better way to modify the
> pages so that they don't display anything for a NULL field?
This is to be expected because Access has the idea that NULL somehow
equals an empty string. Your <dtml-vars> did not do 'nothing' but
displayed an empty string (which is quite close to nothing ;) Postgres
does not show this (wrong) behaviour.
IIRC, the ZPyGreSQL DA will also return an empty string for NULL. You
might want to try that for an easy upgrade. Psycopg is IMHO a far better
DA though.
HTH
Stefan