Mv db.sql.base to db.base

This concludes the db.sql.* -> db.* move. Our db abstraction layer is
sqlalchemy, so there is no need to a separate db.sql.* hierarchy.

All tests have been run for each of the commit series to make sure
everything works at every step.
This commit is contained in:
Sebastian Spaeth 2013-01-07 13:03:51 +01:00
parent a5acfe23fa
commit 39dc3bf8db
13 changed files with 11 additions and 29 deletions

View File

@ -32,9 +32,8 @@ from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.util import memoized_property from sqlalchemy.util import memoized_property
from mediagoblin.db.extratypes import PathTupleWithSlashes, JSONEncoded from mediagoblin.db.extratypes import PathTupleWithSlashes, JSONEncoded
from mediagoblin.db.sql.base import Base, DictReadAttrProxy from mediagoblin.db.base import Base, DictReadAttrProxy, Session
from mediagoblin.db.mixin import UserMixin, MediaEntryMixin, MediaCommentMixin, CollectionMixin, CollectionItemMixin from mediagoblin.db.mixin import UserMixin, MediaEntryMixin, MediaCommentMixin, CollectionMixin, CollectionItemMixin
from mediagoblin.db.sql.base import Session
# It's actually kind of annoying how sqlalchemy-migrate does this, if # It's actually kind of annoying how sqlalchemy-migrate does this, if
# I understand it right, but whatever. Anyway, don't remove this :P # I understand it right, but whatever. Anyway, don't remove this :P

View File

@ -32,8 +32,7 @@ from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.util import memoized_property from sqlalchemy.util import memoized_property
from mediagoblin.db.extratypes import PathTupleWithSlashes, JSONEncoded from mediagoblin.db.extratypes import PathTupleWithSlashes, JSONEncoded
from mediagoblin.db.sql.base import GMGTableBase from mediagoblin.db.base import GMGTableBase, Session
from mediagoblin.db.sql.base import Session
Base_v0 = declarative_base(cls=GMGTableBase) Base_v0 = declarative_base(cls=GMGTableBase)

View File

@ -18,7 +18,7 @@
from sqlalchemy import create_engine from sqlalchemy import create_engine
import logging import logging
from mediagoblin.db.sql.base import Base, Session from mediagoblin.db.base import Base, Session
from mediagoblin import mg_globals from mediagoblin import mg_globals
_log = logging.getLogger(__name__) _log = logging.getLogger(__name__)

View File

@ -1,15 +0,0 @@
# GNU MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys import sys
from mediagoblin.db.sql.base import Session from mediagoblin.db.base import Session
from mediagoblin.db.models import MediaEntry, Tag, MediaTag, Collection from mediagoblin.db.models import MediaEntry, Tag, MediaTag, Collection
from mediagoblin.tools.common import simple_printer from mediagoblin.tools.common import simple_printer

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from mediagoblin.db.sql.base import Base from mediagoblin.db.base import Base
from sqlalchemy import ( from sqlalchemy import (
Column, Integer, ForeignKey) Column, Integer, ForeignKey)

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from mediagoblin.db.sql.base import Base from mediagoblin.db.base import Base
from sqlalchemy import ( from sqlalchemy import (
Column, Integer, ForeignKey) Column, Integer, ForeignKey)

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from mediagoblin.db.sql.base import Base from mediagoblin.db.base import Base
from sqlalchemy import ( from sqlalchemy import (
Column, Integer, Float, ForeignKey) Column, Integer, Float, ForeignKey)

View File

@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from mediagoblin.db.sql.base import Base from mediagoblin.db.base import Base
from sqlalchemy import ( from sqlalchemy import (
Column, Integer, SmallInteger, ForeignKey) Column, Integer, SmallInteger, ForeignKey)

View File

@ -19,7 +19,7 @@ import bcrypt
from datetime import datetime, timedelta from datetime import datetime, timedelta
from mediagoblin.db.sql.base import Base from mediagoblin.db.base import Base
from mediagoblin.db.models import User from mediagoblin.db.models import User
from sqlalchemy import ( from sqlalchemy import (

View File

@ -25,7 +25,7 @@ from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import select, insert from sqlalchemy.sql import select, insert
from migrate import changeset from migrate import changeset
from mediagoblin.db.sql.base import GMGTableBase from mediagoblin.db.base import GMGTableBase
from mediagoblin.db.util import MigrationManager, RegisterMigration from mediagoblin.db.util import MigrationManager, RegisterMigration
from mediagoblin.tools.common import CollectingPrinter from mediagoblin.tools.common import CollectingPrinter

View File

@ -28,7 +28,7 @@ from mediagoblin import mg_globals
from mediagoblin.tools import testing from mediagoblin.tools import testing
from mediagoblin.init.config import read_mediagoblin_config from mediagoblin.init.config import read_mediagoblin_config
from mediagoblin.db.open import setup_connection_and_db_from_config from mediagoblin.db.open import setup_connection_and_db_from_config
from mediagoblin.db.sql.base import Session from mediagoblin.db.base import Session
from mediagoblin.meddleware import BaseMeddleware from mediagoblin.meddleware import BaseMeddleware
from mediagoblin.auth.lib import bcrypt_gen_password_hash from mediagoblin.auth.lib import bcrypt_gen_password_hash
from mediagoblin.gmg_commands.dbupdate import run_dbupdate from mediagoblin.gmg_commands.dbupdate import run_dbupdate
@ -219,7 +219,6 @@ def fixture_add_user(username=u'chris', password='toast',
test_user = mg_globals.database.User.find_one({'username': username}) test_user = mg_globals.database.User.find_one({'username': username})
# ... and detach from session: # ... and detach from session:
from mediagoblin.db.sql.base import Session
Session.expunge(test_user) Session.expunge(test_user)
return test_user return test_user