diff --git a/progit/lib/model.py b/progit/lib/model.py index ebd693f..5717fde 100644 --- a/progit/lib/model.py +++ b/progit/lib/model.py @@ -48,9 +48,9 @@ def create_tables(db_url, alembic_ini=None, debug=False): from progit.ui.plugins import get_plugin_tables get_plugin_tables() BASE.metadata.create_all(engine) - #engine.execute(collection_package_create_view(driver=engine.driver)) + # engine.execute(collection_package_create_view(driver=engine.driver)) if db_url.startswith('sqlite:'): - ## Ignore the warning about con_record + # Ignore the warning about con_record # pylint: disable=W0613 def _fk_pragma_on_connect(dbapi_con, con_record): ''' Tries to enforce referential constraints on sqlite. ''' @@ -61,7 +61,7 @@ def create_tables(db_url, alembic_ini=None, debug=False): # then, load the Alembic configuration and generate the # version table, "stamping" it with the most recent rev: - ## Ignore the warning missing alembic + # Ignore the warning missing alembic # pylint: disable=F0401 from alembic.config import Config from alembic import command @@ -86,7 +86,7 @@ def create_default_status(session): session.add(ticket_stat) try: session.flush() - except SQLAlchemyError, err: + except SQLAlchemyError, err: # pragma: no cover ERROR_LOG.debug('Status %s could not be added', ticket_stat) session.commit() @@ -202,11 +202,13 @@ class Project(BASE): user = relation('User', foreign_keys=[user_id], remote_side=[User.id], backref='projects') - users = relation('User', + users = relation( + 'User', secondary="user_projects", primaryjoin="projects.c.id==user_projects.c.project_id", secondaryjoin="users.c.id==user_projects.c.user_id", - backref='co_projects') + backref='co_projects' + ) @property def path(self):