bprinty/Flask-Authorize

fix/new group add

Opened this issue · 0 comments

Environment:


Name: Flask-Authorize
Version: 0.2.6
            Name: Flask-Authorize
            Version: 0.2.6
            
            Name: Flask
            Version: 2.1.2
            
            Name: Flask-SQLAlchemy
            Version: 2.5.1
            
            Name: six
            Version: 1.16.0
            
            Name: SQLAlchemy
            Version: 1.4.37


Python version: Python 3.8.10

I tried to create Group by using usual way like:

group_admin = Group(name='admin')
group_admin.set_restrictions(can_delete=True)
db.session.add(group_admin)
db.session.commit()

but i got following error:


    restrictions = self.restrictions.copy()
AttributeError: 'NoneType' object has no attribute 'copy'

i think here you are trying to copy restriction variable.. i updated it to __restrictions__ --> restrictions in mixins.py file and it worked fine.

Please guide if this behavior is right.