Comparing site's ACL defined in source code with its value written to db

15 views
Skip to first unread message

Piotr Dobrogost

unread,
Jul 1, 2016, 4:37:16 PM7/1/16
to Kotti
Hi all!

I would like to compare site's ACL (https://github.com/Kotti/Kotti/blob/1.3.0-alpha.4/kotti/security.py#L208-L213) defined in source code with site's ACL from db (https://github.com/Kotti/Kotti/blob/1.3.0-alpha.4/kotti/resources.py#L789,  https://github.com/Kotti/Kotti/blob/1.3.0-alpha.4/kotti/resources.py#L239) so that whenever ACL is changed in source code the value of ACL in db would be updated.
However due to ACL read from db being ACLType wrapped in MutationList I don't know how to compare this value with ACL in source code which is plain Python list.
Any ideas?

Regards,
Piotr Dobrogost

Andreas Kaiser

unread,
Jul 5, 2016, 6:41:47 AM7/5/16
to Kotti
Why not just set it in you populator unconditionally?


Andreas

Piotr Dobrogost

unread,
Jul 6, 2016, 5:47:05 PM7/6/16
to Kotti
On Tuesday, July 5, 2016 at 12:41:47 PM UTC+2, Andreas Kaiser wrote:
On 1 Jul 2016, at 22:37, Piotr Dobrogost wrote:

> I would like to compare site's ACL

Why not just set it in you populator unconditionally?

Well, I wanted to avoid writing it to db during each start of app if there was no change in ACL.

Piotr 

Andreas Kaiser

unread,
Jul 7, 2016, 5:32:22 AM7/7/16
to Kotti
I don't see how selecting, comparing and then maybe updating saves you
anything over updating a single column unconditionally. IMO not worth
the effort, unless you have another reason for doing so.


Andreas
Reply all
Reply to author
Forward
0 new messages