Exemplo n.º 1
0
Arquivo: demo.py Projeto: cerha/pytis
class LogTable(sql.SQLTable):
    name = 'log_table'
    fields = (sql.PrimaryColumn('id', pytis.data.Serial()),
              sql.Column('table_name', pytis.data.String(),),
              sql.Column('action', pytis.data.String()),
              )
    unique = (('table_name', 'action',),)
Exemplo n.º 2
0
class Circular1(sql.SQLTable):
    """Circular REFERENCES, together with Circular2."""
    name = 'circular1'
    fields = (
        sql.PrimaryColumn('id', pytis.data.Integer()),
        sql.Column('x', pytis.data.Integer(), references=sql.r.Circular2.id),
    )
Exemplo n.º 3
0
Arquivo: demo.py Projeto: cerha/pytis
class Products(sql.SQLTable):
    name = 'products'
    fields = (
        sql.PrimaryColumn('product_id', pytis.data.Serial(), _("ID")),
        sql.Column('product', pytis.data.String(not_null=True), _("Product")),
        sql.Column('count', pytis.data.Integer(not_null=True), _("Count")),
        sql.Column('price', pytis.data.Float(precision=2, not_null=True), _("Price")),
        sql.Column('since', pytis.data.DateTime(not_null=True), _("Available since")),
        sql.Column('marked', pytis.data.Boolean(not_null=True), _("Marked"), default=False),
        sql.Column('notes', pytis.data.String(not_null=False), _("Notes")),
    )
    with_oids = True
    depends_on = ()
    access_rights = (('all', 'pytis-demo'), ('select', 'www-data'))

    init_columns = ('product', 'count', 'price', 'marked', 'since', 'notes')
    init_values = (
        ('HP LaserJet 5L', 0, 399.99, False, '1994-08-18', None),
        ('HP LaserJet 3050', 32, 299.99, True, '2004-04-08 10:55:20', 'Free standard shipping'),
        ('HP Photosmart C7180', 8, 399.99, True, '2006-10-11 16:32:41', None),
        ('HP LaserJet 1020', 5, 179.99, False, '2005-12-01 08:52:22', 'Free standard shipping'),
        ('HP DeskJet 640s', 2, 188.00, True, '2007-10-11 10:21:00', None),
        ('HP DeskJet 347A', 6, 219.99, True, '2007-10-11 11:07:00', None),
        ('HP DeskJet 24D', 9, 249.99, True, '2007-10-11 11:07:00', None),
    )
Exemplo n.º 4
0
class EPytisCryptoKeys(Base_LogSQLTable):
    """Table of encryption keys of users for defined encryption areas."""
    name = 'e_pytis_crypto_keys'
    schemas = pytis_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('key_id', pytis.data.Serial()),
        sql.Column('name',
                   pytis.data.String(not_null=True),
                   label=_("Šifrovací oblast"),
                   references=sql.a(sql.r.CPytisCryptoNames.name,
                                    onupdate='CASCADE')),
        sql.Column('username',
                   pytis.data.String(not_null=True),
                   label=_("Uživatel"),
                   doc="Arbitrary user identifier."),
        sql.Column('key', pytis.data.Binary(not_null=True)),
        sql.Column(
            'fresh',
            pytis.data.Boolean(not_null=True),
            label=_("Nový"),
            doc=
            "Flag indicating the key is encrypted by a non-login password. ",
            default=False),
    )
    inherits = (XChanges, )
    unique = ((
        'name',
        'username',
    ), )
    depends_on = (CPytisCryptoNames, )
    access_rights = default_access_rights.value(globals())
Exemplo n.º 5
0
class CmsUsersTable(sql.SQLTable):
    name = 'cms_users_table'
    schemas = cms_schemas.value(globals())
    fields = (sql.PrimaryColumn('uid', pytis.data.Serial()), )
    with_oids = True
    depends_on = ()
    access_rights = ()
Exemplo n.º 6
0
class CmsRightsAssignment(sql.SQLTable):
    """Underlying binding table between menu items, roles and module actions."""
    name = 'cms_rights_assignment'
    schemas = cms_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('rights_assignment_id', pytis.data.Serial()),
        sql.Column('menu_item_id',
                   pytis.data.Integer(not_null=True),
                   references=sql.gA('cms_menu_structure',
                                     ondelete='CASCADE')),
        sql.Column('role_id',
                   pytis.data.Integer(not_null=True),
                   references=sql.gA('cms_roles', ondelete='CASCADE')),
        sql.Column('action_id',
                   pytis.data.Integer(not_null=True),
                   references=sql.gA('cms_actions', ondelete='CASCADE')),
    )
    with_oids = True
    unique = ((
        'menu_item_id',
        'role_id',
        'action_id',
    ), )
    depends_on = (
        CmsMenuStructure,
        CmsRoles,
        CmsActions,
    )
    access_rights = cms_rights.value(globals())
