# Path: scribeui_pyramid/modules/workspaces/models.py
# class Workspace(Base, BaseMixin):
# 
#     __tablename__ = 'workspaces'
#     id = sa.Column(sa.Integer, primary_key=True, autoincrement=True)
#     name = sa.Column(sa.Unicode(30), nullable=False, unique=True)
#     password = sa.Column(sa.Unicode(256))
# 
# 
#     def __repr__(self):
#         return u"<Workspace('{0}')>".format(self.name)
# 
# 
#     @staticmethod
#     def password_manager():
#         return DelegatingPasswordManager(preferred=BCRYPTPasswordManager())
# 
# 
#     @staticmethod
#     def encode_password(raw):
#         return Workspace.password_manager().encode(raw)
# 
# 
#     @staticmethod
#     def check_password(hashed, raw):
#         return Workspace.password_manager().check(
#             hashed,
#             raw,
#             setter=Workspace.encode_password
#         )
# 
# 
#     @classmethod
#     def authenticate(cls, name, password):
#         workspace = DBSession.query(cls)\
#             .filter_by(name=name)\
#             .first()
# 
#         if workspace:
#             if workspace.password and password and Workspace.check_password(workspace.password, password):
#                 return workspace
#             elif not workspace.password and not password:
#                 return workspace
#         return None
# 
# 
#     @classmethod
#     def by_name(cls, name):
#         q = DBSession.query(cls)\
#             .filter(sa.func.lower(cls.name) == name.lower())
# 
#         return q.first()
# 
# 
#     def get_maps(self, type=None):
#         q = Map.query.filter(Map.workspace_id == self.id)
# 
#         if type:
#             q = q.filter(Map.type == type)
# 
#         return q.all()
# 
# 
#     def get_map_by_name(self, name):
#         q = DBSession.query(Map)\
#             .filter(Map.name == name.lower(), Map.workspace_id == self.id)
# 
#         return q.first()


from fixture import DataSet
from scribeui_pyramid.modules.workspaces.models import Workspace
# -*- coding: utf-8 -*-


class WorkspaceData(DataSet):
    class default:
        name = u'default'
        password = Workspace.encode_password(u'default')


class MapData(DataSet):
    class default:
        name = u'default'
        description = u'Default map'
        type = u'Scribe'
        extent = '-20405648.939901,-17712669.979681,20314497.045109,19408951.476421'
        projection = 'EPSG:900913'
        workspace_id = 1


# Path: scribeui_pyramid/modules/workspaces/models.py
# class Workspace(Base, BaseMixin):
# 
#     __tablename__ = 'workspaces'
#     id = sa.Column(sa.Integer, primary_key=True, autoincrement=True)
#     name = sa.Column(sa.Unicode(30), nullable=False, unique=True)
#     password = sa.Column(sa.Unicode(256))
# 
# 
#     def __repr__(self):
#         return u"<Workspace('{0}')>".format(self.name)
# 
# 
#     @staticmethod
#     def password_manager():
#         return DelegatingPasswordManager(preferred=BCRYPTPasswordManager())
# 
# 
#     @staticmethod
#     def encode_password(raw):
#         return Workspace.password_manager().encode(raw)
# 
# 
#     @staticmethod
#     def check_password(hashed, raw):
#         return Workspace.password_manager().check(
#             hashed,
#             raw,
#             setter=Workspace.encode_password
#         )
# 
# 
#     @classmethod
#     def authenticate(cls, name, password):
#         workspace = DBSession.query(cls)\
#             .filter_by(name=name)\
#             .first()
# 
#         if workspace:
#             if workspace.password and password and Workspace.check_password(workspace.password, password):
#                 return workspace
#             elif not workspace.password and not password:
#                 return workspace
#         return None
# 
# 
#     @classmethod
#     def by_name(cls, name):
#         q = DBSession.query(cls)\
#             .filter(sa.func.lower(cls.name) == name.lower())
# 
#         return q.first()
# 
# 
#     def get_maps(self, type=None):
#         q = Map.query.filter(Map.workspace_id == self.id)
# 
#         if type:
#             q = q.filter(Map.type == type)
# 
#         return q.all()
# 
# 
#     def get_map_by_name(self, name):
#         q = DBSession.query(Map)\
#             .filter(Map.name == name.lower(), Map.workspace_id == self.id)
# 
#         return q.first()


# Path: scribeui_pyramid/scripts/dataset.py
from fixture import DataSet
from scribeui_pyramid.modules.workspaces.models import Workspace

# -*- coding: utf-8 -*-


class WorkspaceData(DataSet):
    class default:
        name = u'default'
        password = Workspace.encode_password(u'default')


class MapData(DataSet):
    class default:
        name = u'default'
        description = u'Default map'
        type = u'Scribe'
        extent = '-20405648.939901,-17712669.979681,20314497.045109,19408951.476421'
        projection = 'EPSG:900913'
        workspace_id = 1


    class standard: