# Path: datawire/core.py
# def url_for(*a, **kw):
# 
# Path: datawire/model/util.py
# def make_token():
#     num = uuid.uuid4().int
#     s = []
#     while True:
#         num, r = divmod(num, len(ALPHABET))
#         s.append(ALPHABET[r])
#         if num == 0:
#             break
#     return ''.join(reversed(s))
# 
# Path: datawire/model/forms.py
# class UserForm(colander.MappingSchema):
#     email = colander.SchemaNode(colander.String(),
#                                 validator=colander.Email())
#     login = colander.SchemaNode(colander.String())


import logging
from datetime import datetime
from datawire.core import db, login_manager, url_for
from datawire.model.util import make_token
from datawire.model.forms import UserForm

    created_at = db.Column(db.DateTime, default=datetime.utcnow)
    updated_at = db.Column(db.DateTime, default=datetime.utcnow,
                           onupdate=datetime.utcnow)

    def is_active(self):
        return True

    def is_authenticated(self):
        return True

    def is_anonymous(self):
        return False

    def get_id(self):
        return self.login

    def __repr__(self):
        return '<User(%r,%r)>' % (self.id, self.login)

    def __unicode__(self):
        return self.login

    def to_dict(self):
        return {
            'id': self.id,
            'login': self.login,
            'is_admin': self.is_admin,
            'created_at': self.created_at,
            'updated_at': self.updated_at,

# Path: datawire/core.py
# def url_for(*a, **kw):
# 
# Path: datawire/model/util.py
# def make_token():
#     num = uuid.uuid4().int
#     s = []
#     while True:
#         num, r = divmod(num, len(ALPHABET))
#         s.append(ALPHABET[r])
#         if num == 0:
#             break
#     return ''.join(reversed(s))
# 
# Path: datawire/model/forms.py
# class UserForm(colander.MappingSchema):
#     email = colander.SchemaNode(colander.String(),
#                                 validator=colander.Email())
#     login = colander.SchemaNode(colander.String())


# Path: datawire/model/user.py
import logging
from datetime import datetime
from datawire.core import db, login_manager, url_for
from datawire.model.util import make_token
from datawire.model.forms import UserForm


    created_at = db.Column(db.DateTime, default=datetime.utcnow)
    updated_at = db.Column(db.DateTime, default=datetime.utcnow,
                           onupdate=datetime.utcnow)

    def is_active(self):
        return True

    def is_authenticated(self):
        return True

    def is_anonymous(self):
        return False

    def get_id(self):
        return self.login

    def __repr__(self):
        return '<User(%r,%r)>' % (self.id, self.login)

    def __unicode__(self):
        return self.login

    def to_dict(self):
        return {
            'id': self.id,
            'login': self.login,
            'is_admin': self.is_admin,
            'created_at': self.created_at,
            'updated_at': self.updated_at,

            'api_url': url_for('users.view', login=self.login)