Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

Commit

Permalink
Add a verbose column for fedora-infra/fmn#67.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Mar 20, 2015
1 parent 99d790a commit 5758820
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
23 changes: 23 additions & 0 deletions alembic/versions/24533471e302_add_the_verbose_column.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Add the verbose column.
Revision ID: 24533471e302
Revises: 59ee93c4bf71
Create Date: 2015-03-20 14:49:57.753166
"""

# revision identifiers, used by Alembic.
revision = '24533471e302'
down_revision = '59ee93c4bf71'

from alembic import op
import sqlalchemy as sa


def upgrade():
op.add_column('preferences',
sa.Column('verbose', sa.Boolean(), default=True))


def downgrade():
op.drop_column('preferences', 'verbose')
8 changes: 8 additions & 0 deletions fmn/lib/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ class Preference(BASE):
markup_messages = sa.Column(sa.Boolean, default=False)
triggered_by_links = sa.Column(sa.Boolean, default=False)
shorten_links = sa.Column(sa.Boolean, default=False)
verbose = sa.Column(sa.Boolean, default=True)

openid = sa.Column(
sa.Text,
Expand All @@ -478,6 +479,7 @@ def __json__(self, reify=False):
'markup_messages': self.markup_messages,
'triggered_by_links': self.triggered_by_links,
'shorten_links': self.shorten_links,
'verbose': self.verbose,
'enabled': self.enabled,
'context': self.context.__json__(reify=reify),
'user': self.user.__json__(reify=reify),
Expand Down Expand Up @@ -534,6 +536,12 @@ def set_shorten_links(self, session, value):
session.commit()
self.notify(self.openid, self.context_name, "shorten_links")

def set_verbose(self, session, value):
self.verbose = value
session.add(self)
session.commit()
self.notify(self.openid, self.context_name, "verbose")

@classmethod
def by_user(cls, session, openid):
query = session.query(
Expand Down

0 comments on commit 5758820

Please sign in to comment.