Anthony, thanks for the quick reply. Very appreciated.
That confirms my suspicions. Thanks also for the alternative code.
Simon


On Friday, May 9, 2014 9:18:53 PM UTC+1, Anthony wrote:
>
> CAT is a helper object, so you are nesting CATs inside of CATs inside of 
> CATs, which is causing the recursion problem when everything has to be 
> rendered. Your second approach is the way to go. Actually, you can skip 
> making a separate list and instead just do:
>
>     table = TABLE()
>     for row in ...:
>         table.append(TR(...))
>
> Anthony
>
> On Friday, May 9, 2014 3:56:20 PM UTC-4, SimonD wrote:
>>
>> Hi,
>> I would like to seek knowledge/expertise.
>>
>> I have this function - which shows "all user activity in the previous 90 
>> days"
>> def all_activity():
>>     
>> tabledata=TR(B('Date/Time'),B('User'),B('Activity'),_style='background-color:lightblue;')
>>   
>> #formatted header
>>     for row in 
>> db(db.activity.date_time>datetime.datetime.today()-datetime.timedelta(days=91)).select(db.activity.date_time,
>>     db.activity.user_email,db.activity.activity, 
>> orderby=~db.activity.date_time):
>>
>>         tabledata=CAT(tabledata,TR(TD(row.date_time.strftime('%d %b %Y, 
>> (%H:%M %p)'),_style='white-space:nowrap;'),row.user_email,row.activity))
>>         #using CAT() to build the rows
>>
>>     return dict(rows=TABLE(tabledata)) 
>>
>> Although it may seem an unusual way to create a table (is it?), it 
>> works..... except that when I get to about 350 records I get this error:
>>
>> RuntimeError: maximum recursion depth exceeded in cmp
>>
>>
>> After some elimination-testing, it seems the CAT() helper is at the root 
>> of the issue
>>
>> If the function is written like this:
>> def all_activity():
>>     tabledata=[]
>>     
>> tabledata.append(TR(B('Date/Time'),B('User'),B('Activity'),_style='background-color:lightblue;'))
>>     for row in 
>> db(db.activity.date_time>datetime.datetime.today()-datetime.timedelta(days=91)).select(db.activity.date_time,
>>     db.activity.user_email,db.activity.activity, 
>> orderby=~db.activity.date_time):
>>         
>>         tabledata.append(TR(TD(row.date_time.strftime('%d %b %Y, (%H:%M 
>> %p)'),_style='white-space:nowrap;'),row.user_email,row.activity))
>>         #essentialy using a tuple instead of CAT()
>>
>>     return dict(rows=TABLE(tabledata)) 
>>
>> ...the error appears to go away.
>> Yes - I know that the second verion of the function (using tuples) is a 
>> better way - it was just that I was taken by surprise with the error.
>>
>> My function is not recursive, but raising a recursive exception.
>>
>> So, I want to get the view of experts why the CAT() helper would be 
>> causing the problem?
>> Essentially, is re-iterating CAT() causing a recursive issue?
>>
>> If so, is there a way to make the CAT() helper work in this scenario?
>>
>> BTW - this is on 2.9.5+rocket+sqlite. I also have the issue with 
>> 2.9.5+apaches+mod_wsgi
>> I saw a note one this forums that claims a move to MySQL would solve the 
>> error. But I am note sure I have exactly the same symptoms and scenario.
>>
>> Thanks for the guidance.
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to