Exemplo n.º 7
0
class CmsSessionLogData(sql.SQLTable):
    """Log of web user logins (underlying data)."""
    name = 'cms_session_log_data'
    schemas = cms_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('log_id', pytis.data.Serial()),
        sql.Column('session_id',
                   pytis.data.Integer(not_null=False),
                   references=sql.gA('cms_session', ondelete='SET NULL')),
        sql.Column('uid',
                   pytis.data.Integer(not_null=False),
                   references=sql.gA(cms_users_table.value(globals()),
                                     ondelete='CASCADE')),
        sql.Column('login', pytis.data.String(not_null=True)),
        sql.Column('success', pytis.data.Boolean(not_null=True),
                   default=False),
        sql.Column('start_time', pytis.data.DateTime(not_null=True)),
        sql.Column('end_time', pytis.data.DateTime(not_null=False)),
        sql.Column('ip_address', pytis.data.String(not_null=True)),
        sql.Column('user_agent', pytis.data.String(not_null=False)),
        sql.Column('referer', pytis.data.String(not_null=False)),
    )
    with_oids = True
    depends_on = ()
    access_rights = cms_rights_rw.value(globals())
Exemplo n.º 8
0
class EPytisHelpPagesAttachments(Base_LogSQLTable):
    """Attachments for help texts (images etc.)"""
    name = 'e_pytis_help_pages_attachments'
    fields = (
        sql.PrimaryColumn('file_id', pytis.data.Serial()),
        sql.Column('page_id',
                   pytis.data.Integer(not_null=True),
                   references=sql.a(sql.r.EPytisHelpPages.page_id,
                                    ondelete='CASCADE')),
        sql.Column('file_name', pytis.data.String(not_null=True)),
        sql.Column('byte_size', pytis.data.Integer(not_null=True)),
        sql.Column('width', pytis.data.Integer(not_null=False)),
        sql.Column('height', pytis.data.Integer(not_null=False)),
        sql.Column('resized_width', pytis.data.Integer(not_null=False)),
        sql.Column('resized_height', pytis.data.Integer(not_null=False)),
        sql.Column('thumbnail_width', pytis.data.Integer(not_null=False)),
        sql.Column('thumbnail_height', pytis.data.Integer(not_null=False)),
        sql.Column('file', pytis.data.Binary(not_null=True)),
        sql.Column('resized', pytis.data.Binary(not_null=False)),
        sql.Column('thumbnail', pytis.data.Binary(not_null=False)),
    )
    inherits = (XChanges, )
    unique = ((
        'page_id',
        'file_name',
    ), )
    depends_on = (EPytisHelpPages, )
    access_rights = default_access_rights.value(globals())
Exemplo n.º 9
0
class EPytisHelpSpecItems(Base_LogSQLTable):
    """Help texts for specification items, such as fields, bindings, actions."""
    name = 'e_pytis_help_spec_items'
    fields = (
        sql.PrimaryColumn('item_id', pytis.data.Serial()),
        sql.Column('spec_name',
                   pytis.data.String(not_null=True),
                   references=sql.a(sql.r.EPytisHelpSpec.spec_name,
                                    onupdate='CASCADE',
                                    ondelete='CASCADE')),
        sql.Column(
            'kind',
            pytis.data.String(not_null=True),
            check="kind in ('field', 'profile', 'binding', 'action', 'proc')"),
        sql.Column('identifier', pytis.data.String(not_null=True)),
        sql.Column('content', pytis.data.String(not_null=False)),
        sql.Column('changed',
                   pytis.data.Boolean(not_null=True),
                   doc="True when the content was edited by hand.",
                   default=False),
        sql.Column('removed',
                   pytis.data.Boolean(not_null=True),
                   doc="False when the item still exists in specification.",
                   default=False),
    )
    inherits = (XChanges, )
    unique = ((
        'spec_name',
        'kind',
        'identifier',
    ), )
    depends_on = ()
    access_rights = default_access_rights.value(globals())
