# Path: doac/conf.py
# class Settings:
#     def __init__(self, options):
#     def setup_access_token(self):
#     def setup_auth_code(self):
#     def setup_auth_token(self):
#     def setup_client(self):
#     def setup_refresh_token(self):
# 
# Path: doac/compat.py
# def get_user_model():
#     """
#     Get the user model that is being used.  If the `get_user_model` method
#     is not available, default back to the standard User model provided
#     through `django.contrib.auth`.
#     """
# 
#     try:
#         from django.contrib.auth import get_user_model
#         
#         return get_user_model()
#     except ImportError:
#         from django.contrib.auth.models import User
#         
#         return User


from django.db import models
from django.utils.translation import ugettext_lazy as _
from .conf import options
from .compat import get_user_model
from . import managers
        from .compat import get_random_string
        from .compat import now
        from .compat import get_random_string
        from .compat import now
        from .compat import get_random_string
        from .compat import now
        from .compat import get_random_string
        from .compat import get_random_string
        from .compat import now
    objects = managers.AuthorizationTokenManager()

    def __unicode__(self):
        return self.token

    def generate_refresh_token(self):
        if self.is_active:
            try:
                temp = self.refresh_token

                return None
            except RefreshToken.DoesNotExist:
                self.refresh_token = RefreshToken()

                self.refresh_token.client = self.client
                self.refresh_token.user = self.user
                self.refresh_token.save()

                self.refresh_token.scope = self.scope.all()
                self.refresh_token.save()

                self.is_active = False
                self.save()

                return self.refresh_token

        return None

    def generate_token(self):


# Path: doac/conf.py
# class Settings:
#     def __init__(self, options):
#     def setup_access_token(self):
#     def setup_auth_code(self):
#     def setup_auth_token(self):
#     def setup_client(self):
#     def setup_refresh_token(self):
# 
# Path: doac/compat.py
# def get_user_model():
#     """
#     Get the user model that is being used.  If the `get_user_model` method
#     is not available, default back to the standard User model provided
#     through `django.contrib.auth`.
#     """
# 
#     try:
#         from django.contrib.auth import get_user_model
#         
#         return get_user_model()
#     except ImportError:
#         from django.contrib.auth.models import User
#         
#         return User


# Path: doac/models.py
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .conf import options
from .compat import get_user_model
from . import managers
        from .compat import get_random_string
        from .compat import now
        from .compat import get_random_string
        from .compat import now
        from .compat import get_random_string
        from .compat import now
        from .compat import get_random_string
        from .compat import get_random_string
        from .compat import now

    objects = managers.AuthorizationTokenManager()

    def __unicode__(self):
        return self.token

    def generate_refresh_token(self):
        if self.is_active:
            try:
                temp = self.refresh_token

                return None
            except RefreshToken.DoesNotExist:
                self.refresh_token = RefreshToken()

                self.refresh_token.client = self.client
                self.refresh_token.user = self.user
                self.refresh_token.save()

                self.refresh_token.scope = self.scope.all()
                self.refresh_token.save()

                self.is_active = False
                self.save()

                return self.refresh_token

        return None

    def generate_token(self):


        return get_random_string(options.auth_token["length"])