600 Commits

Author SHA1 Message Date
Elrond
efb70b529f Merge some small bits by spaetz. Needed later.
* commit '9437ea4742':
  Add commit argument to clean_orphan_tags
  Add "commit" argument to Base model delete()
2012-11-28 16:45:15 +01:00
Sebastian Spaeth
9437ea4742 Add commit argument to clean_orphan_tags
So we can prevent the session from being committed if we don't want it.
2012-11-28 14:43:04 +01:00
Elrond
329e39034b Add "commit" argument to Base model delete()
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>
2012-11-28 13:52:41 +01:00
Christopher Allan Webber
fbfcf1a57a Merge remote-tracking branch 'refs/remotes/elrond/sql/migrate_new_tables' 2012-11-26 15:15:13 -06:00
Elrond
9abd664bf2 Stop unicode conversion warning during dbupdate.
Just force the passed in name to MigrationManager() to unicode.
2012-11-24 22:57:46 +01:00
Elrond
316e1dfdde SQL Migrations: Rewrite table creation completely.
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.
2012-11-24 19:23:08 +01:00
Sebastian Spaeth
2e4ad35962 Simplify/Robustify the thumbnail URL usage in templates
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>
2012-11-15 12:01:31 +01:00
Joar Wandborg
942084fbfd Added cascade all, delete-orphan to ProcessingMetaData 2012-09-27 11:59:17 +02:00
Joar Wandborg
939d57a022 HTTP callback fixes
- 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.
2012-09-26 23:53:51 +02:00
Joar Wandborg
5354f954dc Added support for http callbacks on processing
Sends an HTTP POST request back to an URL given on submission to the API
submit view.
2012-09-26 23:53:51 +02:00
Joar Wandborg
88a9662be4 Added client registration caps to OAuth plugin
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.
2012-09-21 13:09:42 +02:00
Joar Wandborg
6d1e55b262 Style fixes 2012-09-18 18:19:26 +02:00
Aaron Williamson
256f816f50 Fixed collection sidebar for media_home to user collection.url_for_self instead of incorrectly getting the session user 2012-09-18 18:10:36 +02:00
Aaron Williamson
d8984df83f Added default for 'collected' column to migration 2012-09-18 18:10:36 +02:00
Aaron Williamson
8926c94978 Fixed migrations for Collection and CollectionItem tables 2012-09-18 18:10:36 +02:00
Aaron Williamson
29fdd3bb7c Added migrations for Collection and CollectionItem tables 2012-09-18 18:10:36 +02:00
Aaron Williamson
59fb87c944 Fixed collections migration to add 'collected' column to media_entries instead of 'collections' 2012-09-18 18:10:36 +02:00
Aaron Williamson
be5be1154f Added basic collection functionality 2012-09-18 18:10:36 +02:00
Joar Wandborg
30520c92cc Fixed tests
- Adapt tests to new global_config arg for run_dbupdate
- Account for [plugins] not being set in config
2012-09-15 17:54:34 +02:00
Joar Wandborg
f46e2a4db9 Add OAuth models, plugin DB migrations, api_auth 2012-09-13 20:38:59 +02:00
Joar Wandborg
79f28e0b93 Fixed a UnicodeError in the sql.models.MediaEntry
The __repr__() call would crash the process when it tried to convert an
unicode title to ASCII for terminal/logfile output.
2012-08-03 16:02:18 +02:00
Christopher Allan Webber
35a24fc263 Moving the "dependency injection printer tools" over to tools/common.py 2012-07-14 12:55:14 -05:00
Joar Wandborg
6471291575 Panel improvements
- 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.
2012-07-11 00:36:42 +02:00
Joar Wandborg
51eb0267d9 Minor improvements to the processing panel
- 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.
2012-07-10 18:13:02 +02:00
Brett Smith
5bd0adebd0 Prevent non-Unicode SQLAlchemy warnings in most submission tests.
This commit  makes test_submission mostly warning-clean.
2012-07-08 10:04:06 -04:00
Elrond
b105540141 First migration fix: commit after each migration.
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.
2012-06-14 21:57:24 +02:00
Joar Wandborg
c4869eff40 FIXED SQL MIGRATION #2 2012-06-10 18:31:49 +02:00
Joar Wandborg
38c6d44123 Added SQL migrations for email notifications 2012-06-10 18:26:21 +02:00
Joar Wandborg
879ff4bde6 Merge remote-tracking branch 'is_derek/bug405_email_notifications_for_comments' into notifications-merge
Conflicts:
	mediagoblin/db/mongo/migrations.py
