[Zope] None Object and None String

Asad Habib ahabib at engin.umich.edu
Thu Feb 10 00:59:11 EST 2005


Actually, I am not using str in this case at all. In fact, right before
the Z SQL method is called, I have a <dtml-var> that displays the value
of this session variable and the value is the None object not 'None'.

I figured out that this conversion from object to str takes place inside the
<dtml-sqlvar> tag used in this Z SQL method. The <dtml-sqlvar> tag
converts the None object to a string because I am calling it with a type
attribute set to the value 'string' (i.e. <dtml-sqlvar name="test"
type="string">).

- Asad

On Wed, 9 Feb 2005, Andy Dustman wrote:

> On Wed, 9 Feb 2005 10:51:09 -0500 (EST), Asad Habib
> <ahabib at engin.umich.edu> wrote:
> > I have a Zope session variable that is set to None. When I update my MySQL
> > database and set the value of one of my fields to the value of this
> > session variable, the value is set to the string 'None'. Anyone
> > encountered a similar problem? I would think that the None object would
> > translate to the NULL database constant and not the string with value
> > 'None'. Any help would be appreciated. Thanks.
>
> You are correct that a Python None should be written to the database
> as NULL, and vice versa. I can only conclude that something in your
> application is converting None to 'None' (i.e. str(None)). If you are
> getting it out of a session variable, this seems likely.
> --
> Computer interfaces should never be made of meat.
>
> Using GMail? Setting Reply-to address to <> disables this annoying feature.
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
>


More information about the Zope mailing list