aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db
Commit message (Collapse)AuthorAgeFilesLines
...
* UniqueConstraing migration: Adding the explaining comments.Elrond2012-12-101-0/+23
| | | | Add a lengthy comment explaining all the variants.
* Fixing our broken CollectionItem unique constraint.Elrond2012-12-101-4/+42
| | | | | This one seems to work nicely in all relevant situations. See comments inside the source.
* Ensure query_dict is a dict after the contents have been modified.Nathan Yergler2012-12-101-2/+8
| | | | | | _fix_query_dict modifies its argument in place. Ensure that the argument passed in has a local name and will be passed into the subsequent filter_by call.
* Eeek! Set the migration number to the current migration number being run!Christopher Allan Webber2012-12-091-1/+1
|
* Elrond's suggestion: have set_current_migration execute after each migration ↵Christopher Allan Webber2012-12-091-1/+1
| | | | run.
* make media_manager a property of MediaEntry in mixin.pySebastian Spaeth2012-12-041-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | In all cases where get_media_manager(_media_type_as_string) was called in our code base we ultimately passed in a "MediaEntry().media_type" to get the matching MEDIA_MANAGER. It so makes sense to make this a function of the MediaEntry rather than a global function in mediagoblin.media_types and passing around media_entry.media_type as arguments all the time. It saves a few import statements and arguments. I also made it so the Media_manager property is cached for subsequent calls, although I am not too sure that this is needed (there are other cases for which this would make more sense) Also add a get_media_manager test to the media submission tests. It submits an image and checks that both media.media_type and media.media_manager return the right thing. Not sure if these tests could not be merged with an existing submission test, but it can't hurt to have things explicit. TODO: Right now we iterate through all existing media_managers to find the right one based on the string of its module name. This should be made a simple dict lookup to avoid all the extra work. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Implement licenses.get_license_by_urlSebastian Spaeth2012-11-301-1/+1
| | | | | | | | | Rather than exploding in the user's face (for example if we custom-configure licenses in our MG instance, and there are still media with now "unknown" licenses in the db), simply return a License object as a fallback, where all attributes are set to the URL we were handed. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Use mediagoblin import machinerySebastian Spaeth2012-11-301-4/+5
| | | | | | | | | | | Rather than manually __importing__ the MEDIA_MANAGER, we should have been using tools.common.import_component in the first place. But even better to use the existing get_media_manager() function that exists for exactly our purpose. Also improve documentation of what happens in case of failure. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Remove importlib (python2.7'ism)Sebastian Spaeth2012-11-301-3/+1
| | | | | | | | importlib is cool, but only included in python2.7 which is beyond our minimum python version that we support. So simply use plain old __import__. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Merge some small bits by spaetz. Needed later.Elrond2012-11-282-6/+8
|\ | | | | | | | | | | * commit '9437ea4742': Add commit argument to clean_orphan_tags Add "commit" argument to Base model delete()
| * Add commit argument to clean_orphan_tagsSebastian Spaeth2012-11-281-4/+4
| | | | | | | | So we can prevent the session from being committed if we don't want it.
| * Add "commit" argument to Base model delete()Elrond2012-11-281-2/+4
| | | | | | | | | | | | | | | | | | In case we want to bundle db actions into a single transaction, we can now use delete(commit=False) to prevent the transaction from being committed immediately. This is useful when e.g. deleting a User() and thousands of his MediaEntries in a single commit. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* | Merge remote-tracking branch 'refs/remotes/elrond/sql/migrate_new_tables'Christopher Allan Webber2012-11-261-33/+45
|\ \ | |/ |/|
| * SQL Migrations: Rewrite table creation completely.Elrond2012-11-241-33/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | We have migrations creating new tables. Those currently use "raw" table definitions. This easily gives errors (we already had this problem). So instead rewrite those to use declarative tables and use those to create new tables. Just copy the new table over to the migration, strip it down to the bare minimum, rename to _v0, base it on declarative_base() and be done! Do this for the current migrations.
* | Stop unicode conversion warning during dbupdate.Elrond2012-11-241-1/+1
|/ | | | Just force the passed in name to MigrationManager() to unicode.
* Simplify/Robustify the thumbnail URL usage in templatesSebastian Spaeth2012-11-151-0/+19
| | | | | | | | | | | | | | | | | | | | | | So far templates required a very complex blurb to simply insert a thumbnail URL, exposing much of the internal logic to the template designer. In addition, we would fail with an error if for some reason the media_files['thumb'] entry was never populated. This adds the MediaEntry.thumb_url property that template designers can simply use. It will do the right thing, either fetching the proper thumbnail or hand back a generic icon specified in a media's MEDIA_MANAGER as "default_thumb". Add an image default fallback icon (stolen from Tangos, which are Public Domain since version 0.8.90 as I understand) since the one we referred to was not existing. Perhaps, a "broken image" icon would be better, but I'll leave that to our capable designers. All templates have been modified to make use of the new thumb_url function. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Added cascade all, delete-orphan to ProcessingMetaDataJoar Wandborg2012-09-271-5/+7
|
* HTTP callback fixesJoar Wandborg2012-09-261-1/+9
| | | | | | | | | | | - Added HTTPError catching around the callback request, to not mark the entry as failed, just log the exception. - Fixed bug where I forgot to actually fetch the entry before passing it to json_processing_callback. - Changed __main__ migration #6 to create the ProcessingMetaData table as it is currently, to prevent possible breakage if a siteadmin is lagging behind with his db migrations and more than one migration wants to fix stuff with the ProcessingMetaData table.
* Added support for http callbacks on processingJoar Wandborg2012-09-262-2/+24
| | | | | 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-212-7/+13
| | | | | | | | | | | | | | | | | | | 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.
* Style fixesJoar Wandborg2012-09-181-0/+1
|
* Fixed collection sidebar for media_home to user collection.url_for_self ↵Aaron Williamson2012-09-181-1/+1
| | | | instead of incorrectly getting the session user
* Added default for 'collected' column to migrationAaron Williamson2012-09-181-1/+1
|
* Fixed migrations for Collection and CollectionItem tablesAaron Williamson2012-09-181-2/+5
|
* Added migrations for Collection and CollectionItem tablesAaron Williamson2012-09-181-1/+30
|
* Fixed collections migration to add 'collected' column to media_entries ↵Aaron Williamson2012-09-181-2/+2
| | | | instead of 'collections'
* Added basic collection functionalityAaron Williamson2012-09-185-5/+135
|
* Fixed testsJoar Wandborg2012-09-151-1/+1
| | | | | - Adapt tests to new global_config arg for run_dbupdate - Account for [plugins] not being set in config
* Add OAuth models, plugin DB migrations, api_authJoar Wandborg2012-09-131-4/+13
|
* 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.
* Moving the "dependency injection printer tools" over to tools/common.pyChristopher Allan Webber2012-07-141-8/+2
|
* Panel improvementsJoar Wandborg2012-07-112-1/+21
| | | | | | | | | | - 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.
* Minor improvements to the processing panelJoar Wandborg2012-07-101-2/+2
| | | | | | - It is now possible to actually see what's processing, due to a bug fix where __getitem__ was called on the db model. - Removed DEPRECATED message from the docstring, it wasn't true.
* Prevent non-Unicode SQLAlchemy warnings in most submission tests.Brett Smith2012-07-082-3/+3
| | | | This commit makes test_submission mostly warning-clean.
* First migration fix: commit after each migration.Elrond2012-06-141-0/+2
| | | | | | | | | | | | sqlite doesn't like complex changes (alter table) to happen inside a transaction that has already done other things. And really, each migration should say "I'm done" and commit its changes. This is not the full story, but it's the core of it. Specifially the migration framework should probably do a rollback "just in case" after each migration.
* FIXED SQL MIGRATION #2Joar Wandborg2012-06-102-3/+5
|
* Added SQL migrations for email notificationsJoar Wandborg2012-06-101-2/+14
|
* Merge remote-tracking branch ↵Joar Wandborg2012-06-103-0/+13
|\ | | | | | | | | | | | | '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-186-18/+133
| |\ | | | | | | | | | | | | Conflicts: mediagoblin/db/mongo/migrations.py
| * | Added wants_comment_notification to sql modelDerek Moore2012-03-151-0/+1
| | |
| * | These are changes for issue #405, add email comment notification.Derek Moore2012-03-152-0/+11
| | |
* | | added support for original audio download; renameJakob Kramer2012-05-201-1/+19
| | | | | | | | | | | | Renamed `ogg' to `webm_audio' in core__file_keynames
* | | Cleanup sql session after request. ALWAYS!Elrond2012-04-071-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The cleanup could be missed if the request handling code in app.py:__call__ exits early (due to exception, or due to one of those early "return"s). So to make sure the sql session is cleaned up for real, wrap the whole thing in a try: finally:. Also wrote a short tool to test if the session is actually empty. The tool is currently disabled, but ready to be used.
* | | Check that the media_data tables are empty.Elrond2012-04-021-1/+8
| | | | | | | | | | | | | | | In the analyzing part also check that the media_data tables are empty (as expected) before dropping them.
* | | Add ascii and audio tables/migration data.Elrond2012-04-022-1/+23
| | | | | | | | | | | | Well, and if it's not needed, drop it again. ;)
* | | Cleanup unused media_data tables and migration info.Elrond2012-04-021-6/+34
| | | | | | | | | | | | | | | | | | After converting everything, check what is actually used in the db. For media_types that are not used, drop all the media_data tables and remove the migration info.
* | | Mongo -> SQL conversion tool: UI improvementsElrond2012-04-021-16/+28
| | | | | | | | | | | | | | | | | | Output some headers while converting things. And indent some info. Also some DRY things.
* | | Fixed an issue where orphaned comments breaks the importJoar Wandborg2012-04-021-5/+11
| | |
* | | Merge remote-tracking branch 'refs/remotes/elrond/sql/final'Christopher Allan Webber2012-04-011-0/+1
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mediagoblin/tests/test_submission.py Also, WHOO SQL SWITCHOVER PARTY! ASCII DANCE PARTY /_o_/ \ / \o_ o ( _|_ ) //) /\ / o \ /| /| *BMCH BMCH BMCH BMCH* % /_o_/ HHHYAAaaaaa /_ / / % AAAAAHAHAHAHAHHHAAHA ,, .------ o_o ;; /\\ \ $ __ '\/ || // \\ # /_/ \// // //\\ \ ) \\ \ % \\ \\_____\ | ) //------- /_/_ // // SWITCH YOUR DATABASE FLIP A FUKKEN BOOLEAN % __________ .-' '-. .' '. .' _--_ _--_ '. / / (_). / (_). \ . | | | | . | ._____, ._____, | | ____________________ | | | | | ' \ / ' \ '. .----./ / \ '._ / / / '. '--------' .' '._ _.' '----------'
| * | | Finally enable SQL for everybody!Elrond2012-04-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This switches the whole source code over to use sql instead of mongodb. It's a pretty easy change, but changes nearly the complete way things work. Hopefully everythong works!