Exemplo n.º 1
0
    def get(self):
        '''
        This login uses parameters to generate auth token
        The alternative is to use the template tag inside "REST" that is called auth_token, that extracts an auth token from an user session
        We can use any of this forms due to the fact that the auth token is in fact a session key
        Parameters:
            mandatory:
                username:
                password:
                auth:
            optional:
                locale: (defaults to "en")
        Result:
            on success: { 'result': 'ok', 'auth': [auth_code] }
            on error: { 'result: 'error', 'error': [error string] }
        '''

        logger.debug('Params: {0}'.format(self._params))
        if len(self._args) == 0:
            return {}

        if len(self._args) != 1:
            raise RequestError('Invalid Request')

        uCache.purge()
        return 'done'
Exemplo n.º 2
0
    def get(self):
        '''
        This login uses parameters to generate auth token
        The alternative is to use the template tag inside "REST" that is called auth_token, that extracts an auth token from an user session
        We can use any of this forms due to the fact that the auth token is in fact a session key
        Parameters:
            mandatory:
                username:
                password:
                auth:
            optional:
                locale: (defaults to "en")
        Result:
            on success: { 'result': 'ok', 'auth': [auth_code] }
            on error: { 'result: 'error', 'error': [error string] }
        '''

        logger.debug('Params: {0}'.format(self._params))
        if len(self._args) == 0:
            return {}

        if len(self._args) != 1:
            raise RequestError('Invalid Request')

        uCache.purge()
        return 'done'
Exemplo n.º 3
0
    def get(self):
        """
        Processes get method. Basically, clears & purges the cache, no matter what params
        """
        logger.debug('Params: %s', self._params)
        if not self._args:
            return {}

        if len(self._args) != 1:
            raise RequestError('Invalid Request')

        uCache.purge()
        djCache.clear()
        return 'done'