[Zope] attribute-less object(assign or del)

David H bluepaul at earthlink.net
Sat Dec 9 20:36:49 EST 2006


Kate Legere wrote:

>Module None, line 45, in copy_of_stats_output_branch
><PythonScript at copy_of_stats_output_branch>
>Line 45
>
>
>for j in self.sql.sqlGetStatDetailsSum(date1=i.date, branch1=i.branch,
>category1=i.category, timeCheck1=k):
>
>              if str(j.sum_renewals)== 'None':
> line 45 -->     j.sum_renewals = 0
>              elif str(j.sum_registrations)== 'None':
>                 j.sum_renewals = 0
>              elif str(j.sum_hours)== 'None':
>                 j.sum_renewals = 0
>              elif str(j.sum_reference)== 'None':
>                 j.sum_renewals = 0
>
>
>When I have values returned by the sql call it works fine but as soon as I
>get to a field that has a 0 in it then I get an error...
>
>As far as I can tell I'm doing the assignment correctly ... what's wrong
>here?
>
>
>Kate
>
>  
>
Kate,

But the code looks weird ...  Id test something like
    if not j.sum_renewals:
       j.sum_renewals = 0

David H



More information about the Zope mailing list