From 5354f954dc94aafd35bc037faad2412f73320d8c Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Mon, 24 Sep 2012 23:47:32 +0200 Subject: Added support for http callbacks on processing Sends an HTTP POST request back to an URL given on submission to the API submit view. --- mediagoblin/db/sql/migrations.py | 9 ++++++++- mediagoblin/db/sql/models.py | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'mediagoblin/db/sql') diff --git a/mediagoblin/db/sql/migrations.py b/mediagoblin/db/sql/migrations.py index e86109e9..416c076b 100644 --- a/mediagoblin/db/sql/migrations.py +++ b/mediagoblin/db/sql/migrations.py @@ -20,7 +20,8 @@ from sqlalchemy import (MetaData, Table, Column, Boolean, SmallInteger, Integer, Unicode, UnicodeText, DateTime, ForeignKey) from mediagoblin.db.sql.util import RegisterMigration -from mediagoblin.db.sql.models import MediaEntry, Collection, User +from mediagoblin.db.sql.models import MediaEntry, Collection, User, \ + ProcessingMetaData MIGRATIONS = {} @@ -101,3 +102,9 @@ def add_mediaentry_collected(db_conn): col = Column('collected', Integer, default=0) col.create(media_entry) db_conn.commit() + + +@RegisterMigration(6, MIGRATIONS) +def create_processing_metadata_table(db): + ProcessingMetaData.__table__.create(db.bind) + db.commit() diff --git a/mediagoblin/db/sql/models.py b/mediagoblin/db/sql/models.py index ccf03f32..01694725 100644 --- a/mediagoblin/db/sql/models.py +++ b/mediagoblin/db/sql/models.py @@ -412,9 +412,24 @@ class CollectionItem(Base, CollectionItemMixin): return DictReadAttrProxy(self) +class ProcessingMetaData(Base): + __tablename__ = 'core__processing_metadata' + + id = Column(Integer, primary_key=True) + media_entry_id = Column(Integer, ForeignKey(MediaEntry.id), nullable=False, + index=True) + media_entry = relationship(MediaEntry, backref='processing_metadata') + callback_url = Column(Unicode) + + @property + def dict_view(self): + """A dict like view on this object""" + return DictReadAttrProxy(self) + + MODELS = [ User, MediaEntry, Tag, MediaTag, MediaComment, Collection, CollectionItem, MediaFile, FileKeynames, - MediaAttachmentFile] + MediaAttachmentFile, ProcessingMetaData] ###################################################### -- cgit v1.2.3