Exemplo n.º 10
0
class EPytisFormLog(sql.SQLTable):
    """
    Statistics about using forms by users and form opening performance.
    form is fully qualified specification name.
    class is pytis class name of the form instance.
    login is login name of the user who has opened the form.
    info is optional extra information provided by the form (e.g. sorting used).
    t_start is the time when user invoked the form opening command.
    t_show is the time when the form got actually ready for operation after its start.
    """
    name = 'e_pytis_form_log'
    schemas = pytis_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('id', pytis.data.Serial()),
        sql.Column('form', pytis.data.String(not_null=True), index=True),
        sql.Column('class', pytis.data.String(not_null=True), index=True),
        sql.Column('info', pytis.data.String(not_null=False), index=True),
        sql.Column('login', pytis.data.Name(not_null=True), index=True),
        sql.Column('t_start',
                   pytis.data.DateTime(not_null=True, without_timezone=True),
                   index=True),
        sql.Column('t_show',
                   pytis.data.DateTime(not_null=True, without_timezone=True)),
    )
    inherits = (XChanges, )
    with_oids = True
    depends_on = ()
    access_rights = default_access_rights.value(globals())
Exemplo n.º 11
0
class CmsMenuStructure(sql.SQLTable):
    """Language independent menu structure."""
    name = 'cms_menu_structure'
    schemas = cms_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('menu_item_id', pytis.data.Serial()),
        sql.Column('identifier',
                   pytis.data.String(maxlen=32, not_null=True),
                   unique=True),
        sql.Column('parent',
                   pytis.data.Integer(not_null=False),
                   references=sql.gA('cms_menu_structure')),
        sql.Column('mod_id',
                   pytis.data.Integer(not_null=False),
                   references=sql.gA('cms_modules')),
        sql.Column('ord', pytis.data.Integer(not_null=True)),
        sql.Column('tree_order', pytis.data.LTree(not_null=False)),
    )
    index_columns = (  #('ord', sqlalchemy.literal_column('coalesce(parent, 0)'),),
        (
            'parent',
            'ord',
        ), )
    with_oids = True
    depends_on = (CmsModules, )
    access_rights = cms_rights.value(globals())
Exemplo n.º 12
0
class CmsActions(sql.SQLTable):
    """Enumeration of valid actions.
    (Including both module independent actions and per module actions.)
    Module independent actions have NULL in the mod_id column.
    """
    name = '_cms_actions'
    external = True
    schemas = cms_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('action_id', pytis.data.Serial()),
        sql.Column('mod_id',
                   pytis.data.Integer(not_null=False),
                   references=sql.gA('cms_modules', ondelete='CASCADE')),
        sql.Column('name', pytis.data.String(maxlen=16, not_null=True)),
        sql.Column('description', pytis.data.String(not_null=True)),
    )
    unique = ((
        'mod_id',
        'name',
    ), )
    depends_on = (CmsModules, )
    access_rights = cms_rights.value(globals())
    init_columns = ('name', 'description')
    init_values = (
        ('visit', 'Display the item content'),
        ('show', 'See the item in the menu'),
    )
Exemplo n.º 13
0
Arquivo: demo.py Projeto: cerha/pytis
class ReferencingTable(sql.SQLTable):
    name = 'referencing_table'
    fields = (sql.PrimaryColumn('id', pytis.data.Serial()),
              sql.Column('name', pytis.data.String()),
              sql.Column('action', pytis.data.String()),
              )
    foreign_keys = (sql.a(('name', 'action',), (sql.r.LogTable.table_name, sql.r.LogTable.action,),
                          onupdate='cascade', ondelete='cascade'),)
Exemplo n.º 14
0
Arquivo: demo.py Projeto: cerha/pytis
class Longtable(sql.SQLTable):
    name = 'longtable'
    fields = (
        sql.PrimaryColumn('id', pytis.data.Serial(), _("ID")),
        sql.Column('value', pytis.data.String(maxlen=6, not_null=False), _("Value")),
    )
    with_oids = True
    depends_on = ()
    access_rights = ()
Exemplo n.º 15
0
Arquivo: demo.py Projeto: cerha/pytis
class Passwords(sql.SQLTable):
    name = 'passwords'
    fields = (
        sql.PrimaryColumn('id', pytis.data.Serial()),
        sql.Column('name', pytis.data.String(not_null=True), _("Name"), unique=True),
        sql.Column('passwd', pytis.data.String(not_null=True), _("Password")),
    )
    with_oids = True
    depends_on = ()
    access_rights = (('all', 'pytis-demo'), ('select', 'www-data'))
