Program is acting like two identical lists containing only two items
(list/entries are same content and type) are different.
The code is commented and is extremely straightforward. If I declare
"submitted_tags = ['test','test'], it works fine and doesn't put in a
second entry, but if I take the submitted tags from my post data, (which
was a comma-delimited string of 'test, test'):
submitted_tags = list(item for item in str(XML(request.vars['submitted_tags'
],sanitize=True)).lower().split(',') if item.strip())
Then it somehow doesn't find the entry in the database. Here is the code:
for i in submitted_tags: # Check each newly submitted tag.
if i not in local_tags: # Check if it's in the current entry's local_tags
already.
tag_row = db(db.approved_tags.tag_name==i).select().first() # See if it's
in the approved_tags.
if tag_row != None: # If it exists already:
Break
else: # If not in our DB already, insert for approval.
db.approved_tags.insert(tag_name = i)
I've checked the type and content of my 'submitted_tags' from the post data
after it's assigned, and it is a list containing two entries, both of which
are strings of 'test', and I have confirmed this is the case in every step
of the code, it's just the DB call that's failing. I've also confirmed the
DB is being properly written to by setting "i = 'test'" right before the DB
call. And right before, that, I can 'print i' or 'print type(i)' and it
comes back as a string containing 'test'. WTF?!
--
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.