AM trying out a now game that involves a continuous input of data with an
instant display to the user of an image or data from the db.
How ever, when trying out a small bit of code, before I developed it to
full scale, I noticed something strange.
This is the code:
results = []
r_lst = []
rlst3 = []
m = []
ffvector = ['vector','vectors','transmit','transmission','port','pots']
ffdef = ['mercedes','bmw','ford','honda','gmc',]
def report():
db = DAL('sqlite://storage.sqlite')#, migrate=False)
db = current.db
auth = Auth(db, hmac_key=Auth.get_or_create_key())
auth.define_tables()
rows = db(db.post.author == auth.user.id).select(db.post.ALL)
for row in rows:
id = row.message
m.append(id)
rlst = [' '.join(grams)for grams in ngrams(word_tokenize(m[0]),1)]
rlst3.extend(rlst)
for item in rlst3:
if item not in ffvector:
pass
else:
vects = 'We will be getting vectors values here.'
results.append(vects)
if item not in ffdef:
pass
else:
defi = 'first thoughts will be here'
results.append(defi)
return results if results else 'Item not found here again, ', rlst3
controller code
form = FORM(INPUT(_name='message'), INPUT(_type='submit'))
if request.vars:
r.append(request.vars.message)
codes.append(r[0])
db.post.insert(message=codes[0])
return dict(form=form, cars=cars)
This is what I note:
1. If I post values in the ffvector or ffdef, the reply back to the user
is ok.
2. The moment I type any text not in the above lists, I start getting
the same previously replies data.
3. When continuously typing text not in the lists, the replies are ok as
coded, but typing randomly text in and not in the lists the replies are not
as expected.
What could be the error and how do i correct them.
Regards
--
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.