Exemplo n.º 16
0
Arquivo: demo.py Projeto: cerha/pytis
class BinaryData(sql.SQLTable):
    name = 'binary_data'
    fields = (
        sql.PrimaryColumn('id', pytis.data.Serial(), _("Id")),
        sql.Column('data', pytis.data.Binary(not_null=True), _("File")),
        sql.Column('descr', pytis.data.String(not_null=True), _("Description")),
        sql.Column('filename', pytis.data.String(not_null=True), _("File name")),
    )
    with_oids = True
    depends_on = ()
    access_rights = (('all', 'pytis-demo'), ('select', 'www-data'))
Exemplo n.º 17
0
Arquivo: demo.py Projeto: cerha/pytis
class CmsUsers(sql.SQLTable):
    name = 'cms_users'
    fields = (
        sql.PrimaryColumn('uid', pytis.data.Serial()),
        sql.Column('login', pytis.data.String(not_null=True), unique=True),
        sql.Column('passwd', pytis.data.String(not_null=True)),
        sql.Column('fullname', pytis.data.String(not_null=True)),
    )
    with_oids = True
    depends_on = ()
    access_rights = (('all', 'pytis-demo'), ('select', 'www-data'))
Exemplo n.º 18
0
Arquivo: demo.py Projeto: cerha/pytis
class RangeTypes(sql.SQLTable):
    name = 'range_types'
    fields = (
        sql.PrimaryColumn('range_id', pytis.data.Serial(), _("ID")),
        sql.Column('date_range', pytis.data.DateRange(not_null=True), _("Date")),
        sql.Column('datetime_range', pytis.data.DateTimeRange(not_null=True), _("DateTime")),
        sql.Column('int_range', pytis.data.IntegerRange(not_null=True), _("Integer")),
    )
    with_oids = True
    depends_on = ()
    access_rights = (('all', 'pytis-demo'), ('select', 'www-data'))
Exemplo n.º 19
0
class CmsUsers(sql.SQLTable):
    name = 'pytis_cms_users'
    schemas = cms_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('uid', pytis.data.Serial()),
        sql.Column('login', pytis.data.String(not_null=True), unique=True),
        sql.Column('fullname', pytis.data.String(not_null=True)),
        sql.Column('passwd', pytis.data.String(not_null=True)),
    )
    depends_on = ()
    access_rights = ()
Exemplo n.º 20
0
Arquivo: demo.py Projeto: cerha/pytis
class XTree(sql.SQLTable):
    name = '_tree'
    fields = (
        sql.PrimaryColumn('id', pytis.data.LTree(not_null=False)),
        sql.Column('name', pytis.data.Name()),
        sql.Column('amount', pytis.data.Integer(not_null=False)),
        sql.Column('description', pytis.data.String(not_null=False)),
    )
    with_oids = True
    depends_on = ()
    access_rights = (('all', 'pytis-demo'), ('select', 'www-data'))
Exemplo n.º 21
0
Arquivo: demo.py Projeto: cerha/pytis
class Files(sql.SQLTable):
    name = 'files'
    fields = (
        sql.PrimaryColumn('id', pytis.data.Serial(), _("ID")),
        sql.Column('file', pytis.data.String(not_null=False), _("File")),
        sql.Column('url', pytis.data.String(not_null=False), _("URL")),
    )
    init_columns = ('id', 'file', 'url')
    init_values = ((0, '/Python26/README.txt', 'http://www.python.org',),)
    with_oids = True
    depends_on = ()
    access_rights = (('all', 'pytis-demo'), ('select', 'www-data'))
Exemplo n.º 22
0
class Log(sql.SQLTable):
    """Tabulka pro logování provedených DML příkazů."""
    name = 'log'
    fields = (sql.PrimaryColumn('id', pytis.data.Serial()),
              sql.Column('command', pytis.data.String(not_null=True)),
              sql.Column('login', pytis.data.Name(not_null=True), default=sqlalchemy.text('user')),
              sql.Column('timestamp', pytis.data.DateTime(not_null=True),
                         default=sqlalchemy.text('now()')),
              )
    with_oids = True
    depends_on = ()
    access_rights = default_access_rights.value(globals())
Exemplo n.º 23
0
class EPytisConfig(sql.SQLTable):
    """Pytis application configuration storage."""
    name = 'e_pytis_config'
    schemas = pytis_schemas.value(globals())
    fields = (sql.PrimaryColumn('id', pytis.data.Serial()),
              sql.Column('username', pytis.data.Name(not_null=True)),
              sql.Column('option', pytis.data.String(not_null=True)),
              sql.Column('value', pytis.data.String(not_null=True)),
              )
    inherits = (XChanges,)
    unique = (('username', 'option',),)
    depends_on = ()
    access_rights = default_access_rights.value(globals())
