mediagoblin.git
8 years agoMerge branch 'master' of git.sv.gnu.org:/srv/git/mediagoblin
Boris Bobrov [Fri, 22 Jan 2016 07:32:35 +0000 (10:32 +0300)]
Merge branch 'master' of git.sv.gnu.org:/srv/git/mediagoblin

8 years agoMake freesound compatible with python3
Boris Bobrov [Thu, 21 Jan 2016 22:36:27 +0000 (01:36 +0300)]
Make freesound compatible with python3

Freesound is a lib used for audio processing. Unfortunately, it doesn't
work with python3.

It lives in extlib, so we don't own the code. But, since the patch is
pretty trivial, it was decided to merge it anyway and propose the fix to
upstream. Which was done in https://github.com/MTG/freesound/pull/700 .
Also, a bugreport was opened to use upstream version instead of our
local, when it gets merged, ticket 5403.

8 years agoIssue #5394: Wrong url for forgot_password in basic_auth plugin
Christopher Allan Webber [Thu, 21 Jan 2016 20:37:50 +0000 (12:37 -0800)]
Issue #5394: Wrong url for forgot_password in basic_auth plugin

Fix by jerome.  Thank you!

8 years agoPass filename instead of file object when calling PIL.Image.save()
宋文武 [Tue, 12 Jan 2016 01:48:00 +0000 (09:48 +0800)]
Pass filename instead of file object when calling PIL.Image.save()

8 years agoFix an occurence of `print ...` to `print(...)`
Boris Bobrov [Thu, 21 Jan 2016 20:19:31 +0000 (23:19 +0300)]
Fix an occurence of `print ...` to `print(...)`

8 years agoFix #1096 - allow - in usernames
Loic Dachary [Tue, 12 Jan 2016 17:39:28 +0000 (18:39 +0100)]
Fix #1096 - allow - in usernames

Signed-off-by: Loic Dachary <loic@dachary.org>
8 years agotrac#5397: Allow decode_request to parse content-type headers with extra options.
Ben Sturmfels [Tue, 19 Jan 2016 12:53:52 +0000 (23:53 +1100)]
trac#5397: Allow decode_request to parse content-type headers with extra options.

It previously parsed "Content-Type: application/x-www-form-urlencoded", but not "Content-Type: application/x-www-form-urlencoded; charset=utf-8".

8 years agoFix #5398 and #5395 - Fix tests failing due to problem creating connection for alembic
Jessica Tallon [Wed, 20 Jan 2016 09:09:42 +0000 (09:09 +0000)]
Fix #5398 and #5395 - Fix tests failing due to problem creating connection for alembic

For some reason the alembic connection wasn't seeing any tables that existed
however the existing connection works well and we shouldn't be creating a brand
new one when we have one ready to use. I've used a little bit of a hack due to our
old version of alembic.

After 0.7.5 of alembic it offers a `Config.attributes` dictionary which is designed to
allow you to pass your connection/engine/whatever to the env.py config script so you're
not required to create new ones. As we're on an older version I just create a dictionary
with the same name and use it as otherwise documented. It seems this is the suggested
fix for #5395 and it fixes #5398 too.

8 years agoFix #5390 - Create migration to delete Notifications and fix Report
Jessica Tallon [Tue, 19 Jan 2016 09:17:12 +0000 (09:17 +0000)]
Fix #5390 - Create migration to delete Notifications and fix Report

When a user deleted media or other objects any notificationn objects or reports
would cause errors as the object doesn't exist anymore. This now removes them or
sets them to None as expected by the code. This also adds some code to the base
deletion code to make sure this happens when an object is deleted.

8 years agoFix #1099 - remove x mode from ini file
Loic Dachary [Tue, 12 Jan 2016 17:09:56 +0000 (18:09 +0100)]
Fix #1099 - remove x mode from ini file

Signed-off-by: Loic Dachary <loic@dachary.org>
8 years agoFix #5359 - unpriviledged -> unprivileged
Loic Dachary [Tue, 12 Jan 2016 00:47:20 +0000 (01:47 +0100)]
Fix #5359 - unpriviledged -> unprivileged

