<s> from __future__ import unicode_literals <EOL> from rolepermissions . exceptions import CheckerNotRegistered <EOL> class PermissionsManager ( object ) : <EOL> _checkers = { } <EOL> @ classmethod <EOL> def register_checker ( cls , name , function ) : <EOL> cls . _checkers [ name ] = function <EOL> @ classmethod <EOL> def get_checkers ( cls ) : <EOL> return cls . _checkers <EOL> @ classmethod <EOL> def retrieve_checker ( cls , checker_name ) : <EOL> if checker_name in cls . _checkers : <EOL> return cls . _checkers [ checker_name ] <EOL> raise CheckerNotRegistered ( '<STR_LIT>' % checker_name ) <EOL> def register_object_checker ( name = None ) : <EOL> def fuction_decorator ( func ) : <EOL> checker_name = name if name else func . __name__ <EOL> PermissionsManager . register_checker ( checker_name , func ) <EOL> return fuction_decorator </s>