Exemplo n.º 24
0
class CmsLanguages(sql.SQLTable):
    """Codebook of languages available in the CMS."""
    name = 'cms_languages'
    schemas = cms_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('lang_id', pytis.data.Serial()),
        sql.Column('lang',
                   pytis.data.String(minlen=2, maxlen=2, not_null=True),
                   unique=True),
    )
    with_oids = True
    depends_on = ()
    access_rights = cms_rights.value(globals())
Exemplo n.º 25
0
Arquivo: demo.py Projeto: cerha/pytis
class RuntimeFilterDemo(sql.SQLTable):
    name = 'runtime_filter_demo'
    fields = (
        sql.PrimaryColumn('id', pytis.data.Serial()),
        sql.Column('product_id', pytis.data.Integer(not_null=True), references=sql.r.Products),
        sql.Column('country', pytis.data.String(minlen=2, maxlen=2, not_null=True),
                   references=sql.r.Countries),
        sql.Column('continent', pytis.data.String(minlen=2, maxlen=2, not_null=True),
                   references=sql.r.Continents),
    )
    with_oids = True
    depends_on = ()
    access_rights = (('all', 'pytis-demo'), ('select', 'www-data'))
Exemplo n.º 26
0
class CmsModules(sql.SQLTable):
    """Codebook of extension modules available in the CMS."""
    name = 'cms_modules'
    schemas = cms_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('mod_id', pytis.data.Serial()),
        sql.Column('modname',
                   pytis.data.String(maxlen=64, not_null=True),
                   unique=True),
    )
    with_oids = True
    depends_on = ()
    access_rights = cms_rights.value(globals())
Exemplo n.º 27
0
class XChangesStatistic(sql.SQLTable):
    """Tabulka pro statistiky změn v tabulkách."""
    name = '_changes_statistic'
    fields = (sql.PrimaryColumn('id', pytis.data.Serial(), doc="identifikace řádku"),
              sql.Column('uzivatel', pytis.data.Name(not_null=True),
                         default=sqlalchemy.text('user')),
              sql.Column('datum', pytis.data.Date(not_null=False)),
              sql.Column('inserts', pytis.data.Integer(not_null=False)),
              sql.Column('updates', pytis.data.Integer(not_null=False)),
              sql.Column('deletes', pytis.data.Integer(not_null=False)),
              )
    with_oids = True
    depends_on = ()
    access_rights = default_access_rights.value(globals())
Exemplo n.º 28
0
class CTypFormular(Base_LogSQLTable):
    """Slouží jako číselník typů formulářů"""
    name = 'c_typ_formular'
    fields = (sql.PrimaryColumn('id', pytis.data.String(maxlen=2, not_null=False)),
              sql.Column('popis', pytis.data.String(not_null=False)),
              )
    inherits = (XChanges,)
    init_columns = ('id', 'popis')
    init_values = (('BF', 'Jednoduchý náhled',),
                   ('DF', 'Duální náhled',),
                   )
    with_oids = True
    depends_on = ()
    access_rights = default_access_rights.value(globals())
Exemplo n.º 29
0
class PytisCryptoDbKeys(sql.SQLTable):
    """
    Table of asymetric encryption keys.
    It is currently used to encrypt user passwords passed to some database functions.
    Use select pytis_crypto_create_db_key('pytis', 1024) to create a key for that purpose.
    """
    name = 'pytis_crypto_db_keys'
    schemas = pytis_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('key_name', pytis.data.String(not_null=False)),
        sql.Column('public', pytis.data.String(not_null=False)),
        sql.Column('private', pytis.data.String(not_null=False)),
    )
    depends_on = ()
    access_rights = crypto_select_rights.value(globals())
Exemplo n.º 30
0
class CPytisCryptoNames(Base_LogSQLTable):
    """Codebook of encryption areas defined in the application."""
    name = 'c_pytis_crypto_names'
    schemas = pytis_schemas.value(globals())
    fields = (
        sql.PrimaryColumn('name',
                          pytis.data.String(not_null=False),
                          label=_("Šifrovací oblast")),
        sql.Column('description',
                   pytis.data.String(not_null=False),
                   label=_("Popis")),
    )
    inherits = (XChanges, )
    depends_on = ()
    access_rights = default_access_rights.value(globals())