From: Sebastian Spaeth Date: Fri, 30 Nov 2012 09:10:35 +0000 (+0100) Subject: Move db.sql.models* to db.models* X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b0c8328e547288028e7e43f0ceb1fa9f7c8dac4a;p=mediagoblin.git Move db.sql.models* to db.models* --- diff --git a/docs/source/siteadmin/relnotes.rst b/docs/source/siteadmin/relnotes.rst index 9b45f642..7d480d90 100644 --- a/docs/source/siteadmin/relnotes.rst +++ b/docs/source/siteadmin/relnotes.rst @@ -26,6 +26,9 @@ WIP **Other changed** +* Plugin writers: Internal restructuring led to mediagoblin.db.sql* be + mediagoblin.db.* starting from 0.3.3 + * Dependency list has been reduced not requireing the "webob" package anymore. 0.3.2 diff --git a/mediagoblin/admin/views.py b/mediagoblin/admin/views.py index 073b1e25..22ca74a3 100644 --- a/mediagoblin/admin/views.py +++ b/mediagoblin/admin/views.py @@ -16,7 +16,7 @@ from werkzeug.exceptions import Forbidden -from mediagoblin.db.sql.models import MediaEntry +from mediagoblin.db.models import MediaEntry from mediagoblin.decorators import require_active_login from mediagoblin.tools.response import render_to_response diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index efd3e018..43354135 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -18,7 +18,7 @@ import uuid import datetime from mediagoblin import messages, mg_globals -from mediagoblin.db.sql.models import User +from mediagoblin.db.models import User from mediagoblin.tools.response import render_to_response, redirect, render_404 from mediagoblin.tools.translate import pass_to_ugettext as _ from mediagoblin.auth import lib as auth_lib diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py index 3f0cb6f0..476e2a06 100644 --- a/mediagoblin/db/migrations.py +++ b/mediagoblin/db/migrations.py @@ -24,7 +24,7 @@ from sqlalchemy.ext.declarative import declarative_base from migrate.changeset.constraint import UniqueConstraint from mediagoblin.db.util import RegisterMigration -from mediagoblin.db.sql.models import MediaEntry, Collection, User +from mediagoblin.db.models import MediaEntry, Collection, User MIGRATIONS = {} diff --git a/mediagoblin/db/sql/models.py b/mediagoblin/db/models.py similarity index 100% rename from mediagoblin/db/sql/models.py rename to mediagoblin/db/models.py diff --git a/mediagoblin/db/sql/models_v0.py b/mediagoblin/db/models_v0.py similarity index 100% rename from mediagoblin/db/sql/models_v0.py rename to mediagoblin/db/models_v0.py diff --git a/mediagoblin/db/open.py b/mediagoblin/db/open.py index 801c92ea..11b2dc97 100644 --- a/mediagoblin/db/open.py +++ b/mediagoblin/db/open.py @@ -50,7 +50,7 @@ class DatabaseMaster(object): def load_models(app_config): - import mediagoblin.db.sql.models + import mediagoblin.db.models for media_type in app_config['media_types']: _log.debug("Loading %s.models", media_type) diff --git a/mediagoblin/db/util.py b/mediagoblin/db/util.py index 2f167e45..32dd0884 100644 --- a/mediagoblin/db/util.py +++ b/mediagoblin/db/util.py @@ -15,7 +15,7 @@ # along with this program. If not, see . import sys from mediagoblin.db.sql.base import Session -from mediagoblin.db.sql.models import MediaEntry, Tag, MediaTag, Collection +from mediagoblin.db.models import MediaEntry, Tag, MediaTag, Collection from mediagoblin.tools.common import simple_printer @@ -45,7 +45,7 @@ class MigrationManager(object): self.printer = printer # For convenience - from mediagoblin.db.sql.models import MigrationData + from mediagoblin.db.models import MigrationData self.migration_model = MigrationData self.migration_table = MigrationData.__table__ @@ -259,7 +259,7 @@ def assure_migrations_table_setup(db): """ Make sure the migrations table is set up in the database. """ - from mediagoblin.db.sql.models import MigrationData + from mediagoblin.db.models import MigrationData if not MigrationData.__table__.exists(db.bind): MigrationData.metadata.create_all( diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py index f6169060..4ae1b867 100644 --- a/mediagoblin/decorators.py +++ b/mediagoblin/decorators.py @@ -20,7 +20,7 @@ from urlparse import urljoin from werkzeug.exceptions import Forbidden from werkzeug.urls import url_quote -from mediagoblin.db.sql.models import MediaEntry, User +from mediagoblin.db.models import MediaEntry, User from mediagoblin.tools.response import redirect, render_404 diff --git a/mediagoblin/gmg_commands/dbupdate.py b/mediagoblin/gmg_commands/dbupdate.py index 95898c08..5151ba9d 100644 --- a/mediagoblin/gmg_commands/dbupdate.py +++ b/mediagoblin/gmg_commands/dbupdate.py @@ -52,7 +52,7 @@ def gather_database_data(media_types, plugins): managed_dbdata = [] # Add main first - from mediagoblin.db.sql.models import MODELS as MAIN_MODELS + from mediagoblin.db.models import MODELS as MAIN_MODELS from mediagoblin.db.migrations import MIGRATIONS as MAIN_MIGRATIONS managed_dbdata.append( diff --git a/mediagoblin/listings/views.py b/mediagoblin/listings/views.py index 80182124..d37161fc 100644 --- a/mediagoblin/listings/views.py +++ b/mediagoblin/listings/views.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from mediagoblin.db.sql.models import MediaEntry +from mediagoblin.db.models import MediaEntry from mediagoblin.db.util import media_entries_for_tag_slug from mediagoblin.tools.pagination import Pagination from mediagoblin.tools.response import render_to_response diff --git a/mediagoblin/plugins/oauth/migrations.py b/mediagoblin/plugins/oauth/migrations.py index 3beef087..7b028faf 100644 --- a/mediagoblin/plugins/oauth/migrations.py +++ b/mediagoblin/plugins/oauth/migrations.py @@ -20,7 +20,7 @@ from sqlalchemy import (MetaData, Table, Column, from sqlalchemy.ext.declarative import declarative_base from mediagoblin.db.util import RegisterMigration -from mediagoblin.db.sql.models import User +from mediagoblin.db.models import User MIGRATIONS = {} diff --git a/mediagoblin/plugins/oauth/models.py b/mediagoblin/plugins/oauth/models.py index 7e247c1a..f52a8ce9 100644 --- a/mediagoblin/plugins/oauth/models.py +++ b/mediagoblin/plugins/oauth/models.py @@ -20,7 +20,7 @@ import bcrypt from datetime import datetime, timedelta from mediagoblin.db.sql.base import Base -from mediagoblin.db.sql.models import User +from mediagoblin.db.models import User from sqlalchemy import ( Column, Unicode, Integer, DateTime, ForeignKey, Enum) diff --git a/mediagoblin/processing/task.py b/mediagoblin/processing/task.py index b7e761f2..b29de9bd 100644 --- a/mediagoblin/processing/task.py +++ b/mediagoblin/processing/task.py @@ -19,7 +19,7 @@ import logging from celery.task import Task from mediagoblin import mg_globals as mgg -from mediagoblin.db.sql.models import MediaEntry +from mediagoblin.db.models import MediaEntry from mediagoblin.processing import mark_entry_failed, BaseProcessingFail from mediagoblin.tools.processing import json_processing_callback diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py index 169b2309..f4a31a81 100644 --- a/mediagoblin/tests/test_auth.py +++ b/mediagoblin/tests/test_auth.py @@ -21,7 +21,7 @@ from nose.tools import assert_equal from mediagoblin import mg_globals from mediagoblin.auth import lib as auth_lib -from mediagoblin.db.sql.models import User +from mediagoblin.db.models import User from mediagoblin.tests.tools import setup_fresh_app, fixture_add_user from mediagoblin.tools import template, mail diff --git a/mediagoblin/tests/test_tests.py b/mediagoblin/tests/test_tests.py index 2228d15a..b11dc730 100644 --- a/mediagoblin/tests/test_tests.py +++ b/mediagoblin/tests/test_tests.py @@ -16,7 +16,7 @@ from mediagoblin import mg_globals from mediagoblin.tests.tools import get_test_app -from mediagoblin.db.sql.models import User +from mediagoblin.db.models import User def test_get_test_app_wipes_db(): diff --git a/mediagoblin/tools/request.py b/mediagoblin/tools/request.py index f40ab360..f7311fac 100644 --- a/mediagoblin/tools/request.py +++ b/mediagoblin/tools/request.py @@ -15,7 +15,7 @@ # along with this program. If not, see . import logging -from mediagoblin.db.sql.models import User +from mediagoblin.db.models import User _log = logging.getLogger(__name__) diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py index 1e5ea3a3..fd9692f5 100644 --- a/mediagoblin/user_pages/views.py +++ b/mediagoblin/user_pages/views.py @@ -18,7 +18,7 @@ import logging import datetime from mediagoblin import messages, mg_globals -from mediagoblin.db.sql.models import (MediaEntry, Collection, CollectionItem, +from mediagoblin.db.models import (MediaEntry, Collection, CollectionItem, User) from mediagoblin.tools.response import render_to_response, render_404, redirect from mediagoblin.tools.translate import pass_to_ugettext as _ diff --git a/mediagoblin/views.py b/mediagoblin/views.py index 14fbc4e6..6acd7e96 100644 --- a/mediagoblin/views.py +++ b/mediagoblin/views.py @@ -15,7 +15,7 @@ # along with this program. If not, see . from mediagoblin import mg_globals -from mediagoblin.db.sql.models import MediaEntry +from mediagoblin.db.models import MediaEntry from mediagoblin.tools.pagination import Pagination from mediagoblin.tools.response import render_to_response from mediagoblin.decorators import uses_pagination