something really rotten, may be with web2py

see why....

My controller is look like this :

def index():
   result = None
   search_form = FORM() # create a form appropriately 
   if search_form.accepts(request.vars, formname='search_form', 
hideerror=True, keepvalues=True):
        #some other logic will be here
        rows = db(query).select()\
                .find(lambda row: 
row.word.lower().startswith(word.lower()))\
                .sort(lambda row: row.word.lower()).sort(lambda row: 
row.lang)
         #and some other statements here

    return dict(search_form = search_form, result = result)


and my view index.html:

{{extend 'layout.html'}}
{{block searchbar}}{{=search_form}}{{end}}
{{if result:}}

<!-- whole heck of other statements that populate data which is an 
dictionary of lists. -->
{{items.append(DIV(DIV(*data[item], _id = 'wrap'), _id = 'ui-tabs-'+str(i))) 
}} <!-- this is where error showing in gae logs -->

{{else:}}
    <div id='languages'> A list if languages will be here </div>
{{pass}}



Error is showing on the first run? How come?
result is set to None in the controller by default (it'll be populated only 
after form is submitted properly)
in view I test for None (if result:) so it'll enter the flow only if result 
isn't none.
So how come the error to be shown inside the if loop and result being 
None???

Reply via email to