Had difficulty debugging my cgi script so used logging 
that indicated IterBetter instance has no attribute '__len__'
 
Suggested fixes are: 
 
 len(list(rows))
 
or 
 
 
d = web.query("SELECT COUNT(*) AS count FROM mytable")
print d[0].count

both of which IMHO defeat the benefit of iterBetter. My hack was to include 
dummy data as the last json element as in:

class HMA:
    def GET(self):
        rows = db.select('TX_CIT_HMA', order='SM_HMA')
        web.header('Content-Type', 'application/json')
        yield '{identifier: "SM_HMA", items: ['
        for row in rows:
                yield json.dumps(row) + ','
        yield '{"SM_HMA": "None", "TX_HMA": "None"}]}'

Not the best fix I admit. 

 
 

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/webpy/-/U-Z1lshF4p0J.
To post to this group, send email to webpy@googlegroups.com.
To unsubscribe from this group, send email to 
webpy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to