diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | mediagoblin/db/sql/models.py | 22 | ||||
-rw-r--r-- | mediagoblin/gmg_commands/migrate.py | 9 | ||||
-rw-r--r-- | mediagoblin/gmg_commands/mongosql.py | 7 | ||||
-rw-r--r-- | mediagoblin/media_types/ascii/models.py | 4 | ||||
-rw-r--r-- | mediagoblin/media_types/image/models.py | 4 | ||||
-rw-r--r-- | mediagoblin/media_types/video/models.py | 4 | ||||
-rw-r--r-- | mediagoblin/static/css/base.css | 13 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/user_pages/media.html | 2 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/utils/exif.html | 2 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/utils/geolocation_map.html | 2 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/utils/license.html | 2 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/utils/tags.html | 2 |
13 files changed, 42 insertions, 32 deletions
@@ -9,6 +9,7 @@ /lib/ /include/ /parts/ +/share/ /mediagoblin.egg-info /docs/_build/ /docs/build diff --git a/mediagoblin/db/sql/models.py b/mediagoblin/db/sql/models.py index a2feeebb..949933bc 100644 --- a/mediagoblin/db/sql/models.py +++ b/mediagoblin/db/sql/models.py @@ -61,7 +61,7 @@ class User(Base, UserMixin): TODO: We should consider moving some rarely used fields into some sort of "shadow" table. """ - __tablename__ = "users" + __tablename__ = "core__users" id = Column(Integer, primary_key=True) username = Column(Unicode, nullable=False, unique=True) @@ -87,10 +87,10 @@ class MediaEntry(Base, MediaEntryMixin): """ TODO: Consider fetching the media_files using join """ - __tablename__ = "media_entries" + __tablename__ = "core__media_entries" id = Column(Integer, primary_key=True) - uploader = Column(Integer, ForeignKey('users.id'), nullable=False) + uploader = Column(Integer, ForeignKey('core__users.id'), nullable=False) title = Column(Unicode, nullable=False) slug = Column(Unicode) created = Column(DateTime, nullable=False, default=datetime.datetime.now) @@ -230,7 +230,7 @@ class MediaFile(Base): TODO: Highly consider moving "name" into a new table. TODO: Consider preloading said table in software """ - __tablename__ = "mediafiles" + __tablename__ = "core__mediafiles" media_entry = Column( Integer, ForeignKey(MediaEntry.id), @@ -269,7 +269,7 @@ class MediaAttachmentFile(Base): class Tag(Base): - __tablename__ = "tags" + __tablename__ = "core__tags" id = Column(Integer, primary_key=True) slug = Column(Unicode, nullable=False, unique=True) @@ -286,13 +286,13 @@ class Tag(Base): class MediaTag(Base): - __tablename__ = "media_tags" + __tablename__ = "core__media_tags" id = Column(Integer, primary_key=True) media_entry = Column( Integer, ForeignKey(MediaEntry.id), nullable=False) - tag = Column(Integer, ForeignKey('tags.id'), nullable=False) + tag = Column(Integer, ForeignKey('core__tags.id'), nullable=False) name = Column(Unicode) # created = Column(DateTime, nullable=False, default=datetime.datetime.now) @@ -319,12 +319,12 @@ class MediaTag(Base): class MediaComment(Base, MediaCommentMixin): - __tablename__ = "media_comments" + __tablename__ = "core__media_comments" id = Column(Integer, primary_key=True) media_entry = Column( - Integer, ForeignKey('media_entries.id'), nullable=False) - author = Column(Integer, ForeignKey('users.id'), nullable=False) + Integer, ForeignKey('core__media_entries.id'), nullable=False) + author = Column(Integer, ForeignKey('core__users.id'), nullable=False) created = Column(DateTime, nullable=False, default=datetime.datetime.now) content = Column(UnicodeText, nullable=False) @@ -346,7 +346,7 @@ MODELS = [ ###################################################### class MigrationData(Base): - __tablename__ = "migrations" + __tablename__ = "core__migrations" name = Column(Unicode, primary_key=True) version = Column(Integer, nullable=False, default=0) diff --git a/mediagoblin/gmg_commands/migrate.py b/mediagoblin/gmg_commands/migrate.py index cacf5d19..af541786 100644 --- a/mediagoblin/gmg_commands/migrate.py +++ b/mediagoblin/gmg_commands/migrate.py @@ -17,7 +17,7 @@ import sys from mediagoblin.db.mongo import util as db_util -from mediagoblin.db.open import setup_connection_and_db_from_config +from mediagoblin.db.mongo.open import setup_connection_and_db_from_config from mediagoblin.init import setup_global_and_app_config # This MUST be imported so as to set up the appropriate migrations! @@ -41,7 +41,12 @@ def _print_finished_migration(migration_number, migration_func): def migrate(args): - global_config, app_config = setup_global_and_app_config(args.conf_file) + run_migrate(args.conf_file) + + +def run_migrate(conf_file): + global_config, app_config = setup_global_and_app_config(conf_file) + connection, db = setup_connection_and_db_from_config( app_config, use_pymongo=True) migration_manager = db_util.MigrationManager(db) diff --git a/mediagoblin/gmg_commands/mongosql.py b/mediagoblin/gmg_commands/mongosql.py index a25263e2..dd53f575 100644 --- a/mediagoblin/gmg_commands/mongosql.py +++ b/mediagoblin/gmg_commands/mongosql.py @@ -14,12 +14,15 @@ # 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/>. -from mediagoblin.db.sql.convert import run_conversion - def mongosql_parser_setup(subparser): pass def mongosql(args): + # First, make sure our mongo migrations are up to date... + from mediagoblin.gmg_commands.migrate import run_migrate + run_migrate(args.conf_file) + + from mediagoblin.db.sql.convert import run_conversion run_conversion(args.conf_file) diff --git a/mediagoblin/media_types/ascii/models.py b/mediagoblin/media_types/ascii/models.py index 324794b9..03907339 100644 --- a/mediagoblin/media_types/ascii/models.py +++ b/mediagoblin/media_types/ascii/models.py @@ -23,11 +23,11 @@ from sqlalchemy import ( class AsciiData(Base): - __tablename__ = "ascii_data" + __tablename__ = "ascii__mediadata" id = Column(Integer, primary_key=True) media_entry = Column( - Integer, ForeignKey('media_entries.id'), nullable=False) + Integer, ForeignKey('core__media_entries.id'), nullable=False) DATA_MODEL = AsciiData diff --git a/mediagoblin/media_types/image/models.py b/mediagoblin/media_types/image/models.py index 88ccc84e..f333cbb8 100644 --- a/mediagoblin/media_types/image/models.py +++ b/mediagoblin/media_types/image/models.py @@ -5,10 +5,10 @@ from sqlalchemy import ( class ImageData(Base): - __tablename__ = "image_data" + __tablename__ = "image__mediadata" # The primary key *and* reference to the main media_entry - media_entry = Column(Integer, ForeignKey('media_entries.id'), + media_entry = Column(Integer, ForeignKey('core__media_entries.id'), primary_key=True) width = Column(Integer) height = Column(Integer) diff --git a/mediagoblin/media_types/video/models.py b/mediagoblin/media_types/video/models.py index 709d7910..0d064f5f 100644 --- a/mediagoblin/media_types/video/models.py +++ b/mediagoblin/media_types/video/models.py @@ -22,10 +22,10 @@ from sqlalchemy import ( class VideoData(Base): - __tablename__ = "video_data" + __tablename__ = "video__mediadata" # The primary key *and* reference to the main media_entry - media_entry = Column(Integer, ForeignKey('media_entries.id'), + media_entry = Column(Integer, ForeignKey('core__media_entries.id'), primary_key=True) width = Column(SmallInteger) height = Column(SmallInteger) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 94d7aa63..0a0d0dcd 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -234,13 +234,14 @@ text-align: center; height: 0; } -h3.sidedata { - border: none; - background-color: #212121; - border-radius: 4px 4px 0 0; - padding: 3px 8px; - margin: 20px 0 5px 0; +.media_sidebar h3 { font-size: 1em; + margin: 0 0 5px; + border: none; +} + +.media_sidebar p { + padding-left: 8px; } /* forms */ diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index f4d7220e..70a367f9 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -172,7 +172,7 @@ </div> <div class="media_sidebar"> {% trans date=media.created.strftime("%Y-%m-%d") -%} - <h3 class="sidedata">Added on</h3> + <h3>Added on</h3> <p>{{ date }}</p> {%- endtrans %} {% if media.tags %} diff --git a/mediagoblin/templates/mediagoblin/utils/exif.html b/mediagoblin/templates/mediagoblin/utils/exif.html index 3c1f4ceb..37f274fe 100644 --- a/mediagoblin/templates/mediagoblin/utils/exif.html +++ b/mediagoblin/templates/mediagoblin/utils/exif.html @@ -20,7 +20,7 @@ {% if app_config['exif_visible'] and media.media_data.exif is defined and media.media_data.exif.has_key('useful') %} - <h3 class="sidedata">EXIF</h3> + <h3>EXIF</h3> <table> {% for key, tag in media.media_data.exif.useful.items() %} <tr> diff --git a/mediagoblin/templates/mediagoblin/utils/geolocation_map.html b/mediagoblin/templates/mediagoblin/utils/geolocation_map.html index e8baa247..cd57d1f8 100644 --- a/mediagoblin/templates/mediagoblin/utils/geolocation_map.html +++ b/mediagoblin/templates/mediagoblin/utils/geolocation_map.html @@ -22,7 +22,7 @@ and media.media_data.gps_latitude and media.media_data.gps_longitude is defined and media.media_data.gps_longitude %} - <h3 class="sidedata">{% trans %}Location{% endtrans %}</h3> + <h3>{% trans %}Location{% endtrans %}</h3> <div> {%- set lon = media.media_data.gps_longitude %} {%- set lat = media.media_data.gps_latitude %} diff --git a/mediagoblin/templates/mediagoblin/utils/license.html b/mediagoblin/templates/mediagoblin/utils/license.html index ab157508..9dad7419 100644 --- a/mediagoblin/templates/mediagoblin/utils/license.html +++ b/mediagoblin/templates/mediagoblin/utils/license.html @@ -17,7 +17,7 @@ #} {% block license_content -%} - <h3 class="sidedata">{% trans %}License{% endtrans %}</h3> + <h3>{% trans %}License{% endtrans %}</h3> <p> {% if media.license %} <a href="{{ media.license }}">{{ media.get_license_data().abbreviation }}</a> diff --git a/mediagoblin/templates/mediagoblin/utils/tags.html b/mediagoblin/templates/mediagoblin/utils/tags.html index eb31aba0..0127035c 100644 --- a/mediagoblin/templates/mediagoblin/utils/tags.html +++ b/mediagoblin/templates/mediagoblin/utils/tags.html @@ -17,7 +17,7 @@ #} {% block tags_content -%} - <h3 class="sidedata">{% trans %}Tagged with{% endtrans %}</h3> + <h3>{% trans %}Tagged with{% endtrans %}</h3> <p> {% for tag in media.tags %} {% if loop.last %} |