94 Commits

Author SHA1 Message Date
xray7224
d41c6a5349 Adds oauth support up until authorization 2013-07-11 18:21:43 +01:00
xray7224
c33a34d459 Client registration now supports application/x-www-form-urlencoded now 2013-07-11 18:21:43 +01:00
xray7224
4990b47ce4 Working client registration 2013-07-11 18:21:43 +01:00
Rodney Ewing
af4414a85f Merge remote-tracking branch 'upstream/master' into auth
Conflicts:
	mediagoblin/app.py
	mediagoblin/auth/forms.py
	mediagoblin/auth/tools.py
	mediagoblin/db/migrations.py
	mediagoblin/db/models.py
	mediagoblin/edit/views.py
	mediagoblin/plugins/basic_auth/tools.py
	mediagoblin/tests/test_edit.py
2013-06-25 13:37:21 -07:00
Christopher Allan Webber
257b8ab62a Merge remote-tracking branch 'refs/remotes/joar/notifications'
Conflicts:
	mediagoblin/db/migrations.py
2013-06-22 16:13:41 -05:00
Joar Wandborg
2d7b6bdef9 New notifications
- Added request.notifications
- Email configuration fixes
  - Set config_spec default SMTP port to `0` and switch to SSL/non-SSL
    default if `port == 0`
  - Added email_smtp_use_ssl configuration setting
- Added migrations for notification tables
- Added __repr__ to MediaComment(Mixin)
- Added MediaComment.get_entry => MediaEntry
- Added CommentSubscription, CommentNotification, Notification,
  ProcessingNotification tables
- Added notifications.task to celery init
- Fixed a bug in the video transcoder where pygst would hijack the
  --help argument.
- Added notifications
  - views
    - silence
    - subscribe
  - routes
  - utility methods
  - celery task
- Added half-hearted .active comment CSS style
- Added quick JS to show header_dropdown
- Added fragment template to show notifications in header_dropdown
- Added fragment template to show subscribe/unsubscribe buttons on
  media/comment pages
- Updated celery setup tests with notifications.task
- Tried to fix test_misc tests that I broke
- Added notification tests
- Added and extended tests.tools fixtures
- Integrated new notifications into media_home, media_post_comment views
- Bumped SQLAlchemy dependency to >= 0.8.0 since we need polymorphic for
  the notifications to work
2013-06-09 21:18:37 +02:00
Rodney Ewing
342f06f7bd modified verification emails to use itsdangerous tokens 2013-05-29 13:23:26 -07:00
Rodney Ewing
b56b6b1e77 changed User model pw_hash field to nullable and added migrations 2013-05-24 16:52:48 -07:00
Christopher Allan Webber
fbe8edc21c Noting why we don't have an email uniqueness constraint in the db.
This commit sponsored by Guido Günther.  Thanks!
2013-05-17 14:10:29 -05:00
Rodney Ewing
34d8bc9820 Check for duplicate collection slugs and make them unique. Add unique constraint to collection.slug model 2013-04-24 14:31:51 -07:00
Elrond
b98882e16e Use cascade for comment deletion.
Also use the relationship for getting the comments on a
MediaEntry.
2013-04-08 17:03:26 +02:00
Elrond
df5b142ab9 Fix deleting media with attachments.
If one deletes a media with attachments, there have been
various problems:
1) If the file in the storage did not exist any more (maybe
   because due to a previous deletion attempt?), the error
   propagation failed, because the wrong thing was
   gathered.
2) The attachment database entries were not deleted.
   Using cascade for this, for now.

Also add a simple unit test, that tests both by having a
broken attachment on a media.
2013-02-18 14:55:42 +01:00
Elrond
485404a9c4 Drop backward compatibility for media_data backref.
Now we only support media_type backrefs with uselist=False.
2013-02-01 22:02:35 +01:00
Elrond
139c6c099f Drop media_data_table property.
Only when creating a new media_data row, we need the table.
So load that locally in media_data_init().
2013-02-01 22:02:35 +01:00
Elrond
57f8d263e1 Rewrite media_data handling to use relationships
Instead of doing query by hand, use the relationships on
the models to find the media_data. Is is made possible by
the BACKREF_NAME in each models.py, which lets us know the
local attr to ask for.

