diff options
| author | Aurélien Bompard | 2015-03-25 18:11:11 +0100 |
|---|---|---|
| committer | Aurélien Bompard | 2015-03-25 18:11:11 +0100 |
| commit | 990f3c63814bcfddef2e661248c44e67e945de04 (patch) | |
| tree | 174b5452886b901df34cf711a6691cbac03daafb | |
| parent | d2b5c8c7a11be437ac0c705fb95502d0a83e74b9 (diff) | |
| download | mailman-990f3c63814bcfddef2e661248c44e67e945de04.tar.gz mailman-990f3c63814bcfddef2e661248c44e67e945de04.tar.zst mailman-990f3c63814bcfddef2e661248c44e67e945de04.zip | |
| -rw-r--r-- | src/mailman/config/configure.zcml | 5 | ||||
| -rw-r--r-- | src/mailman/database/alembic/versions/2bb9b382198_workflow_state_table.py | 28 | ||||
| -rw-r--r-- | src/mailman/interfaces/workflowstate.py | 42 | ||||
| -rw-r--r-- | src/mailman/model/workflowstate.py | 41 |
4 files changed, 116 insertions, 0 deletions
diff --git a/src/mailman/config/configure.zcml b/src/mailman/config/configure.zcml index 24061f0f0..6f5876aa8 100644 --- a/src/mailman/config/configure.zcml +++ b/src/mailman/config/configure.zcml @@ -117,4 +117,9 @@ factory="mailman.app.templates.TemplateLoader" /> + <utility + provides="mailman.interfaces.workflowstate.IWorkflowState" + factory="mailman.model.workflowstate.WorkflowState" + /> + </configure> diff --git a/src/mailman/database/alembic/versions/2bb9b382198_workflow_state_table.py b/src/mailman/database/alembic/versions/2bb9b382198_workflow_state_table.py new file mode 100644 index 000000000..23b3adebb --- /dev/null +++ b/src/mailman/database/alembic/versions/2bb9b382198_workflow_state_table.py @@ -0,0 +1,28 @@ +"""Workflow state table + +Revision ID: 2bb9b382198 +Revises: 16c2b25c7b +Create Date: 2015-03-25 18:09:18.338790 + +""" + +# revision identifiers, used by Alembic. +revision = '2bb9b382198' +down_revision = '16c2b25c7b' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + op.create_table('workflowstate', + sa.Column('name', sa.Unicode(), nullable=False), + sa.Column('key', sa.Unicode(), nullable=False), + sa.Column('step', sa.Unicode(), nullable=False), + sa.Column('data', sa.Unicode(), nullable=True), + sa.PrimaryKeyConstraint('name', 'key') + ) + + +def downgrade(): + op.drop_table('workflowstate') diff --git a/src/mailman/interfaces/workflowstate.py b/src/mailman/interfaces/workflowstate.py new file mode 100644 index 000000000..bb08fef2d --- /dev/null +++ b/src/mailman/interfaces/workflowstate.py @@ -0,0 +1,42 @@ +# Copyright (C) 2007-2015 by the Free Software Foundation, Inc. +# +# This file is part of GNU Mailman. +# +# GNU Mailman is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# GNU Mailman. If not, see <http://www.gnu.org/licenses/>. + +"""Interface describing the state of a workflow.""" + +__all__ = [ + 'IWorkflowState', + ] + + +from zope.interface import Interface, Attribute + + + +class IWorkflowState(Interface): + """A basic user.""" + + name = Attribute( + """The name of the workflow.""") + + key = Attribute( + """A unique key identifying the workflow instance.""") + + step = Attribute( + """This workflow's next step.""") + + data = Attribute( + """Additional data (may be JSON-encodedeJSON .""") diff --git a/src/mailman/model/workflowstate.py b/src/mailman/model/workflowstate.py new file mode 100644 index 000000000..5e3301dcf --- /dev/null +++ b/src/mailman/model/workflowstate.py @@ -0,0 +1,41 @@ +# Copyright (C) 2007-2015 by the Free Software Foundation, Inc. +# +# This file is part of GNU Mailman. +# +# GNU Mailman is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# GNU Mailman. If not, see <http://www.gnu.org/licenses/>. + +"""Model for workflow states.""" + +__all__ = [ + 'WorkflowState', + ] + + +from mailman.database.model import Model +from mailman.interfaces.workflowstate import IWorkflowState +from sqlalchemy import Column, Unicode +from zope.interface import implementer + + + +@implementer(IWorkflowState) +class WorkflowState(Model): + """Workflow states.""" + + __tablename__ = 'workflowstate' + + name = Column(Unicode, primary_key=True) + key = Column(Unicode, primary_key=True) + step = Column(Unicode, nullable=False) + data = Column(Unicode) |
