add_membership, del_membership, add_membership = IntegrityError (is_active)

34 views
Skip to first unread message

sunny

unread,
Oct 19, 2015, 5:13:37 AM10/19/15
to web...@googlegroups.com
Hi,

I ran into a problem with memberships:

When I add a membership to a user and delete it afterwards 
the record is not actually removed from the table but is_active is set to 'F'.
I can check with has_membership and it is False

But now I'm unable to add the same membership again, because it gives me an IntegrityError.
I think add_membership should check for is_active and reset it to 'T'.
Or how is the delete() -> is_active = 'F' -> re-add supposed to work?

My web2py version is 2.9.12-stable

Thanks in advance,
Sven

黄祥

unread,
Oct 19, 2015, 5:34:15 AM10/19/15
to web2py-users
the web2py version is quite old :)
btw, i think it's about how auth.signature work. the auth.signature contain table field is_active with boolean field type, so if user delete the data (not just the auth_membership), it automatically set the is_active into False (F) into the data that you choose to delete.
i think you can set it back the value of is_active into True if you want the data of auth_membership to be able to used again.

best regards,
stifan

Sven Slezák

unread,
Oct 19, 2015, 5:37:38 AM10/19/15
to web...@googlegroups.com
thanks, stifan.
this will be my work around but how is it supposed to work?
or is this fixed in a newer version of web2py?


--
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/f43Fo2ceir0/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.

黄祥

unread,
Oct 19, 2015, 5:59:38 AM10/19/15
to web2py-users
nope, the recent version (2.12.3) have the same auth.signature that work like that.
if you realy want to delete the data (not just set the is_active into False when user delete it from web application), i think you can disable auth.signature in your table definition, or simply just remove it from database console.

best regards,
stifan

Sven Slezák

unread,
Oct 19, 2015, 6:58:37 AM10/19/15
to web...@googlegroups.com
actually, I don't care if the record is deleted or not. ;-)
I want to be able to remove memberships and reset them later with the same mechanism (auth.add_membership, auth.del_membership, auth.add_membership).
is this considered a bug?
or is there a different handling I have to use with auth.signature enabled?


Massimo Di Pierro

unread,
Oct 19, 2015, 12:54:45 PM10/19/15
to web2py-users
please open an issue about this so we track it and fix it.
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages