Warm sunday afternoon here in Italy ;-)

pull request: https://github.com/web2py/web2py/pull/144


2013/7/21 Jim Steil <ato.st...@gmail.com>

> Thanks.  Really appreciate the prompt reply on a Sunday morning!!
>
> Jim
>  On Jul 21, 2013 9:22 AM, "Michele Comitini" <michele.comit...@gmail.com>
> wrote:
>
>> There is a bug. must be None i.e. the result is not defined.
>>
>> I fixed the bug and I will send the PR asap
>>
>> db.define_table('tt', Field('aa', 'integer'))
>>
>> assert(db(db.tt.aa == 2).count()==0)
>> sum = (db.tt.aa + 1).sum()
>> assert(db(db.tt.aa == 2).select(sum).first()[sum]==0)
>> -> AssertionError
>>
>> I added tests for travis too.
>>
>>
>> 2013/7/21 Jim Steil <ato.st...@gmail.com>
>>
>>> Do you have a test you can run on it?  None of mine are working and I
>>> just updated in the last hour.
>>>
>>>
>>> On Sun, Jul 21, 2013 at 8:48 AM, Niphlod <niph...@gmail.com> wrote:
>>>
>>>> this should have been fixed already on the latest trunk....
>>>>
>>>>
>>>> On Sunday, July 21, 2013 3:33:51 PM UTC+2, Jim S wrote:
>>>>>
>>>>> Just upgraded to latest trunk, Version 2.6.0-development+timestamp.**
>>>>> 2013.07.20.12.59.52.
>>>>>
>>>>> Having a problem with SUM statements that previously worked.
>>>>>
>>>>> If the query returns no rows, then I'm getting this traceback:
>>>>>
>>>>> Traceback (most recent call last):
>>>>>
>>>>>
>>>>>
>>>>>   File "C:\dev\web2py\gluon\**restricted.py", line 212, in restricted
>>>>>
>>>>>
>>>>>
>>>>>     exec ccode in environment
>>>>>   File "C:/dev/web2py/applications/**ibc/controllers/dashboard.py" 
>>>>> <http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py>, 
>>>>> line 2035, in <module>
>>>>>
>>>>>
>>>>>
>>>>>   File "C:\dev\web2py\gluon\globals.**py", line 193, in <lambda>
>>>>>
>>>>>
>>>>>
>>>>>     self._caller = lambda f: f()
>>>>>
>>>>>
>>>>>
>>>>>   File "C:/dev/web2py/applications/**ibc/controllers/dashboard.py" 
>>>>> <http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py>, 
>>>>> line 1094, in contract_fees_ytd_by_**distributor
>>>>>
>>>>>
>>>>>
>>>>>     
>>>>> (db.national_sales_data.Invoic**e_Print_Date__c<=to_date)).sel**ect(processing_fees_sum).first**()[processing_fees_sum]
>>>>>  or 0
>>>>>
>>>>>
>>>>>
>>>>>   File "C:\dev\web2py\gluon\dal.py", line 6888, in __getitem__
>>>>>
>>>>>
>>>>>
>>>>>     return ogetattr(self, key)
>>>>>
>>>>>
>>>>> AttributeError: 'Row' object has no attribute 
>>>>> 'SUM(national_sales_data.**Processing_Fees__c)'
>>>>>
>>>>> My code is:
>>>>>
>>>>> processing_fees = db((db.national_sales_data.**
>>>>> Invoice_Print_Date__c>=from_**date) &
>>>>> (db.national_sales_data.**Trading_Partner_ID__c==**trading_partner) &
>>>>> (db.national_sales_data.**Invoice_Print_Date__c<=to_**
>>>>> date)).select(processing_fees_**sum).first()[processing_fees_**sum]
>>>>> or 0
>>>>>
>>>>> Previously this would return 0 if there were no rows selected in the
>>>>> query.
>>>>>
>>>>> -Jim
>>>>>
>>>>>  --
>>>>
>>>> ---
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "web2py-users" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/web2py/hgYEY3ZdSK4/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> web2py+unsubscr...@googlegroups.com.
>>>>
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>
>>>  --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/hgYEY3ZdSK4/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to