8 years agoUse inspect_table inplace of redefining them all
Jessica Tallon [Mon, 18 Jan 2016 10:29:01 +0000 (10:29 +0000)]
Use inspect_table inplace of redefining them all

Just like we would have in sqlalchemy-migration inspect_table works and
is better than constantly redefining a table in the migration. This switches
the migration to use that method.

8 years agoFix #5391 - Alembic migrations would only work for SQLite
Jessica Tallon [Mon, 18 Jan 2016 09:39:34 +0000 (09:39 +0000)]
Fix #5391 - Alembic migrations would only work for SQLite

The database connection was being set in a alembic.ini config file, if the user
had specified postgres the "sqlite" connection URL in alembic.ini would override
that. We probably should look into this more so i've opened #5395.

8 years agoFix issue 5366 Update blog views
ayleph [Sun, 6 Dec 2015 19:48:45 +0000 (14:48 -0500)]
Fix issue 5366 Update blog views

This commit updates blog views to be compatible with recent database
migrations.

Signed-off-by: Jessica Tallon <tsyesika@tsyesika.se>
8 years agoFix #5382 - Add migration and fix so tombstones are removed from collections
Jessica Tallon [Tue, 12 Jan 2016 11:41:21 +0000 (11:41 +0000)]
Fix #5382 - Add migration and fix so tombstones are removed from collections

When an item is deleted it should be removed from all collections, this commit
makes that happen. It's got two changes:

1. Adds the code so when an object is soft deleted, it's automatically removed from
   all collection items
2. Add a migration to fix this issue for those who have tombstones (Graveyard objects)
   in their collections because of this bug.

This commit requires you to run a migration

8 years agoFix #5315 - use `env` in shebangs
Loic Dachary [Tue, 12 Jan 2016 00:26:14 +0000 (01:26 +0100)]
Fix #5315 - use `env` in shebangs

8 years agoUse six.itervalues() in delete_media_files
宋文武 [Tue, 12 Jan 2016 03:37:21 +0000 (11:37 +0800)]
Use six.itervalues() in delete_media_files

8 years agoAdding Tom Fay to the AUTHORS file
Christopher Allan Webber [Thu, 14 Jan 2016 18:16:12 +0000 (10:16 -0800)]
Adding Tom Fay to the AUTHORS file

8 years agoAdd a TODO to rename run_all_migrations to run_legacy_migrations
Christopher Allan Webber [Thu, 7 Jan 2016 22:36:26 +0000 (14:36 -0800)]
Add a TODO to rename run_all_migrations to run_legacy_migrations

8 years agoInitial alembic migration to base other migrations on
Boris Bobrov [Thu, 26 Nov 2015 20:47:55 +0000 (23:47 +0300)]
Initial alembic migration to base other migrations on

Use this migration as a parent for yours.

8 years agoEnable alembic as the main tool for migrations
Boris Bobrov [Sat, 7 Nov 2015 13:57:22 +0000 (16:57 +0300)]
Enable alembic as the main tool for migrations

Enable alembic for all migrations and limit the max number of
sqlalchemy-migration migration. All new migrations must now be in
Alembic!

8 years agoFix various style issues
Boris Bobrov [Sun, 1 Nov 2015 00:26:39 +0000 (09:26 +0900)]
Fix various style issues

Sorry, cannot look at them without urge to fix

8 years agoAdd a comment when we do / don't add collections dropdown
Christopher Allan Webber [Thu, 7 Jan 2016 19:07:38 +0000 (11:07 -0800)]
Add a comment when we do / don't add collections dropdown

Otherwise that "del submit_form.collection" might be confusing :)

8 years agoAdd test to check that an activity is created when a collection was chosen.
tom [Sat, 12 Dec 2015 11:29:27 +0000 (11:29 +0000)]
Add test to check that an activity is created when a collection was chosen.

8 years agoAdd collection drop down to submit page.
tom [Sat, 12 Dec 2015 11:02:39 +0000 (11:02 +0000)]
Add collection drop down to submit page.

8 years agoDo not require python3.3 explicitely
Boris Bobrov [Thu, 7 Jan 2016 15:28:52 +0000 (18:28 +0300)]
Do not require python3.3 explicitely

