Also, there is not point to either of the for loops at the top of the view 
-- each loop is simply assigning a new value to the same variable, so the 
final value of the variable is just that of the final element in the 
iteration. You might as well just make that final assignment without 
bothering with iteration over all the previous items.


On Saturday, April 7, 2018 at 10:34:28 AM UTC-4, Anthony wrote:
> {{for q in question:}}
>> {{q=XML('\n','<br>').replace('(','{').replace(')','}'), 
>> sanitize=True)}}
>> {{pass}}
>> ...
>>         $(function () {
>>            ... 
>             sendMessage('{{=q}}');
> When "question" is empty (i.e., there are no answers from the current 
> user), the variable "q" will not be defined in the for loop, and therefore 
> will result in an exception later where you have {{=q}}.
> This doesn't have anything to do with @auth.has_membership('managers'), as 
> the error is not even occurring in the function with that decorator. If you 
> are expecting "question" to always include some records, you have to figure 
> out why you aren't getting any in this case. Otherwise, adjust your code to 
> account for the possibility of an empty "question".
> Anthony

- (Documentation)
- (Source code)
- (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 
For more options, visit

Reply via email to