# Path: damvitool/db_app.py
# class DamvitoolApp(morepath.App):


from damvitool.db_app import dbApp
from morepath.security import Identity
from morepath.compat import bytes_
from datetime import datetime
from webob.exc import HTTPForbidden
import binascii
import base64
import uuid
    try:
        authbytes = b64decode(params.strip())
    except (TypeError, binascii.Error):  # can't decode
        return None

    # try utf-8 first, then latin-1; see discussion in
    # https://github.com/Pylons/pyramid/issues/898
    try:
        auth = authbytes.decode('utf-8')
    except UnicodeDecodeError:
        # might get nonsense but normally not get decode error
        auth = authbytes.decode('latin-1')

    try:
        username, sessionId = auth.split(':', 1)
    except ValueError:  # not enough values to unpack
        return None

    return DamvitoolAuthInfo(username, sessionId)


def b64decode(v):
    return base64.b64decode(bytes_(v))


@dbApp.identity_policy()
def get_identity_policy():
    return DamvitoolAuthIdentityPolicy()



# Path: damvitool/db_app.py
# class DamvitoolApp(morepath.App):


# Path: damvitool/users.py
from damvitool.db_app import dbApp
from morepath.security import Identity
from morepath.compat import bytes_
from datetime import datetime
from webob.exc import HTTPForbidden
import binascii
import base64
import uuid

    try:
        authbytes = b64decode(params.strip())
    except (TypeError, binascii.Error):  # can't decode
        return None

    # try utf-8 first, then latin-1; see discussion in
    # https://github.com/Pylons/pyramid/issues/898
    try:
        auth = authbytes.decode('utf-8')
    except UnicodeDecodeError:
        # might get nonsense but normally not get decode error
        auth = authbytes.decode('latin-1')

    try:
        username, sessionId = auth.split(':', 1)
    except ValueError:  # not enough values to unpack
        return None

    return DamvitoolAuthInfo(username, sessionId)


def b64decode(v):
    return base64.b64decode(bytes_(v))


@dbApp.identity_policy()
def get_identity_policy():
    return DamvitoolAuthIdentityPolicy()



@dbApp.verify_identity()