It's easier to say "use python3.3+" rather than prevent usage of earlier
versions programmatically in autoconf.

8 years agoUncap Paste
Boris Bobrov [Thu, 7 Jan 2016 18:12:01 +0000 (21:12 +0300)]
Uncap Paste

Paste was capped to 1.9.9 because 2.0 broke us. Now Paste 2.0.x was released
and it doesn't break us any more. Closes bug 5317.

8 years agoAdd workaround for incompilable Interlingua locale
Boris Bobrov [Thu, 7 Jan 2016 16:50:27 +0000 (19:50 +0300)]
Add workaround for incompilable Interlingua locale

For now we cannot compile Interlingua (ia) locale; please see issue
1070 for details.

8 years agoFix issue 5367 Edit view updates
ayleph [Sun, 6 Dec 2015 19:54:32 +0000 (14:54 -0500)]
Fix issue 5367 Edit view updates

This commit fixes issue 5367 by updating the edit view to be compatible
with recent db migrations.

Signed-off-by: Jessica Tallon <tsyesika@tsyesika.se>
8 years agoFix issue 5371 broken collection atom feeds
ayleph [Mon, 7 Dec 2015 16:38:21 +0000 (11:38 -0500)]
Fix issue 5371 broken collection atom feeds

Signed-off-by: Jessica Tallon <tsyesika@tsyesika.se>
8 years agoFix #5369 - Broken activities cause issues in migrations
Jessica Tallon [Wed, 6 Jan 2016 15:45:41 +0000 (15:45 +0000)]
Fix #5369 - Broken activities cause issues in migrations

This fixes a few bugs in previous migrations and then also introduces a new
migration for those who had run the previous migrations without encountering
the bugs to ensure that the database is in the same state as those who ran it
after the bug fixes introduced in this commit.

The commit also ensures that all activities are valid, they should be but they
might not be so checks, from now on we should be able to assume that all activities
will always be valid.

8 years agoPoint to the "Libre Browsers Libre Formats" page on the LibrePlanet wiki
Christopher Allan Webber [Tue, 29 Dec 2015 21:01:02 +0000 (15:01 -0600)]
Point to the "Libre Browsers Libre Formats" page on the LibrePlanet wiki

8 years agoRemove .tx/config as we're no longer using Transifex
Jessica Tallon [Tue, 29 Dec 2015 16:41:47 +0000 (16:41 +0000)]
Remove .tx/config as we're no longer using Transifex

8 years agoFix a exception db closed exception in migrations
Jessica Tallon [Tue, 29 Dec 2015 16:36:35 +0000 (16:36 +0000)]
Fix a exception db closed exception in migrations

Some sqlite migrations were failing due to some problems with sqlite. A
work around has been created for these however it does involve loading lots
of data into memory. If you have a large database you should consider trying
to move to postgres.

8 years agoFix migrations of activity intermediators
Jessica Tallon [Mon, 28 Dec 2015 13:27:41 +0000 (13:27 +0000)]
Fix migrations of activity intermediators

There was a problem where it was assuming the tablenames are the same
in master as they always were and that isn't the case. This would cause
it to raise an exception when trying to look up a table which didn't exist.
This fixes that by hardcoding the old tablenames in for this migration.

8 years agoFix #5368 - Improve test efficiancy
Jessica Tallon [Mon, 28 Dec 2015 12:55:33 +0000 (12:55 +0000)]
Fix #5368 - Improve test efficiancy

There were a number of tests where lots of models where being iterated through
and then at the end committing them. The problem is all the changes had to be
kept in memory or on disk somewhere before they were commit to the database. This
fix commits each change as it's being made, allowing resources to be freed and fixing
some of the inefficiencies

8 years agoMerge branch 'stable'
Boris Bobrov [Sun, 20 Dec 2015 23:46:24 +0000 (02:46 +0300)]
Merge branch 'stable'

8 years agoWork around pbutils import warning bug (5066)
Boris Bobrov [Sun, 20 Dec 2015 23:45:22 +0000 (02:45 +0300)]
Work around pbutils import warning bug (5066)

