290 Commits

Author SHA1 Message Date
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
Elrond
99c2f9f0c4 New media_data row needs to know its MediaEntry's id.
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?
2012-03-22 21:21:38 +01:00
Elrond
ecd538bb65 Add index=True for some columns.
These are the columns that seem to make the most sense to
have an index on them.
2012-03-21 22:46:38 +01:00
Elrond
e136ad3ed6 Finally load all models.
Load all models for the media_types. This was stopped by a
celery problem. But that is now fixed.
2012-03-21 21:48:09 +01:00
Elrond
b829595334 Create load_models().
So all models are ready when connecting to the db and so
our "db" object has all models listed on it, create a
function to load all models from the media_types, etc. Call
it in setup_database()

Problem: This gives celery warnings, because celery is
imported before being setup properly. No idea how to fix
this now. So media-type loading is excluded from
load_models for now.
2012-03-20 12:45:40 +01:00
Elrond
39fd817ab8 Import "Base" from base instead of models.
Import the "Base" class for models from db.sql.base instead
of db.sql.models.
2012-03-20 12:45:40 +01:00
Elrond
df7c405845 Disable query logging for now, so we get nicer logs
As the queries are quite verbose, disable them for now.
Reenabling them should be done in the central logging
config, which is another story for celery and bin/gmg.
2012-03-20 12:45:40 +01:00
Christopher Allan Webber
94e6052375 Merge branch 'master' into derek-moore-bug405_email_notifications_for_comments
Conflicts:
	mediagoblin/db/mongo/migrations.py
2012-03-18 12:12:41 -05:00
Christopher Allan Webber
54477b4d76 Removing print statements from convert_gps_media_data migration
Kind of useful to see but... I don't think they're needed, and I'm not
super comfortable with print statements being in migrations.  Seems
semi bloated!
2012-03-18 12:07:41 -05:00
Elrond
7bf819a995 Let convert_mongo_to_sql add Migration Records
The mongosql tool is really dumping directly into the sql
database and is trying not to use too much logic that might
change later.

So this means, it needs to create the migration records on
its own!
So add a bunch of records with version=0.
2012-03-17 23:45:29 +01:00
Christopher Allan Webber
2f5ce68c6c Make mediagoblin SQL models all use a consistent table naming scheme 2012-03-17 16:56:23 -05:00