2012-06-10 15:53:46 +02:00
Jakob Kramer
b781c3c928 added support for original audio download; rename
Renamed `ogg' to `webm_audio' in core__file_keynames
2012-05-20 18:32:56 +02:00
Elrond
e824570a23 Cleanup sql session after request. ALWAYS!
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.
2012-04-07 23:21:59 +02:00
Elrond
797f4437eb Check that the media_data tables are empty.
In the analyzing part also check that the media_data tables
are empty (as expected) before dropping them.
2012-04-02 14:02:56 +02:00
Elrond
f9d62eccf4 Add ascii and audio tables/migration data.
Well, and if it's not needed, drop it again. ;)
2012-04-02 13:51:53 +02:00
Elrond
df1c94f52d Cleanup unused media_data tables and migration info.
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.
2012-04-02 13:51:52 +02:00
Elrond
e85a953951 Mongo -> SQL conversion tool: UI improvements
Output some headers while converting things.
And indent some info.
Also some DRY things.
2012-04-02 13:51:52 +02:00
Joar Wandborg
f69223e973 Fixed an issue where orphaned comments breaks the import 2012-04-02 13:44:28 +02:00
Christopher Allan Webber
e089b66bde Merge remote-tracking branch 'refs/remotes/elrond/sql/final'
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
%
             __________
          .-'          '-.
        .'                '.
      .'  _--_        _--_  '.
     /   /  (_).     /  (_).  \
    .   |      |    |      |   .
    |    ._____,     ._____,   |
    |   ____________________   |
    |    |                 |   |
    '    \                 /   '
     \    '.        .----./   /
      \     '._    /     /   /
       '.      '--------'  .'
         '._            _.'
            '----------'
2012-04-01 15:36:11 -05:00
Elrond
ce29c140ed Finally enable SQL for everybody!
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!
2012-04-01 21:46:36 +02:00
Elrond
1e3a0e0ca0 Switch JSONEncoded from VARCHAR to TEXT
The JSON fields are really "dumb stuff in here" fields.
They are not intended to get indexed or anything. And they
can get large. For example the exif_all field in one of my
simple tests is nearly 7 kB large. Although VARCHAR might
work, TEXT feels just better as the storage type.
2012-04-01 19:58:23 +02:00
Elrond
73758391f3 And remove some now useless methods. 2012-03-29 23:23:57 +02:00
Elrond
dda67f7152 Remove the DictReadProxy thing.
And some other stuff, that the converter does not need.
2012-03-29 23:23:57 +02:00
Elrond
19535af4e5 Fix some simple errors. 2012-03-29 23:23:57 +02:00
Elrond
c0fddc63e8 Change models to a _v0 suffix.
And add the image and video media_data tables.
And start to rewrite the convert tool.
2012-03-29 23:23:57 +02:00
Elrond
7f5ae1c315 Make a copy of models for v0. 2012-03-29 23:23:57 +02:00
Elrond
5101f84404 Drop debug from migration. 2012-03-25 15:01:24 +02:00
Elrond
e63656fcf7 Cleanup mongo->sql converter.
1. No need to drop media_data['exif'], we only have and
   want media_data['exif_all'].

2. Use media['_id'] instead of media._id (better not use
   dot-notation on mongo objects in such a low level tool).
2012-03-25 14:42:03 +02:00
Elrond
11d36843b0 Migration fixup: Drop empty exif_all.
If the exif info is totally empty, do not add it at all to
the media_data dict in mongo.
2012-03-25 14:42:03 +02:00
Elrond
c8c75ad044 Create migration to move exif data around in media_data.
Move media_data['exif']['clean'] to media_data['exif_all']
drop media_data['exif']['useful']
drop media_data['exif']
2012-03-25 14:42:03 +02:00
Elrond
7b82f56bae Fix cyclic import issue.
Oh well:

tools.exif -> processing -> db.util -> db.models -> db.mixin -> tools.exif

So import tools.exif locally in exif_display_iter()
2012-03-23 20:28:11 +01:00
Elrond
5bad26bc47 Create MediaEntry.exif_display_iter()
MediaEntry.media_data.exif_all will contain all the
"clean" EXIF data.

MediaEntry.exif_display_iter() is an iterator that fetches
the most interesting entries for display from that data.
2012-03-23 20:20:54 +01:00