I haven't looked at your code in detail, so this may not be the cause
of the problem, but in general it is a bad idea to modify a collection
while you are iterating over it. ie. this is not generally safe:
for tag in edit_post.tags:
edit_post.tags.remove(tag)
Removing the tag from the tags
Hi Simon,
I followed your advice, and changed my code to this:
def edit(id, tags=None):
edit_post = Post.query.get(id)
if tags is not None and tags != :
for tag in tags.split(','):
tag = tag.strip( )
if tag not in edit_post.tags:
add_tags =
I looked at my code some more, and found a now obvious mistake. I changed
my code to:
def edit(id, tags=None):
edit_post = Post.query.get(id)
if tags is not None and tags != :
for tag in tags.split(','):
tag = tag.strip( )
if tag not in edit_post.tags: