示例#1
0
class Campaign(TableModel):
    """
    Represents a Campaign entity
    """

    __tablename__ = 'campaign'
    __namespace__ = 'pvtranslator'

    id = UnsignedInteger32(pk=True)
    name = Unicode(32, unique=True, nullable=False)
    date = Date(nullable=False)
    module_id = UnsignedInteger32(fk="module.id", nullable=False)

    def __repr__(self):
        return "<Campaign(name='" + str(self.name) + "', date='" + str(
            self.date) + "')>"
示例#2
0
class Permission(TableModel):
    __tablename__ = 'permission'
    __namespace__ = 'spyne.examples.sql_crud'
    __table_args__ = {"sqlite_autoincrement": True}

    id = UnsignedInteger32(primary_key=True)
    application = Unicode(256)
    operation = Unicode(256)
示例#3
0
class Permission(TableModel):
    __tablename__ = 'permission'
    __namespace__ = 'spyne.examples.user_manager'
    __table_args__ = {"sqlite_autoincrement": True}

    id = UnsignedInteger32(pk=True)
    application = Unicode(values=('usermgr', 'accountmgr'))
    operation = Unicode(values=('read', 'modify', 'delete'))
示例#4
0
class Module(TableModel):
    __tablename__ = 'module'
    __namespace__ = 'pvtranslator'

    id = UnsignedInteger32(pk=True)
    name = Unicode(32, unique=True, nullable=False)

    def __repr__(self):
        return "Module(name='%s')" % self.name
示例#5
0
class User(TableModel):
    __tablename__ = 'user'
    __namespace__ = 'spyne.examples.sql_crud'
    __table_args__ = {"sqlite_autoincrement": True}

    id = UnsignedInteger32(primary_key=True)
    name = Unicode(256)
    first_name = Unicode(256)
    last_name = Unicode(256)
    permissions = Array(Permission, store_as='table')
示例#6
0
class User(TableModel):
    __tablename__ = 'user'
    __namespace__ = 'spyne.examples.user_manager'
    __table_args__ = {"sqlite_autoincrement": True}

    id = UnsignedInteger32(pk=True)
    email = Unicode(64, pattern=r'[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}')
    user_name = Unicode(32, min_len=4, pattern='[a-z0-9.]+')
    full_name = Unicode(64, pattern='\w+( \w+)+')
    permissions = Array(Permission).store_as('table')