aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/sql/models.py
Commit message (Collapse)AuthorAgeFilesLines
* Move db.sql.models* to db.models*Sebastian Spaeth2013-01-071-447/+0
|
* Remove SimpleFieldAliasSebastian Spaeth2012-12-211-12/+0
| | | | | | | It was only used for the model._id -> model.id conversion and is not needed anymore. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Move DBModel._id -> DBModel.idSebastian Spaeth2012-12-211-10/+0
| | | | | | | | | | | | | | | | | | | | | | | We were refering to model._id in most of the code base as this is what Mongo uses. However, each use of _id required a) fixup of queries: e.g. what we did in our find() and find_one() functions moving all '_id' to 'id'. It also required using AliasFields to make the ._id attribute available. This all means lots of superfluous fixing and transitioning in a SQL world. It will also not work in the long run. Much newer code already refers to the objects by model.id (e.g. in the oauth plugin), which will break with Mongo. So let's be honest, rip out the _id mongoism and live with .id as the one canonical way to address objects. This commit modifies all users and providers of model._id to use model.id instead. This patch works with or without Mongo removed first, but will break Mongo usage (even more than before) I have not bothered to fixup db.mongo.* and db.sql.convert (which converts from Mongo to SQL) Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Added cascade all, delete-orphan to ProcessingMetaDataJoar Wandborg2012-09-271-5/+7
|
* Added support for http callbacks on processingJoar Wandborg2012-09-261-1/+16
| | | | | Sends an HTTP POST request back to an URL given on submission to the API submit view.
* Added client registration caps to OAuth pluginJoar Wandborg2012-09-211-2/+10
| | | | | | | | | | | | | | | | | | | THE MIGRATIONS SUPPLIED WITH THIS COMMIT WILL DROP AND RE-CREATE YOUR oauth__tokens AND oauth__codes TABLES. ALL YOUR OAUTH CODES AND TOKENS WILL BE LOST. - Fixed pylint issues in db/sql/migrations. - Added __repr__ to the User model. - Added _disable_cors option to json_response. - Added crude error handling to the api.tools.api_auth decorator - Updated the OAuth README. - Added client registration, client overview, connection overview, client authorization views and templates. - Added error handling to the OAuthAuth Auth object. - Added AuthorizationForm, ClientRegistrationForm in oauth/forms. - Added migrations for OAuth, added client registration migration. - Added OAuthClient, OAuthUserClient models. - Added oauth/tools with require_client_auth decorator method.
* Added basic collection functionalityAaron Williamson2012-09-181-2/+58
|
* Fixed a UnicodeError in the sql.models.MediaEntryJoar Wandborg2012-08-031-1/+3
| | | | | The __repr__() call would crash the process when it tried to convert an unicode title to ASCII for terminal/logfile output.
* Panel improvementsJoar Wandborg2012-07-111-0/+8
| | | | | | | | | | - Added progress meter for video and audio media types. - Changed the __repr__ method of a MediaEntry to display a bit more useful explanation. - Added a new MediaEntry.state, 'processing', which means that the task is running the processor on the item currently. - Fixed some PEP8 issues in user_pages/views.py - Fixed the ATOM TAG URI to show the correct year.
* Prevent non-Unicode SQLAlchemy warnings in most submission tests.Brett Smith2012-07-081-2/+2
| | | | This commit makes test_submission mostly warning-clean.
* FIXED SQL MIGRATION #2Joar Wandborg2012-06-101-2/+4
|
* Merge remote-tracking branch ↵Joar Wandborg2012-06-101-0/+1
|\ | | | | | | | | | | | | 'is_derek/bug405_email_notifications_for_comments' into notifications-merge Conflicts: mediagoblin/db/mongo/migrations.py
| * Merge branch 'master' into derek-moore-bug405_email_notifications_for_commentsChristopher Allan Webber2012-03-181-15/+43
| |\ | | | | | | | | | | | | Conflicts: mediagoblin/db/mongo/migrations.py
| * | Added wants_comment_notification to sql modelDerek Moore2012-03-151-0/+1
| | |
* | | New media_data row needs to know its MediaEntry's id.Elrond2012-03-221-1/+2
| | | | | | | | | | | | | | | | | | | | | When creating a new media_data row, the new row needs to know the MediaEntry it is associated with. I have no idea, why this worked before at all. Maybe some implicit tricks by sqlalchemy?
* | | Add index=True for some columns.Elrond2012-03-211-6/+7
| |/ |/| | | | | | | These are the columns that seem to make the most sense to have an index on them.
* | Make mediagoblin SQL models all use a consistent table naming schemeChristopher Allan Webber2012-03-171-11/+11
| |
* | Fix media display for no media_data row in sql.Elrond2012-03-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | If there is no media_data row for the current media (for whatever reason, there might be good ones), let MediaEntry.media_data not raise an exception but just return None. The exif display part now handles this by checking whether .media_data.exif is defined (None has no attribute exif, so it's undefined, all fine).
* | Implemented the MediaEntry .media_data type fields for SQLChristopher Allan Webber2012-03-141-4/+32
|/
* Forgot to add FileKeynames to MODELSElrond2012-03-081-1/+1
|
* Normalize MediaFile.name (make it a foreignkey)Elrond2012-03-081-3/+32
| | | | | | | | | | The name part of a MediaFile is only using a very limited number of items. Currently things like "original" or "thumb". So instead of storing the string on each entry, just store a short integer referencing the FileKeynames table and have the appropiate string there.
* SQL: Added MediaFile and MediaAttachmentFile to MODELSJoar Wandborg2012-03-081-1/+2
|
* And media_data_init() for sql as a dummyElrond2012-03-031-0/+4
| | | | Needs to be implemented.
* Create a fake MediaEntry.media_data for sqlElrond2012-03-031-0/+5
| | | | | | | So that the SQL backend is more useable, let the MediaEntry have a faked media_data. It's extremely fake: The returned dict is always a new one. So any stored info is even lost!
* Attachment support in the SQL backendElrond2012-02-281-1/+26
| | | | | | | | | attachments working with the sql backend. - SQL Schema for attachment files, ordering attachments by their name, not by the submission order (as earlier). - Dot-Notation for attachments, where missing. - convert existing attachments over from mongo -> sql
* Merge branch 'master' into sqlmigrateChristopher Allan Webber2012-02-181-5/+7
|\
| * Fix MediaTag __init__ to handle no argsElrond2012-02-181-3/+5
| | | | | | | | | | Let the init code also handle createing a fresh clean instance without any attrs set.
| * SQL: fail_metadata as JSON encoded fieldElrond2012-02-181-2/+2
| | | | | | | | | | | | | | | | fail_metadata used to be a dict in mongo. So a json encoded field should be okay too. We could use a pickled field instead, which would be more flexible.
* | Merge branch 'master' into sqlmigrateChristopher Allan Webber2012-02-181-11/+36
|\| | | | | | | | | Conflicts: mediagoblin/db/sql/models.py
| * Drop pre-rendered html: MediaComment.content_htmlElrond2012-02-181-3/+2
| | | | | | | | | | | | | | | | | | | | | | After a bit of discussion, we decided to drop the pre-rendered html from the database and render it on the fly. In another step, we will use some proper caching method to cache this stuff. This commit affects the MediaComment.content_html part.
| * Drop pre-rendered html: MediaEntry.description_htmlElrond2012-02-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | After a bit of discussion, we decided to drop the pre-rendered html from the database and render it on the fly. In another step, we will use some proper caching method to cache this stuff. This commit affects the MediaEntry.description_html part.
| * Drop pre-rendered html: User.bio_htmlElrond2012-02-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | After a bit of discussion, we decided to drop the pre-rendered html from the database and render it on the fly. In another step, we will use some proper caching method to cache this stuff. This commit affects the User.bio_html part.
| * sql db design suggestions by Svavar KjarrvalElrond2012-02-111-3/+26
| | | | | | | | | | | | | | | | Many thanks go to Svavar Kjarrval who has taken a deeper look at our current sql db design and made a bunch of suggestions. The suggestions are currently put as TODO items in the docstrings. This way we can keep track of them directly where we need it.
| * Fix copyright statements; add LICENSE for EXIF.pyWill Kahn-Greene2012-02-081-1/+1
| |
| * Some small SQL model improvementsElrond2012-01-291-2/+7
| | | | | | | | | | | | | | | | - Add default for User.email_verified - Add default for MediaEntry.state - Let PathTupleWithSlashes store [] as "NULL", but not handling the reverse properly yet! - Add _id alias field to MediaEntry and MediaComment
* | import changeset into sql modelsChristopher Allan Webber2012-01-291-0/+7
| |
* | Make name the primary key in migration recordsChristopher Allan Webber2012-01-291-2/+1
| |
* | Big ol' start of the SQL migrations system.Christopher Allan Webber2012-01-291-0/+21
|/ | | | Things definitely don't work yet, but should be heading in the right direction.
* Nearly complete support for TagsElrond2012-01-281-4/+36
| | | | | | | | | | | These changes allow all of the rest of the code to use tags in sql as they were used on mongo. It's not efficient at all, as changing tags usually means to remove all old tags and adding all new. The only problem here is: Old slugs for tags are not removed, because they're shared across all MediaTags and dropping orphans is not always easy.
* Let some code support "media without slug"Elrond2012-01-281-1/+1
| | | | | | | | | | | | | | The upcoming SQL database will allow having media without a slug again. This might especially be useful for API support, where the uploaded image (media) does not have *any* information to generate a slug from. This code change mostly allows the sql backend to have no slug in its model and improves some parts to properly handle that. It specifically does not have any web frontend support to edit/create MediaEntries with no slug.
* Move declarative_base Base into base.pyElrond2012-01-261-5/+1
| | | | The base class of all models "Base" should be in base.py.
* Proper url_to_{prev,next} for SQLElrond2012-01-221-0/+21
| | | | Uses complete sqlalchemy syntax now.
* Create a fully functional get_comments for SQLElrond2012-01-221-0/+7
| | | | | Using proper sqlalchemy syntax instead of the emulated mongo one.
* License "all rights reserved" default should be None/NULL, not empty stringChristopher Allan Webber2012-01-211-1/+1
|
* Added migration for license field, resolved conflict in db/sql/models.pyAaron Williamson2012-01-191-5/+22
|\
| * Add copyright header and a bit of pep8ificationElrond2012-01-201-8/+25
| | | | | | | | | | | | Nearly all the sql files missed a copyright header. So added it! And while there fixed a few pep8 things.
* | Moved get_license_data to mixin.py, added license to sql media model, added ↵Aaron Williamson2012-01-181-0/+1
|/ | | | translation tags to license template.
* Add MediaFile table and related infrastructure.Elrond2012-01-111-2/+25
| | | | | | | | | | | | - This adds a new SQL table field type for path tuples. They're stored as '/' separated unicode strings. - Uses it to implement a MediaFile table. - Add relationship and proxy fields on MediaEntry to give a nice media_files "view" there. - Let the converter fill the MediaFile.
* Add DB Mixin classes and use themElrond2012-01-081-2/+3
| | | | | | | | | | | | | | | A bunch of functions on the db objects are really more like "utility functions": They could live outside the classes and be called "by hand" passing the appropiate reference. They usually only use the public API of the object and rarely use database related stuff. Goals: - First, simple: Share the code with the SQL objects, so that the code doesn't need to be duplicated. - Second, it might unclutter the db models and make them more into "model only" stuff. - Doesn't really hurt.
* SQL Model: Add relationship propertiesElrond2011-12-281-0/+5
| | | | | | MediaEntry now has a get_uploader (property) loading the appropiate User object for the MediaEntry (and caches it). MediaComment has the same for author as get_author.