diff options
Diffstat (limited to 'mediagoblin/db')
-rw-r--r-- | mediagoblin/db/migration_tools.py | 8 | ||||
-rw-r--r-- | mediagoblin/db/migrations.py | 2 | ||||
-rw-r--r-- | mediagoblin/db/models.py | 8 |
3 files changed, 5 insertions, 13 deletions
diff --git a/mediagoblin/db/migration_tools.py b/mediagoblin/db/migration_tools.py index ad137683..e75f3757 100644 --- a/mediagoblin/db/migration_tools.py +++ b/mediagoblin/db/migration_tools.py @@ -147,10 +147,11 @@ class MigrationManager(object): in mediagoblin.db.models """ for Model, rows in self.foundations.items(): - print u'\n + Laying foundations for %s table' % (Model.__name__) + self.printer(u' + Laying foundations for %s table\n' % + (Model.__name__)) for parameters in rows: new_row = Model(**parameters) - new_row.save() + self.session.add(new_row) def create_new_migration_record(self): """ @@ -215,9 +216,8 @@ class MigrationManager(object): self.init_tables() # auto-set at latest migration number self.create_new_migration_record() - self.populate_table_foundations() - self.printer(u"done.\n") + self.populate_table_foundations() self.set_current_migration() return u'inited' diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py index e15b4ad3..9dff22ee 100644 --- a/mediagoblin/db/migrations.py +++ b/mediagoblin/db/migrations.py @@ -427,7 +427,7 @@ class UserBan_v0(declarative_base()): class Privilege_v0(declarative_base()): __tablename__ = 'core__privileges' id = Column(Integer, nullable=False, primary_key=True, unique=True) - privilege_name = Column(Unicode, nullable=False) + privilege_name = Column(Unicode, nullable=False, unique=True) class PrivilegeUserAssociation_v0(declarative_base()): __tablename__ = 'core__privileges_users' diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 54b8f739..69b59c99 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -745,14 +745,6 @@ class Privilege(Base): def __repr__(self): return "<Privilege %s>" % (self.privilege_name) - def is_admin_or_moderator(self): - ''' - This method is necessary to check if a user is able to take moderation - actions. - ''' - - return (self.privilege_name==u'admin' or - self.privilege_name==u'moderator') class PrivilegeUserAssociation(Base): ''' |