8 years agoFix typo in VideoData docstring
Boris Bobrov [Sun, 20 Dec 2015 18:38:56 +0000 (21:38 +0300)]
Fix typo in VideoData docstring

8 years agoSetting 0.8.2.dev in configure.ac as well
Christopher Allan Webber [Sun, 20 Dec 2015 17:11:07 +0000 (11:11 -0600)]
Setting 0.8.2.dev in configure.ac as well

8 years agoSetting version to v0.8.2.dev
Christopher Allan Webber [Sun, 20 Dec 2015 17:10:23 +0000 (11:10 -0600)]
Setting version to v0.8.2.dev

8 years agoFixing typo (thanks breton)
Christopher Allan Webber [Sun, 20 Dec 2015 16:58:43 +0000 (10:58 -0600)]
Fixing typo (thanks breton)

8 years ago0.8.1 release notes
Christopher Allan Webber [Sun, 20 Dec 2015 15:53:25 +0000 (09:53 -0600)]
0.8.1 release notes

8 years agoMerge branch 'stable'
Christopher Allan Webber [Sun, 20 Dec 2015 15:05:00 +0000 (09:05 -0600)]
Merge branch 'stable'

8 years agoFix security issue in OAuth verifier validation
Jessica Tallon [Sun, 20 Dec 2015 01:11:31 +0000 (01:11 +0000)]
Fix security issue in OAuth verifier validation

8 years agoMerge branch 'stable'
Christopher Allan Webber [Sun, 20 Dec 2015 03:57:27 +0000 (21:57 -0600)]
Merge branch 'stable'

Conflicts:
mediagoblin/i18n/templates/en/mediagoblin.po
mediagoblin/plugins/archivalook/tools.py

8 years agoFix bug on the OAuth client deauthorization page
Jessica Tallon [Sun, 20 Dec 2015 01:49:28 +0000 (01:49 +0000)]
Fix bug on the OAuth client deauthorization page

An exception was raised when a user tried to go to the authroization page
this occured when we changed the field names on the models from "user" to
actor. This patch corrects the query and resolves the error.

8 years agoFix Issue 5375 Deprecated function in video thumb
ayleph [Fri, 18 Dec 2015 02:06:42 +0000 (21:06 -0500)]
Fix Issue 5375 Deprecated function in video thumb

This patch fixes issue 5375 by replacing a function call that has
been removed in recent versions of PIL with the recommended
replacement.

(cherry picked from commit 564a48e018bcd786aa32b232cb7216be3ef3fb5e)

8 years agoFix Issue 5375 Deprecated function in video thumb
ayleph [Fri, 18 Dec 2015 02:06:42 +0000 (21:06 -0500)]
Fix Issue 5375 Deprecated function in video thumb

This patch fixes issue 5375 by replacing a function call that has
been removed in recent versions of PIL with the recommended
replacement.

8 years agoKludgey documentation fix so that python 2 does not break with flup
Christopher Allan Webber [Mon, 14 Dec 2015 20:19:20 +0000 (14:19 -0600)]
Kludgey documentation fix so that python 2 does not break with flup

See also Issue #5373

8 years agoAdd "Add media" button on home page when no media is present.
Ben Sturmfels [Tue, 4 Aug 2015 04:19:09 +0000 (14:19 +1000)]
Add "Add media" button on home page when no media is present.

This is an addition to the button hidden in the top toolbar.

8 years agoFix issue #5372: test_comment_notification fails with werkzeug 0.11 or newer
Christopher Allan Webber [Thu, 10 Dec 2015 17:29:20 +0000 (11:29 -0600)]
Fix issue #5372: test_comment_notification fails with werkzeug 0.11 or newer