Also initialize the relationship attribute on new
media_data instead of the media_id. Also do not add it to
the session. This gives us:
- This automatically initializes the other side of the
  relationship, which will allow later acces via that way.
- If the media_data is too early in the session, when the
  (new) media_entry is not yet in there, this could get
  conflicts. Avoid those by not adding to session.
- Uses cascading to commit media_data together with the
  media_entry.
2013-02-01 22:02:35 +01:00
Elrond
ff68ca9fc2 Fix issue 611: Proper (back)relationship on MediaComment.
well, fix the relationship on the comments.
2013-01-29 21:23:21 +01:00
Elrond
6194344bf9 Use better relationships to delete collections.
When deleting a User, his/her collections can be deleted by
sqlalchemy: Collections do not need any special code to be
executed on deletion.
2013-01-23 17:36:03 +01:00
Mark Holmquist
dc4dfbde35 Add a license preference field
This feature is absolutely necessary. Now a user can simply define
their default license and quickly go through a form, as opposed to
stopping to click on the select and choosing the same option over
and over again.

Also added DB migration for the field, so that's working now, too.

Rebased by Sebastian and made the default value to be unicode.

Reviewed-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2013-01-17 21:34:04 +01:00
Sebastian Spaeth
3809a8b8e2 import db.sql.util -> db.util
Merging an old branch, I reintroduced an import of db.sql.util rather than
db.util. Fixing the glitch.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2013-01-17 12:19:33 +01:00
Sebastian Spaeth
03b4fc500c Implement User.delete() (#540)
Set User.collections to her Collections using the backref feature.
This way we can iterate a user's collections and delete them all.

Delete all MediaEntries/Files/attachments/comments/collections etc
before finally deleting the User object. This is the backend work for
issue 302 (allow a user to delete ones own account)
2013-01-17 11:48:49 +01:00
Sebastian Spaeth
242776e363 Implement Collection.delete()
Deleting a Collection should automatically delete all containing items.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2013-01-17 11:48:49 +01:00
Sebastian Spaeth
fdc34b8ba7 Implement MediaEntry().delete() (#540)
Deleting a MediaEntry instance will automatically
delete all related comments and files/attachments. This moves
implementation logic out of views.py and allows to make use of this
functionality when e.g. deleting a User() account.

Whenever a MediaEntry entry is deleted, this will also sql-delete
the corresponding MediaFile entry.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2013-01-17 11:48:07 +01:00
Sebastian Spaeth
39dc3bf8db Mv db.sql.base to db.base
This concludes the db.sql.* -> db.* move. Our db abstraction layer is
sqlalchemy, so there is no need to a separate db.sql.* hierarchy.

All tests have been run for each of the commit series to make sure
everything works at every step.
2013-01-07 13:42:32 +01:00
Sebastian Spaeth
a5acfe23fa Move mediagoblin.db.sql.extratypes to mediagoblin.db.extratypes
No other functional changes.
2013-01-07 13:10:02 +01:00
Sebastian Spaeth
b0c8328e54 Move db.sql.models* to db.models* 2013-01-07 11:44:29 +01:00
Elrond
4ae4012dad Move db/models.py -> db/mongo/models.py
To my surprise, there was only ONE reference to models.py.
From open.py.
2011-12-20 20:41:21 +01:00
Elrond
faf74067da Move db/migrations.py -> db/mongo/migrations.py
And change references.
2011-12-20 20:33:33 +01:00
Elrond
59bd06aabb Move db/util.py -> db/mongo/util.py
- Change some reference
- Provide a wrapper db/util.py
2011-12-20 19:35:47 +01:00
Elrond
ddc1cae9ea Dot-Notation for MediaEntry.media_data 2011-12-05 21:08:58 +01:00
Elrond
5da0bf901b Dot-Notation for MediaEntry.slug 2011-12-05 21:08:58 +01:00
Elrond
ec82fbd85c Dot-Notation for MediaEntry.title 2011-12-05 21:08:58 +01:00
Elrond
1ceb4fc868 Dot-Notation for MediaEntry.uploader 2011-12-05 21:08:58 +01:00
Elrond
9047b254f3 Dot-Notation for Users.pw_hash 2011-12-05 21:08:57 +01:00
Elrond
5a4e3ff1e2 Dot-Notation for Users.username 2011-12-05 21:08:57 +01:00
Elrond
3018832153 Rename MediaEntry.uploader() to .get_uploader()
The .uploader() method conflicts with the uploader database
field. As we're moving to .FIELD for db field access, this
is a relevant conflict.

So renaming .uploader() to .get_uploader()
2011-11-22 22:29:37 +01:00
Pablo J. Urbano Santos
e62fc61194 Added parameter ascending to MediaEntry::get_comments, if true, comments
will be ordered ascending, otherwise descending
2011-11-19 19:11:42 +01:00
Elrond
eabe6b678a Dot-Notation for "_id"
Note: Migrations can't use "Dot Notation"!

Migrations run on pymongo, not mongokit.
So they can't use the "Dot Notation".
This isn't really a big issue, as migrations are anyway
quite mongo specific.
2011-11-15 11:32:13 +01:00
Elrond
7cbddc96a8 Enable mongokit's "Dot notation"
mongokit documents can allow to use x.FIELD instead of
x["FIELD"].
First it looks a lot more pythonic.
Second it might allow us an easier migration path towards
an sqlalchemy database backend.

Docs: http://namlook.github.com/mongokit/tutorial.html#dot-notation
2011-11-15 11:32:13 +01:00
Christopher Allan Webber
ee91c2b88d Merge remote-tracking branch 'remotes/nyergler/pep8-ification'
Conflicts:
	mediagoblin/db/migrations.py
	mediagoblin/db/models.py
	mediagoblin/user_pages/views.py
	mediagoblin/util.py
2011-11-13 20:23:26 -06:00
Nathan Yergler
243c3843bd Whitespace and formatting cleanup.
* Removed trailing whitespace
* Line length < 80 where possible
* Honor conventions on number of blank lines
* Honor conventions about spaces around :, =
2011-10-01 15:10:02 -07:00
Aaron Williamson
152a3bfaa3 Finished splitting util.py into separate files. 2011-10-01 18:05:44 -04:00
Aaron Williamson
ae3bc7fabf Moved common, translation, template, and url code out of util.py and into tools/[file].py 2011-10-01 09:31:42 -04:00
Christopher Allan Webber
f373599bd7 Merge branch 'gullydwarf-cfdv-f357_lost_password_functionality'
Conflicts:
	mediagoblin/auth/routing.py
2011-09-08 08:12:43 -05:00
Will Kahn-Greene
12a100e4d8 508. Updates copyright/license information 2011-09-01 20:50:19 -04:00
Caleb Forbes Davis V
6503073508 oops, uses Alejandro's fp_verification_key. my bad. 2011-08-28 21:13:07 -05:00
Alejandro Villanueva
25ba955e20 Adding fotgot password functionality 2011-08-28 20:08:14 -05:00
Christopher Allan Webber
6ee9c71902 Method to get the failure exception object for a MediaEntry, if appropriate. 2011-08-14 07:55:08 -05:00
Christopher Allan Webber
6c50c21068 Add fail_error and fail_metadata fields to MediaEntry and relevant migration 2011-08-13 07:48:34 -05:00
Christopher Allan Webber
ba4858c5b4 Merge branch 'master' into processing
Conflicts:
	mediagoblin/db/migrations.py
2011-08-11 22:54:11 -05:00
Christopher Allan Webber
852d5bb238 Merge branch 'master' into processing 2011-08-10 19:53:37 -05:00