Beispiel #1
0
            return None

    def get_scope(self, scope):
        from scopes.models import Scope
        try:
            return Scope.objects.get(id=scope)
        except Scope.DoesNotExist:
            return None

    def get_standard_headers(self, meta):
        exceptions = ('CONTENT_LENGTH', 'CONTENT_TYPE')
        prefix = 'HTTP_'

        headers = {}
        for field, value in meta.items():
            header = None
            if field.startswith(prefix):
                header = field[len(prefix):]
            elif field in exceptions:
                header = field

            if header is not None:
                header = field.replace('_', '-')
                headers[header] = value

        return headers


conf.initialize(Adapter())
conf.set_default_credentials_readers()
Beispiel #2
0
def setup_credentials_reader():
    from pauth.conf import initialize
    mock_adapter = MockAdapter()
    initialize(mock_adapter)
    mock_adapter.set_credentials_reader('test', lambda x: x)