Formerly like:
   chris commented on your post (​http://localhost:80/u/otherperson/m/some-title/c/1/#comment) at GNU MediaGoblin

With werkzeug 0.11.0 or higher:
    chris commented on your post (​http://localhost/u/otherperson/m/some-title/c/1/#comment) at GNU MediaGoblin

Easy enough just to be flexible.

8 years agoFix issue 983 PDF UnicodeDecodeError
ayleph [Fri, 4 Dec 2015 07:02:02 +0000 (02:02 -0500)]
Fix issue 983 PDF UnicodeDecodeError

Parse PDF lines as unicode to prevent UnicodeDecodeError when a
non-ASCII character is encountered.

8 years agoFix #5363 - Collections don't serialize correctly
Jessica Tallon [Wed, 25 Nov 2015 14:57:46 +0000 (14:57 +0000)]
Fix #5363 - Collections don't serialize correctly

8 years agoAdded test for #5356 - Read someone else's feed
Jessica Tallon [Tue, 24 Nov 2015 10:45:23 +0000 (10:45 +0000)]
Added test for #5356 - Read someone else's feed

This adds a test and improves a previous test for the ability to read
someone elses feed. Previously it was not possible however this has
since been patched and this test checks for that.

8 years agoAllow API client to GET another user's outbox
ayleph [Sat, 31 Oct 2015 08:18:44 +0000 (04:18 -0400)]
Allow API client to GET another user's outbox

Signed-off-by: Jessica Tallon <tsyesika@tsyesika.se>
8 years agoFix #5354 & #5355 - Fix Graveyard.serialize
Jessica Tallon [Mon, 23 Nov 2015 17:27:32 +0000 (17:27 +0000)]
Fix #5354 & #5355 - Fix Graveyard.serialize

Graveyard.serialize raised an exception as the deleted datetime
objects where not being converted to strings for json encoding. It
also didn't deal with the case when there was an actor, it now calls
the actor's serialize method as it should.

Thanks to Alyeph who provided the patches for both of these.

8 years agoUse urljoin to create proper feed media URLs
ayleph [Wed, 4 Nov 2015 03:56:33 +0000 (22:56 -0500)]
Use urljoin to create proper feed media URLs

8 years agoFix for issue 5070 gst incomplete file
ayleph [Wed, 18 Nov 2015 04:56:31 +0000 (23:56 -0500)]
Fix for issue 5070 gst incomplete file

Seek tmp_media_file to 0 before attempting to discover the file type.
This prevents the following error when discovering mp4 video files.

"gst-stream-error-quark: This file is incomplete and cannot be played"

8 years agoFix add collection view for new schema
Daniel Krol [Mon, 9 Nov 2015 08:11:36 +0000 (00:11 -0800)]
Fix add collection view for new schema

8 years agoFix minor grammatical error 'settings' -> 'setting'.
Ben Sturmfels [Tue, 4 Aug 2015 02:23:14 +0000 (12:23 +1000)]
Fix minor grammatical error 'settings' -> 'setting'.

8 years agoRemove <br/> from safe string indicating that CSRF cooking is missing.
Ben Sturmfels [Tue, 4 Aug 2015 02:00:58 +0000 (12:00 +1000)]
Remove <br/> from safe string indicating that CSRF cooking is missing.

8 years agotrac#687: Add unit tests for `redirect` and `redirect_obj`.
Ben Sturmfels [Mon, 4 Aug 2014 07:18:36 +0000 (17:18 +1000)]
trac#687: Add unit tests for `redirect` and `redirect_obj`.

8 years agoSwitch to webtest >= 2.0.18
Christopher Allan Webber [Thu, 5 Nov 2015 21:32:51 +0000 (15:32 -0600)]
Switch to webtest >= 2.0.18

8 years agotrac#665: Upgrade to WebTest 2.0.18 and fix broken test `test_csrf_cookie_set`.
Ben Sturmfels [Mon, 24 Aug 2015 10:47:33 +0000 (20:47 +1000)]
trac#665: Upgrade to WebTest 2.0.18 and fix broken test `test_csrf_cookie_set`.

Test was failing due to API change in WebTest around accessing cookies set in the test client. These are now in `test_app.cookies`.

While there are currently 48 other tests failing, I've verified that before and after this change that the same number fail. I've also checked that no other tests use the old API for accessing test client cookies.

I've pinned to version 2.0.18. My understanding is that it's generally a good idea to pin to a specific version where possible to avoid the "why has this suddenly broken" type bugs. This also seems appropriate since WebTest appears to be very stable.

8 years agoPrevent unhandled exception on non-existant user.
Ben Sturmfels [Sun, 23 Aug 2015 10:37:15 +0000 (20:37 +1000)]
Prevent unhandled exception on non-existant user.

These changes bring `makeadmin` and `changepw` in-line with the approach used in `deleteuser`.

I've also made the error messages more consistent: list the username and full sentences.

8 years agoMerge branch 'comments'
Jessica Tallon [Tue, 20 Oct 2015 13:02:15 +0000 (13:02 +0000)]
Merge branch 'comments'

8 years agoComment changes for federation
Jessica Tallon [Tue, 20 Oct 2015 12:24:54 +0000 (12:24 +0000)]
Comment changes for federation

This adds a new Comment link table that is used to link between some
object and then the comment object, which can be more or less any
object in Mediagoblin. The MediaComment has been renamed to
TextComment as that more aptly describes what it is. There is
migrations for these changes.

There is also the conslidation of the Report tables into a single
Report table, the same with the Notification objects. This is because
both of them split out MediaEntry and Comment versions into their own
polymorphic versions from a base, this is no longer a meaningful
distinction as comments can be anything.

8 years agoFix #5353 - Bug in OAuth which referenced "user"
Jessica Tallon [Sat, 17 Oct 2015 00:18:32 +0000 (00:18 +0000)]
Fix #5353 - Bug in OAuth which referenced "user"

There was a recent change in 0f3bf8d where several names which were
used to refer the actor where renamed to the standard "actor"
property name. There were some places in the OAuth decorator and the
OAuth views where the old names were still referred. This fixes that.

8 years agoAdd public_id fixes throughout the code
Jessica Tallon [Wed, 7 Oct 2015 11:13:40 +0000 (13:13 +0200)]
Add public_id fixes throughout the code

This adds several things, mainly code which checks for the public id and
if it doesn't exist generating it where it can. This is to because we
need to keep the public_id to be able to effectively soft delete models.

This also adds a public_id field to the Activity along with a migration.

8 years agoAdd Graveyard model
Jessica Tallon [Thu, 1 Oct 2015 13:59:20 +0000 (15:59 +0200)]
Add Graveyard model

This adds the Graveyard model which is used when a model is deleted, it
stores the important "shell" information on the model so it can
hard-delete the real object. It also remaps the GenericModelReference
references to the new Graveyard model.

This also moves the soft deletion setting from __model_args__ to
"deletion_mode" on the model.

8 years agoAdd the __model_args__ deletion code
Jessica Tallon [Thu, 1 Oct 2015 11:23:33 +0000 (13:23 +0200)]
Add the __model_args__ deletion code

This adds the "deleted" fields to the models as well as a new
__model_args__ section whcih supports the option for changing the
deletion type. Deletion is now handled by choosing a deletion method
based on the __model_args__["deletion"] setting, for example if it's
soft deletion it will call Model.soft_delete()

8 years agoCollection changes and migration for federation
Jessica Tallon [Thu, 17 Sep 2015 11:47:56 +0000 (13:47 +0200)]
Collection changes and migration for federation

- Adds a "type" column to the Collection object and allows the
CollectionItem model to contain any object.
- Changes "items" to "num_items" as per TODO
- Renames "uploader", "creator" and "user" to a common "actor" in most places

8 years agoFix bugs with the exifread library update
Jessica Tallon [Wed, 7 Oct 2015 11:48:42 +0000 (13:48 +0200)]
Fix bugs with the exifread library update

- As of version 2.1.2 of exifread the 90 CW and 90 CCW values were
  swapped, this bug is now fixed however our test data had those values
  swapped too. I have fixed that.

- I also noticed that I had different orientation values, this was
  noticed and fixed for some other differing values in commit ccca39f1
  when it was decided we'll add values which were noticed on different
  platforms.

8 years agoFix #994: Also set self.data when no change made to URL.
Ben Sturmfels [Fri, 4 Sep 2015 13:31:53 +0000 (23:31 +1000)]
Fix #994: Also set self.data when no change made to URL.

This partially reverts 2a1082e3

8 years agoUse StringField.process_formdata() if valuelist is empty.
Berker Peksag [Tue, 25 Aug 2015 00:44:02 +0000 (03:44 +0300)]
Use StringField.process_formdata() if valuelist is empty.

8 years agoFix #994: Don't require users to type the website URL scheme when updating profile.
Ben Sturmfels [Sun, 23 Aug 2015 12:17:13 +0000 (22:17 +1000)]
Fix #994: Don't require users to type the website URL scheme when updating profile.

Adds 'http://' if no scheme is provided. Eg. If you enter
'www.example.com', this will be updated to 'http://www.example.com'.

8 years agoIssue #815: Replace two non-ASCII curly single quotes with straight quotes.
Ben Sturmfels [Tue, 4 Aug 2015 00:15:17 +0000 (10:15 +1000)]
Issue #815: Replace two non-ASCII curly single quotes with straight quotes.

I don't think there's necessarily anything wrong with using non-ASCII
characters, since UTF-8 is basically the de facto standard. There's no
reason to mix a small number of curly quotes into a configuration file
though, so I've replaced them for consistency.

8 years agoFix some unit tests and bugs
Jessica Tallon [Mon, 24 Aug 2015 16:28:41 +0000 (18:28 +0200)]
Fix some unit tests and bugs

This fixes a lot of the issues with the LocalUser changes that were
merged recently. There was a problem where the attributes of LocalUser
were not being eagerly loaded and because the Session was detached an
exception was being raised when they were accessed.

This also fixes some typo's which were introduced.

Finally this adds a temporary fix for a potential SQLAlchemy bug, this
is a bug where doing:

    User.query.filter(LocalUser.username == "some_username").first()

does NOT yeild a user with the username "some_username" but all users
on the site. The temp fix is to just query the LocalUser, this should
be resolved when bug is confirmed and fixed upstream.

8 years agoFix #5344 - OAuth NotImplemented exception
Jessica Tallon [Fri, 21 Aug 2015 15:57:39 +0000 (17:57 +0200)]
Fix #5344 - OAuth NotImplemented exception

This introduces a migration which adds a dummy Client, RequestToken
and AccessToken. These are used when an invalid request comes in,
instead of bailing early, it needs dummy data to prevent timing
attacks.

This then implements the methods which get the IDs of the dummy
objects. If these are changed in the future a migration which checks
for the previous dummy object should be created and updates them to
reflect the new IDs/tokens.

8 years agoFix #1066 - OAuth Invalid signature error
Jessica Tallon [Thu, 20 Aug 2015 11:20:48 +0000 (13:20 +0200)]
Fix #1066 - OAuth Invalid signature error

It seems that the GET params on a URL should be included when
one signs the request. Mediagoblin was just using the base URL
without them. This should fix that.

8 years agoFix serialization after model changes
Jessica Tallon [Thu, 20 Aug 2015 09:31:50 +0000 (11:31 +0200)]
Fix serialization after model changes

After the recent model changes there were some bugs which were
introduced into the serialization methods of the models. This commit
fixes those issues.

8 years agoChange structure of MediaEntry and add migration
Jessica Tallon [Wed, 19 Aug 2015 14:56:49 +0000 (16:56 +0200)]
Change structure of MediaEntry and add migration

This makes the changes needed for federating MediaEntry objects as well
as adding the migration and necessary methods to get the public_id just
in time (JIT).

8 years agoChange codebase to query or create correct User model
Jessica Tallon [Fri, 17 Jul 2015 15:51:51 +0000 (17:51 +0200)]
Change codebase to query or create correct User model

The code base had many references to User.username and other
specific to LocalUser attributes as that was the way it use to exist.
This updates those to query on the generic User model but filtering
by attributes on the LocalUser.

8 years agoAdd a no_referrer setting to prevent browsers leaking information.
Duncan [Sun, 2 Aug 2015 03:51:27 +0000 (06:51 +0300)]
Add a no_referrer setting to prevent browsers leaking information.

8 years agoFix urlparse import in tools/routing.py
Berker Peksag [Sat, 1 Aug 2015 02:05:07 +0000 (05:05 +0300)]
Fix urlparse import in tools/routing.py

urlparse is already a function, so we don't need to specify
a module name.

Refs #5339

8 years agoFix urlparse import in tools/routing.py
Berker Peksag [Sat, 1 Aug 2015 02:05:07 +0000 (05:05 +0300)]
Fix urlparse import in tools/routing.py

urlparse is already a function, so we don't need to specify
a module name.

Refs #5339

8 years agoAdd the user models to the MODELS list
Jessica Tallon [Fri, 31 Jul 2015 11:45:52 +0000 (13:45 +0200)]
Add the user models to the MODELS list

This adds the two new user models (LocalUser and RemoteUser) to the
MODELS list that is in models.py. This stops the strange bug that occurs
if you migrate a fresh database, the two models don't exist however
migrating an existing database would create them as the migrations
exist.

8 years agoChange codebase to query or create correct User model
Jessica Tallon [Fri, 17 Jul 2015 15:51:51 +0000 (17:51 +0200)]
Change codebase to query or create correct User model

The code base had many references to User.username and other
specific to LocalUser attributes as that was the way it use to exist.
This updates those to query on the generic User model but filtering
by attributes on the LocalUser.

8 years agoAdd polymorphic properties to User
Jessica Tallon [Fri, 17 Jul 2015 15:49:18 +0000 (17:49 +0200)]
Add polymorphic properties to User

This adds the ability to search for any user based on the generic
User case and be given back the specific LocalUser or RemoteUser.

This will require any code using the model to look which attributes
they are searching on and specify the specific User model they are
on if they're not on the generic User model. This will also require
new users to be created with LocalUser.

8 years agoAdd LocalUser and RemoteUser and migration
Jessica Tallon [Fri, 26 Jun 2015 13:29:44 +0000 (15:29 +0200)]
Add LocalUser and RemoteUser and migration

8 years agoRegenerate po file after 8e832f84597bd1505f23f4abd4eef96ce12d3822
Berker Peksag [Wed, 22 Jul 2015 08:26:08 +0000 (11:26 +0300)]
Regenerate po file after 8e832f84597bd1505f23f4abd4eef96ce12d3822

8 years agoFix typos reported in #1102
Berker Peksag [Wed, 22 Jul 2015 08:24:12 +0000 (11:24 +0300)]
Fix typos reported in #1102

8 years agoRegenerate po file after 8e832f84597bd1505f23f4abd4eef96ce12d3822
Berker Peksag [Wed, 22 Jul 2015 08:24:49 +0000 (11:24 +0300)]
Regenerate po file after 8e832f84597bd1505f23f4abd4eef96ce12d3822

8 years agoFix typos reported in #1102
Berker Peksag [Wed, 22 Jul 2015 08:24:12 +0000 (11:24 +0300)]
Fix typos reported in #1102

8 years agoReturn non-zero exit code if the command cannot be completed successfully.
Berker Peksag [Wed, 22 Jul 2015 07:52:37 +0000 (10:52 +0300)]
Return non-zero exit code if the command cannot be completed successfully.

Fixes #5084

8 years agoPin mock 1.0.1 in Python 2 for now.
Berker Peksag [Wed, 22 Jul 2015 07:18:00 +0000 (10:18 +0300)]
Pin mock 1.0.1 in Python 2 for now.

mock recently dropped Python 2.6 support and then
re-introduced it in its latest release (however,
it's a bit unstable right now).

I think at this point, we can be more cautious
and just use mock==1.0.1.

8 years agoPin mock 1.0.1 in Python 2 for now.
Berker Peksag [Wed, 22 Jul 2015 07:18:00 +0000 (10:18 +0300)]
Pin mock 1.0.1 in Python 2 for now.

mock recently dropped Python 2.6 support and then
re-introduced it in its latest release (however,
it's a bit unstable right now).

I think at this point, we can be more cautious
and just use mock==1.0.1.

8 years agoChange all unicode() calls with six.text_type().
Berker Peksag [Thu, 25 Jun 2015 19:24:03 +0000 (22:24 +0300)]
Change all unicode() calls with six.text_type().

Fixes #5329.

8 years agoChange all unicode() calls with six.text_type().
Berker Peksag [Thu, 25 Jun 2015 19:24:03 +0000 (22:24 +0300)]
Change all unicode() calls with six.text_type().

Fixes #5329.