[Zope-DB] Return a Null string instead of a "None" string, DCOracle2

Matthew T. Kromer matt at bane.mi.org
Fri Apr 30 11:29:02 EDT 2004


Yes, if you're using Zope, it will likely convert the None singleton to 
"None" for you because it ended up doing a string conversion at some 
time with a <dtml-var> tag.

Remy Pinsonnault wrote:

> Thanks for your quick response Matt!
>  
> I already have dco2.c version 1.137.
>  
> What flag do I have to change to return a NULL instead of a None 
> singleton? I changed ZEROLENISNULL to 1 as you suggested but it does 
> not help... The more I think about this the more I think the problem 
> is not in dco2 but in Zope?? When I do a <dtml-var> of the result, I 
> get literally "None" in my application. Could it be that Zope 
> interprets the None singleton as a "None"?? This only occurs for 
> columns of type varchar2...
>  
> One detail: there is a missing bracket ({) in source code:
>  
> #if ZEROLENISNULL
>  if (len == 0)
>  {
>   Py_INCREF(Py_None);
>   TRACE(T_EXIT,("sAs", "ResultSetItem_value", Py_None,
>    "0 Len"));
>   return Py_None;
>  }
> #endif 
>  
> Thanks
>  
> Remy
>
>     -----Original Message-----
>     *From:* Matthew T. Kromer [mailto:matt at bane.mi.org]
>     *Sent:* April 30, 2004 7:37 AM
>     *To:* remy_pinsonnault at roche.ca
>     *Cc:* zope-db at zope.org
>     *Subject:* Re: [Zope-DB] Return a Null string instead of a "None"
>     string, DCOracle2
>
>     DCOracle2 never returns "None" as a string -- it will return the
>     None singleton. There's a compile time flag in the source that
>     controls the behavior of if a zero-length result is returned as
>     None or not. The default is for this to be OFF, but this is
>     something that is only in the CVS source -- the 1.3 release
>     doesn't have that change in it.
>
>
>     On Apr 29, 2004, at 3:59 PM, Remy Pinsonnault wrote:
>
>         Hi,
>          
>         I'm running the last DCOracle2 version under Windows XP,
>         Oracle 9i and Python 2.3.
>          
>         Right now the product returns a string containing "None" when
>         the result is a zero-length varchar2 (NULL). How can I change
>         this behaviour?
>          
>         Can i change something in the source code to get a Null value?
>         At least if I could modify the "None" string to something
>         else it would be better because the application is in spanish
>         and None doesn't look good...
>          
>         Thanks in advance
>          
>         Remy Pinsonnault
>         Information Technology Specialist
>         PERCAN PROJECT
>         ROCHE LIMITED, CONSULTING GROUP
>         _______________________________________________
>         Zope-DB mailing list
>         Zope-DB at zope.org
>         http://mail.zope.org/mailman/listinfo/zope-db
>





More information about the Zope-DB mailing list