From 3c43cfc9f91b487d52ff7868f821fe920f676d90 Mon Sep 17 00:00:00 2001 From: Elrond Date: Sun, 22 Jan 2012 20:17:43 +0100 Subject: [PATCH] Move declarative_base Base into base.py The base class of all models "Base" should be in base.py. --- mediagoblin/db/sql/base.py | 4 ++++ mediagoblin/db/sql/models.py | 6 +----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mediagoblin/db/sql/base.py b/mediagoblin/db/sql/base.py index 6f45b21b..1db53c56 100644 --- a/mediagoblin/db/sql/base.py +++ b/mediagoblin/db/sql/base.py @@ -15,6 +15,7 @@ # along with this program. If not, see . +from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import scoped_session, sessionmaker, object_session from sqlalchemy.orm.query import Query from sqlalchemy.sql.expression import desc @@ -73,3 +74,6 @@ class GMGTableBase(object): sess = Session() sess.add(self) sess.commit() + + +Base = declarative_base(cls=GMGTableBase) diff --git a/mediagoblin/db/sql/models.py b/mediagoblin/db/sql/models.py index 57444c2c..95147d50 100644 --- a/mediagoblin/db/sql/models.py +++ b/mediagoblin/db/sql/models.py @@ -17,7 +17,6 @@ import datetime -from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import ( Column, Integer, Unicode, UnicodeText, DateTime, Boolean, ForeignKey, UniqueConstraint) @@ -27,13 +26,10 @@ from sqlalchemy.sql.expression import desc from sqlalchemy.ext.associationproxy import association_proxy from mediagoblin.db.sql.extratypes import PathTupleWithSlashes -from mediagoblin.db.sql.base import GMGTableBase +from mediagoblin.db.sql.base import Base from mediagoblin.db.mixin import UserMixin, MediaEntryMixin -Base = declarative_base(cls=GMGTableBase) - - class SimpleFieldAlias(object): """An alias for any field""" def __init__(self, fieldname): -- 2.25.1