Merge remote branch 'origin/master' into bug261-resized-filenames

This merge involved moving the new FilenameBuilder class to
processing/__init__.py, and putting the comment deletion tests back into
test_submission.py using the refactored functions.
This commit is contained in:
Brett Smith
2012-03-26 14:10:22 -04:00
84 changed files with 2758 additions and 2535 deletions

View File

@@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from mediagoblin.db.sql.models import Base
from mediagoblin.db.sql.base import Base
from sqlalchemy import (
Column, Integer, Unicode, UnicodeText, DateTime, Boolean, ForeignKey,
@@ -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)
# The primary key *and* reference to the main media_entry
media_entry = Column(Integer, ForeignKey('core__media_entries.id'),
primary_key=True)
DATA_MODEL = AsciiData

View File

@@ -34,7 +34,7 @@ def process_ascii(entry):
workbench.dir, 'conversions')
os.mkdir(conversions_subdir)
queued_filepath = entry['queued_media_file']
queued_filepath = entry.queued_media_file
queued_filename = workbench.localized_file(
mgg.queue_store, queued_filepath,
'source')
@@ -101,7 +101,7 @@ def process_ascii(entry):
'xmlcharrefreplace'))
mgg.queue_store.delete_file(queued_filepath)
entry['queued_media_file'] = []
entry.queued_media_file = []
media_files_dict = entry.setdefault('media_files', {})
media_files_dict['thumb'] = thumb_filepath
media_files_dict['unicode'] = unicode_filepath

View File

@@ -1,17 +1,36 @@
from mediagoblin.db.sql.models import Base
# 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/>.
from mediagoblin.db.sql.base import Base
from sqlalchemy import (
Column, Integer, Float, ForeignKey)
from mediagoblin.db.sql.extratypes import JSONEncoded
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)
exif_all = Column(JSONEncoded)
gps_longitude = Column(Float)
gps_latitude = Column(Float)
gps_altitude = Column(Float)

View File

@@ -110,14 +110,10 @@ def process_image(entry):
media_files_dict['medium'] = medium_filepath
# Insert exif data into database
media_data = entry.setdefault('media_data', {})
exif_all = clean_exif(exif_tags)
# TODO: Fix for sql media_data, when exif is in sql
if media_data is not None:
media_data['exif'] = {
'clean': clean_exif(exif_tags)}
media_data['exif']['useful'] = get_useful(
media_data['exif']['clean'])
if len(exif_all):
entry.media_data_init(exif_all=exif_all)
if len(gps_data):
for key in list(gps_data.keys()):

View File

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