Changeset - 1341be63734a
[Not reviewed]
default
0 1 0
Søren Løvborg - 9 years ago 2017-01-02 21:43:53
sorenl@unity3d.com
cleanup: use standard NotImplementedError for abstract methods

From the Python docs on NotImplementedError:

In user defined base classes, abstract methods should raise this
exception when they require derived classes to override the method.
1 file changed with 2 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/auth.py
Show inline comments
 
@@ -819,14 +819,13 @@ class PermsDecorator(object):
 
            if self.user.is_default_user:
 
                raise _redirect_to_login(_('You need to be signed in to view this page'))
 
            else:
 
                raise HTTPForbidden()
 

	
 
    def check_permissions(self):
 
        """Dummy function for overriding"""
 
        raise Exception('You have to write this function in child class')
 
        raise NotImplementedError()
 

	
 

	
 
class HasPermissionAnyDecorator(PermsDecorator):
 
    """
 
    Checks for access permission for any of given predicates. In order to
 
    fulfill the request any of predicates must be meet
 
@@ -927,14 +926,13 @@ class PermsFunction(object):
 
        result_text = 'granted' if result else 'denied'
 
        log.debug('Permission to %s %s for user: %s @ %s',
 
            check_scope, result_text, user, check_location)
 
        return result
 

	
 
    def check_permissions(self):
 
        """Dummy function for overriding"""
 
        raise Exception('You have to write this function in child class')
 
        raise NotImplementedError()
 

	
 
    def _scope(self):
 
        return '(unknown scope)'
 

	
 

	
 
class HasPermissionAny(PermsFunction):
0 comments (0 inline, 0 general)