Web2py Error:tuple object has no attribute 'replace'

38 views
Skip to first unread message

Maurice Waka

unread,
May 26, 2016, 1:04:46 AM5/26/16
to web2py-users
I initially had a code :
for records in records:
    id = record[0]
    location = record[3]
    code....
    return location
with wb2py code as:
def consult_p():
    code...
    if list_func:
    return list_func
report = consult_p()

view_consult code:
{{while true:}}{{break}}
<div class = "well>"
     code..
     <font size ="2.5" {{=XML(report.replace('\n', '<br>'))}}{{break}}
{{pass}}

This would work well by printing the data from the DB(everything in the row page)

but when trying to print a section of the data, say a string, using the same process but with code at sqlite level as follows:
import sqlite
location = record[3]
if id == name2:
    corpus = [location]
    words = unidecode([location][0])
    sent = ['  '.join(words.split())]
    code...
    
    for sentence in sentences1:
        if x in re.findall(regex code,sentence):
            return ''.join([" ".join(]sentence1[m-1],j]) for m,j in enumarate(sentences1) if x in re.findall(regex code,j)])## this is to print only a section of the data in location or record[3] from sqlite
when running this in web2py, I get the above error.
How can I convert this from tuple to list? or at least print the sentence in a web page
Regards
Maurice

Maurice Waka

unread,
May 26, 2016, 1:53:05 AM5/26/16
to web...@googlegroups.com

Sorry I forgot one thing.
I tried to remove the replace () function and only got a blank page.
I would like to find a way to iterate between printing both the location or record[3] and the sentence

--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/NSROi6GokcU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages