mediagoblin.git
11 years agoMerge remote-tracking branch 'refs/remotes/origin/533-new-dropdown'
Christopher Allan Webber [Thu, 17 Jan 2013 17:47:29 +0000 (11:47 -0600)]
Merge remote-tracking branch 'refs/remotes/origin/533-new-dropdown'

Conflicts:
mediagoblin/templates/mediagoblin/base.html
mediagoblin/templates/mediagoblin/root.html

11 years agoMerge commit '9408938' from 565_workbench_cleanup (spaetz)
Christopher Allan Webber [Thu, 17 Jan 2013 17:12:13 +0000 (11:12 -0600)]
Merge commit '9408938' from 565_workbench_cleanup (spaetz)

11 years agoCSS edits to dropdown menu; added log out button for unverified users
Jef van Schendel [Thu, 17 Jan 2013 15:15:03 +0000 (16:15 +0100)]
CSS edits to dropdown menu; added log out button for unverified users

11 years agoChange position of "Delete account" link, put it below the form
Jef van Schendel [Thu, 17 Jan 2013 12:35:45 +0000 (13:35 +0100)]
Change position of "Delete account" link, put it below the form

11 years agoBetter "delete my account" placement
Sebastian Spaeth [Thu, 17 Jan 2013 11:47:38 +0000 (12:47 +0100)]
Better "delete my account" placement

Improve the "delete my account" link location by not placing it outside the
main content bar. It still might require more tweaks.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoIntroduce user_deletion test.
Sebastian Spaeth [Thu, 17 Jan 2013 11:19:16 +0000 (12:19 +0100)]
Introduce user_deletion test.

Delete a user via web interface and see if it works. TODO: this does not test
that related entries are also cleaned up and we should extend the test to
do so.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoAllowing to delete a user account (#302)
Sebastian Spaeth [Thu, 15 Nov 2012 09:44:38 +0000 (10:44 +0100)]
Allowing to delete a user account (#302)

Add a "Delete user account" template and link to it from the user
account settings page.

Create a delete_account function and fill in most blanks. We can now
successfully delete our own account.

Thanks to Elrond for catching a stray csrf_exempt in a previous iteration
of this patch.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoimport db.sql.util -> db.util
Sebastian Spaeth [Thu, 17 Jan 2013 11:18:14 +0000 (12:18 +0100)]
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>
11 years agoMerge branch '540_User_delete_deletes_related_entries'
Sebastian Spaeth [Thu, 17 Jan 2013 10:52:22 +0000 (11:52 +0100)]
Merge branch '540_User_delete_deletes_related_entries'

11 years agoImplement User.delete() (#540)
Sebastian Spaeth [Wed, 28 Nov 2012 14:46:40 +0000 (15:46 +0100)]
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)

11 years agoImplement Collection.delete()
Sebastian Spaeth [Wed, 28 Nov 2012 15:15:46 +0000 (16:15 +0100)]
Implement Collection.delete()

Deleting a Collection should automatically delete all containing items.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoImplement MediaEntry().delete() (#540)
Sebastian Spaeth [Thu, 15 Nov 2012 10:44:50 +0000 (11:44 +0100)]
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>
11 years agoAdd @get_workbench test
Sebastian Spaeth [Wed, 12 Dec 2012 13:29:49 +0000 (14:29 +0100)]
Add @get_workbench test

Test the decorator function and proper cleanup after it's usage.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoShorten Workbench(Manager) method names
Sebastian Spaeth [Wed, 12 Dec 2012 13:08:38 +0000 (14:08 +0100)]
Shorten Workbench(Manager) method names

1) destroy_self() is a horrible function name, make it "destroy".
workbench.destroy() is descriptive enough.

2) WorkbenchManager.create_workbench() -> WorkbenchManager.create()
  We use the pattern "with workbench_manager.create() as workbench:"
  No need to mention workbenches three times in a row...

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoSwitch over media processor to use the get_workbench decorator (#565)
Sebastian Spaeth [Wed, 12 Dec 2012 12:57:17 +0000 (13:57 +0100)]
Switch over media processor to use the get_workbench decorator (#565)

This makes workbench getting more convenient by eliminating some
boilerplate and more robust by cleaning the workbench up even if processing
ends with an Exception.

Finally, this fixes the bugs in the ascii and video backends to never call
workbench.destroy, so those workbenches were never cleaned up.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoImplement @get_workbench decorator
Sebastian Spaeth [Wed, 12 Dec 2012 12:53:56 +0000 (13:53 +0100)]
Implement @get_workbench decorator

This passes in a Workbench() via the 'workbench' keyword argument, and
conveniently cleans it up after the function has finished. 2 out of our 5
backends forgot to clean up their workbench, so this is clearly needed :-).

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoMake Workbench() a context manager
Sebastian Spaeth [Wed, 12 Dec 2012 12:50:32 +0000 (13:50 +0100)]
Make Workbench() a context manager

This allows us to use "with Workbench() as foo: do_stuff..."
No consumers have been switched yet though.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoMake the workbench destroy itself for video processing also.
Christopher Allan Webber [Wed, 16 Jan 2013 18:12:57 +0000 (12:12 -0600)]
Make the workbench destroy itself for video processing also.

11 years agoMerge remote-tracking branch 'refs/remotes/spaetz/561_use_workbench_not_tempfiles'
Christopher Allan Webber [Wed, 16 Jan 2013 17:23:38 +0000 (11:23 -0600)]
Merge remote-tracking branch 'refs/remotes/spaetz/561_use_workbench_not_tempfiles'

11 years agoMerge remote-tracking branch 'refs/remotes/elrond/misc/use_media_id'
Christopher Allan Webber [Wed, 16 Jan 2013 17:06:22 +0000 (11:06 -0600)]
Merge remote-tracking branch 'refs/remotes/elrond/misc/use_media_id'

11 years agocollection browsing: rename view/template user_collections -> collection_list
Stefano Zacchiroli [Tue, 15 Jan 2013 22:11:33 +0000 (23:11 +0100)]
collection browsing: rename view/template user_collections -> collection_list

Rationale, avoid confusion between views user_collection and user_collections
(note trailing "s"). Ditto for the collection(s).html templates.

11 years agocollection browsing: remove pagination support
Stefano Zacchiroli [Tue, 15 Jan 2013 22:04:37 +0000 (23:04 +0100)]
collection browsing: remove pagination support

rationale: we do not expect hundreds of collection (and it was likely broken
anyhow)

thanks to Elrond der Elbenfuerst for pointing this out

11 years agocollection browsing: drop atom feed from page template
Stefano Zacchiroli [Tue, 15 Jan 2013 20:43:12 +0000 (21:43 +0100)]
collection browsing: drop atom feed from page template

rationale: it refers to something else than a "collection feed"

thanks to Elrond der Elbenfuerst for pointing this out

11 years agocollections: add support to browse existing collections
Stefano Zacchiroli [Tue, 18 Dec 2012 11:34:30 +0000 (12:34 +0100)]
collections: add support to browse existing collections

- add a route at /u/<user>/collections/ (note trailing 's') that lists
  all existing collections
- move there the "Create new collection" link, if the user is logged in
- add a new link "Browse collections" from root.html

11 years ago#571: Fixed. Display collection description with Markdown formatting.
Tiberiu C. Turbureanu [Tue, 15 Jan 2013 16:03:06 +0000 (18:03 +0200)]
#571: Fixed. Display collection description with Markdown formatting.

11 years agoUnbreak 301 responses
Sebastian Spaeth [Tue, 15 Jan 2013 15:52:22 +0000 (16:52 +0100)]
Unbreak 301 responses

The move to werkzeug routing went pretty smooth, but one thing was
broken by accident: URLs without final slash result in a 301
werkzeug.routing.RequestRedirect response. We displayed it as a generic
error page rather than actually sending the redirect. Do that. One thing
it does though is to skip all meddlewares, which should be OK for a 301
response, but might need rework if we decide otherwise. With this, 301
responses with lacking final slash are unbroken again.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoSimplify check_media_slug_used
Sebastian Spaeth [Wed, 9 Jan 2013 10:31:05 +0000 (11:31 +0100)]
Simplify check_media_slug_used

Remove the unused dummy_db argument and generally make the function
readable.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoMore explicit get_or_create pattern
Sebastian Spaeth [Wed, 9 Jan 2013 08:53:55 +0000 (09:53 +0100)]
More explicit get_or_create pattern

Don't do "user = getUser() or newUser()" in one line. It is bound to
confuse poor souls. Be more explicit here and even add a code comment.

Thanks to Elrond for not liking the previous pattern.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoImprove error message wording (#564)
Sebastian Spaeth [Mon, 14 Jan 2013 15:09:24 +0000 (16:09 +0100)]
Improve error message wording (#564)

Improve error message wording if no csf cookie could be detected. Also,
make the error text translatable.

11 years agoUse the new logo.html thingy in airy.
Elrond [Sun, 16 Dec 2012 13:08:38 +0000 (14:08 +0100)]
Use the new logo.html thingy in airy.

11 years agoMove logo part into bits/logo.html
Elrond [Sun, 16 Dec 2012 12:47:13 +0000 (13:47 +0100)]
Move logo part into bits/logo.html

To make it easier for themers to replace the logo, move it
out into its own logo.html.

11 years agoKill db_host, db_name, and db_port from config_spec.ini.
Elrond [Tue, 8 Jan 2013 21:54:36 +0000 (22:54 +0100)]
Kill db_host, db_name, and db_port from config_spec.ini.

The last bits of mongo. Let me remove them.

11 years agoStart to use the media_id in "admin" URLs.
Elrond [Fri, 11 Jan 2013 13:18:27 +0000 (14:18 +0100)]
Start to use the media_id in "admin" URLs.

We have a bunch of URLs that are more for internal use. At
least they're definitely not intended to be posted
somewhere for long term useage.

When those things affect a media, it's much better to
reference the media by its id. This can't change, ever.
This is better for races.
Like someone posting a comment while the owner
corrects a typo in the slug.

11 years agoMake runtests.sh be useable from anywhere.
Elrond [Fri, 11 Jan 2013 19:55:35 +0000 (20:55 +0100)]
Make runtests.sh be useable from anywhere.

Now you can have your current directory anywhere and call
runtests.sh with full path and it'll find the way to
nosetests and the tests directory on its own.

Most useful if you're inside the mediagoblin/ dir and can
just call "../runtests.sh".

11 years agoissue 355: Only run tests in mediagoblin/tests/
Elrond [Thu, 10 Jan 2013 21:34:52 +0000 (22:34 +0100)]
issue 355: Only run tests in mediagoblin/tests/

If you don't give an option argument (starting with a dash)
to runtests.sh then it will append the directory with all
the tests to the commandline of nosetests. That way it will
only search there for tests.

11 years agoImprove and extend profile editing tests
Sebastian Spaeth [Tue, 8 Jan 2013 09:24:10 +0000 (10:24 +0100)]
Improve and extend profile editing tests

We only ever ran the password changing test here, and not the
half-existing test for changing the bio and homepage.

Fix the tests to actually run both tests. We check that setting bio and
homepage to a valid value works as expected. We also test for invalid
bio (too long) and invalid URLs setting fails. (which is what we want).

- Check that the old /edit/profile/ address redirects to /u/USER/edit/.
- Check that /u/USER/edit/ works as expected
- Check that /u/OTHERUSER/edit/ fails with a 403 Forbidden error when we
  are not logged in as that user. The last remaining test that would be
  useful is to make a user an admin and make sure the admin can edit
  other users' profiles.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoEnable /u/USERNAME/edit/ pattern #588
Sebastian Spaeth [Mon, 7 Jan 2013 15:18:45 +0000 (16:18 +0100)]
Enable /u/USERNAME/edit/ pattern #588

Transition from the inconsistent /edit/profile/?username=FOO to
the nicer /u/FOO/edit/. The old pattern will still work and
redirects to the new URL.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoFix tests on webtest < 1.3.6.
Elrond [Tue, 8 Jan 2013 23:19:24 +0000 (00:19 +0100)]
Fix tests on webtest < 1.3.6.

Debian testing ships webtest 1.3.4. And it would be nice to
use the base packages.

One of the csrf tests fails on webtest < 1.3.6.
But using a fresh app fixes it.
We have no clue, why exactly.

When we require webtest 1.3.6, change this.

11 years agoMove db.sql.migration_tools to db.migration_tools.
Elrond [Tue, 8 Jan 2013 21:12:16 +0000 (22:12 +0100)]
Move db.sql.migration_tools to db.migration_tools.

Follow the new trend.

11 years agoAdd inspect_table.
Elrond [Thu, 13 Dec 2012 11:35:27 +0000 (12:35 +0100)]
Add inspect_table.

In our current scheme of migrations, we reflect the current
sql schema into an SQLAlchemy schema. So let's have a tool
function for this.

11 years agoMove all the migration tools into new migration_tools.py
Elrond [Thu, 13 Dec 2012 11:31:47 +0000 (12:31 +0100)]
Move all the migration tools into new migration_tools.py

Factor all the migration related stuff out into a new
.db.sql.migration_tools.
First we don't have to load this module for our normal
server.
Second it makes all the import dependencies a little more
cleaner.

11 years agoFixing import to mediagoblin.db.base in stl models
Christopher Allan Webber [Tue, 8 Jan 2013 19:24:27 +0000 (13:24 -0600)]
Fixing import to mediagoblin.db.base in stl models

Previously we had mediagoblin.db.sql.base, that just changed to drop
the sql; fixing.

11 years agoMerge branch 'WIP/test_performance'
Sebastian Spaeth [Tue, 8 Jan 2013 15:57:15 +0000 (16:57 +0100)]
Merge branch 'WIP/test_performance'

11 years agotests: More instances where a fresh database is not needed
Sebastian Spaeth [Tue, 8 Jan 2013 12:31:16 +0000 (13:31 +0100)]
tests: More instances where a fresh database is not needed

Save test runtime by not dumping the databases when not needed.

11 years agoAudio and video should use workbench instead of tempfiles (#561)
Sebastian Spaeth [Wed, 12 Dec 2012 13:44:10 +0000 (14:44 +0100)]
Audio and video should use workbench instead of tempfiles (#561)

We were using lots of tempfiles in the audio and video processing
backends which worked around our workbench system. Still use the
tempfiles package but create them in the workbench directory. This
can help address the uploads of large files (#419) where /tmp might
be a smallish tmpfs and our workbench a real disk.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoDon't read full image media into RAM on copying (#419)
Sebastian Spaeth [Wed, 19 Dec 2012 13:18:03 +0000 (14:18 +0100)]
Don't read full image media into RAM on copying (#419)

We copy uploaded media from the queue store to the local workbench
and then to its final destination. The latter was done by simply:
dst.write(src.read()) which is of course evil as it reads the whole
file content into RAM. Which *might* arguably still be OK for
images, but you never know.

Make use of the provided storage() methods that offer chunked copying
rather than opening and fudging with files ourselves.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoDon't get a fresh app when not needed
Sebastian Spaeth [Tue, 8 Jan 2013 10:57:25 +0000 (11:57 +0100)]
Don't get a fresh app when not needed

These tests, don't need fresh databases, so don't discard and recreate
the tables. This reduces test suite runtime on my laptop from 130 to 96
seconds.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoDo not fail is a user exists already
Sebastian Spaeth [Tue, 8 Jan 2013 09:22:13 +0000 (10:22 +0100)]
Do not fail is a user exists already

When the tests want to create a new user, don't fail if it already
exists and just reuse the existing one. This allows us to run tests
without dumping the whole database if that is not needed for the tests.
The upcoming tests for test_edit will make use of this.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoFix slug lookup regression (#587)
Sebastian Spaeth [Tue, 8 Jan 2013 07:59:32 +0000 (08:59 +0100)]
Fix slug lookup regression (#587)

Removing the Mongo InvalidID legacy code removed an explicit check for
"int" for the id lookup. This led the @get_user_media_entry decorator to
fail if we looked up a nonexisting non-numerical slug (it tried to query
the id with a string, which failed). Cast id to int and return 404 in
case it is non-numeric which fixes the regression. It does not fix the
underlying problem of slug_or_id lookups that were discussed.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoMade the airy header element responsive again
Joar Wandborg [Mon, 7 Jan 2013 20:33:43 +0000 (21:33 +0100)]
Made the airy header element responsive again

11 years agoRemove custom GMQuery class
Sebastian Spaeth [Mon, 7 Jan 2013 12:52:14 +0000 (13:52 +0100)]
Remove custom GMQuery class

We provided a custom GMQuery class that offered a .sort() method for
compatibility with the Mongo syntax. Now that we have settled for sqlalchemy
which uses the order_by() method, we can safely remove this custom class
and move a little closer to "pure" and native sqlalchemy usage.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoMv db.sql.base to db.base
Sebastian Spaeth [Mon, 7 Jan 2013 12:03:51 +0000 (13:03 +0100)]
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.

11 years agoMove mediagoblin.db.sql.extratypes to mediagoblin.db.extratypes
Sebastian Spaeth [Mon, 7 Jan 2013 12:03:33 +0000 (13:03 +0100)]
Move mediagoblin.db.sql.extratypes to mediagoblin.db.extratypes

No other functional changes.

11 years agoMove db.sql.models* to db.models*
Sebastian Spaeth [Fri, 30 Nov 2012 09:10:35 +0000 (10:10 +0100)]
Move db.sql.models* to db.models*

11 years agoMove db.sql.util to db.util
Sebastian Spaeth [Fri, 30 Nov 2012 08:49:45 +0000 (09:49 +0100)]
Move db.sql.util to db.util

Now that sqlalchemy is providing the database abstractions, there is no
need to hide everything in db.sql. sub-modules. It complicates the code
and provides a futher layer of indirection.

Move the db.sql.util.py to db.util.py and adapt the importers.

11 years agoRemove mediagoblin.db.sql.fake.DESCENDING
Sebastian Spaeth [Mon, 7 Jan 2013 10:15:04 +0000 (11:15 +0100)]
Remove mediagoblin.db.sql.fake.DESCENDING

This is the last remnant that requires us to keep db.sql.fake.py. Use
ModelName.desc() or sqlalchemy.sql.expression.desc(column) to achieve
descending sorts.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoAlso make slug unit test work with the new optionally-translitcodec-free code
Christopher Allan Webber [Mon, 7 Jan 2013 03:46:38 +0000 (21:46 -0600)]
Also make slug unit test work with the new optionally-translitcodec-free code

11 years agoMake translitcodec optional, and work nicely without it.
Christopher Allan Webber [Mon, 7 Jan 2013 03:41:08 +0000 (21:41 -0600)]
Make translitcodec optional, and work nicely without it.

11 years agoMade api_test use @require_active_login
Joar Wandborg [Wed, 2 Jan 2013 19:05:07 +0000 (20:05 +0100)]
Made api_test use @require_active_login

11 years agoprepare_queue_task: Take app not request.
Elrond [Wed, 26 Dec 2012 22:40:42 +0000 (23:40 +0100)]
prepare_queue_task: Take app not request.

First rename prepare_entry to prepare_queue_task, because
this is really more like what this thing does.

Thanks to Velmont for noting that we do not need a request
in here, but an "app" is good enough. Which means, that
this stuff can be called from tool scripts too.

11 years agoupload refactor: Use prepare_entry in api.
Elrond [Tue, 18 Dec 2012 11:32:42 +0000 (12:32 +0100)]
upload refactor: Use prepare_entry in api.

11 years agoUse run_process_media in the api.
Elrond [Tue, 18 Dec 2012 11:24:10 +0000 (12:24 +0100)]
Use run_process_media in the api.

Now refactor in the api. Start with run_process_media.

11 years agoProcessing: Factor out prepare_entry.
Elrond [Mon, 17 Dec 2012 19:05:37 +0000 (20:05 +0100)]
Processing: Factor out prepare_entry.

prepare_entry handles the task_id setup and generating a
queue filename and file. it returns the queue file.

11 years agoFactor out the actual calling of the processing.
Elrond [Mon, 17 Dec 2012 18:54:26 +0000 (19:54 +0100)]
Factor out the actual calling of the processing.

Calling the processing task and handling the exceptions is
easy, but has a bunch of caveats, so factor it out into an
easy callable function.

11 years agoupload refactor: push url handling
Elrond [Mon, 17 Dec 2012 18:42:31 +0000 (19:42 +0100)]
upload refactor: push url handling

Start to refactor our upload handling in main submit and
the api. Start factoring out the handling of PuSH url
handling.

11 years agoBug #584, upgrade EXIF.py from master to read Nikon data
Odin Hørthe Omdal [Wed, 26 Dec 2012 15:16:33 +0000 (16:16 +0100)]
Bug #584, upgrade EXIF.py from master to read Nikon data

11 years agoFix up symlinks in exif bump
Sebastian Spaeth [Wed, 26 Dec 2012 09:21:45 +0000 (10:21 +0100)]
Fix up symlinks in exif bump

Previous exif bump copied the newer version into
mediagoblin/tools/extlib/exif but not in extlib/exif. Fix this by
bumping extlib/exif and symlinking to tools/extlib/exif.

Do note that this is still the version fetched from http://sourceforge.net/projects/exif-py/
while the upstream maintainer seems to be active on:
https://github.com/ianare/exif-py

(The sf.net download is quite new though)

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoRemove ObjectId from the tree
Sebastian Spaeth [Tue, 25 Dec 2012 19:52:25 +0000 (20:52 +0100)]
Remove ObjectId from the tree

This was one of the last remaining Mongo holdouts and has been removed from
the tree herewith. Good bye, ObjectId.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoRemove temporary emacs files that have slipped in
Sebastian Spaeth [Tue, 25 Dec 2012 19:45:59 +0000 (20:45 +0100)]
Remove temporary emacs files that have slipped in

Thanks Elrond for hilighting this :-)

11 years agoRemove InvalidId
Sebastian Spaeth [Tue, 25 Dec 2012 19:28:19 +0000 (20:28 +0100)]
Remove InvalidId

It was a NoOp in our Non-mongo world. So it is safe to remove.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoMove db.sql.migrations to db.migrations
Sebastian Spaeth [Fri, 30 Nov 2012 09:03:53 +0000 (10:03 +0100)]
Move db.sql.migrations to db.migrations

11 years agoMove db.sql.open to db.open
Sebastian Spaeth [Fri, 30 Nov 2012 08:32:25 +0000 (09:32 +0100)]
Move db.sql.open to db.open

Now that mongo has been ripped out and sqlalchemy is already providing
the database abstraction, there is no need to hide everything in the sql
module. Transition db.sql.open to db.open and adapt all direct importers.

11 years agoRIP out mongo
Sebastian Spaeth [Thu, 29 Nov 2012 16:23:28 +0000 (17:23 +0100)]
RIP out mongo

Since sqlalchemy is providing our database abstraction and we have
moved away from Mongo as the underlying database, it is now time to
simplify things and rip out mongo. This provides the bulk of the
changes, and can stand on its own. There are some followup tasks
that can be done, such as removing now unneeded abstraction layers,
e.g. db.sql.fake.py

11 years agoUpdate extlib/EXIF
Sebastian Spaeth [Mon, 19 Nov 2012 16:38:46 +0000 (17:38 +0100)]
Update extlib/EXIF

Bump bundled EXIF lib to 1.0.10 as release in Sep 2012.
Also skip unused detailed EXIF tags for reading, we might turn that
on when we need them.

Adapt test to wording change in EXIF Flas field and due to the fact
that we use "details=False" by default now (we did not use these
anyway)

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoMerge branch '512_bump_video_js'
Sebastian Spaeth [Tue, 25 Dec 2012 18:18:23 +0000 (19:18 +0100)]
Merge branch '512_bump_video_js'

11 years agoBump bundled video.js to v3.2.3 (#512)
Sebastian Spaeth [Thu, 20 Dec 2012 08:07:59 +0000 (09:07 +0100)]
Bump bundled video.js to v3.2.3 (#512)

There is nothing inherently wrong with the currently bundled version,
but the last one was uploaded in March 2012 and there have been
upstream releases since. So bump to the latest available release 3.2.3.

Might help with the reported issue 512 of an unresponsive video player.

Do note that the Flash fallback option is removed. If we decide
this should be added it is easy to add it back.

We still use our own customized theme.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agomakeadmin and changepasswd had swapped help text
Christopher Allan Webber [Tue, 18 Dec 2012 22:46:20 +0000 (16:46 -0600)]
makeadmin and changepasswd had swapped help text

11 years ago(SQL) Media types: Refactor backrefnames.
Elrond [Mon, 17 Dec 2012 16:36:34 +0000 (17:36 +0100)]
(SQL) Media types: Refactor backrefnames.

We need to know the name of the backref, so that we can
access it by name on the MediaEntry. We might be able to
get this name by inspection, but this way is easier, for
now.

11 years agoRemove mongo style .id = ObjectId()
Elrond [Sun, 23 Dec 2012 20:44:05 +0000 (21:44 +0100)]
Remove mongo style .id = ObjectId()

On SQL we can't generate the primary key on our own. So
just remove this stuff.

11 years agoMongo removal: Remove the validate=True arg to obj.save()
Elrond [Sun, 23 Dec 2012 20:01:13 +0000 (21:01 +0100)]
Mongo removal: Remove the validate=True arg to obj.save()

all callers were forced to use validate=True anyway. So
remove this useless stuff.

11 years agoFix some unicode related issues in oauth and the api.
Elrond [Sun, 23 Dec 2012 22:55:44 +0000 (23:55 +0100)]
Fix some unicode related issues in oauth and the api.

Found using the previous commit.

11 years agoTestsuite: Turn SQLAlchemy warnings into errors
Elrond [Sun, 23 Dec 2012 22:52:08 +0000 (23:52 +0100)]
Testsuite: Turn SQLAlchemy warnings into errors

We should handle SQLAlchemy warnings. And to make that a
lot easier, turn them into real errors. That way they
1) Turn up more prominently.
2) Have a useful backtrace.

This only happens in the testsuite, so that normal useage
is not impacted.

11 years agoAdded API tests
Joar Wandborg [Sat, 22 Dec 2012 23:34:27 +0000 (00:34 +0100)]
Added API tests

11 years agoRewrite routing using new MGRoute class
Elrond [Sat, 15 Dec 2012 23:45:57 +0000 (00:45 +0100)]
Rewrite routing using new MGRoute class

MGRoute subclasses Rule():
Rule doesn't have a way to tag extra data, like the
controller function, we need. So MGRoute has a new
attribute .gmg_controller, which holds this.

Rewrite everything to use this new Rule variant and drop
all the other stuff that mapped endpoints to controller
functions, mostly.

11 years agoRewrite routing.py / get_url_map
Elrond [Sat, 15 Dec 2012 20:30:13 +0000 (21:30 +0100)]
Rewrite routing.py / get_url_map

Move most of the "init routing" code inside get_url_map().
Maybe not the best solution, but better than running the
init code directly at module load time.

11 years agoMove things from routing.py to tools/routing.py
Elrond [Sat, 15 Dec 2012 23:50:20 +0000 (00:50 +0100)]
Move things from routing.py to tools/routing.py

This stops a cyclic import.

Move add_route, mount and endpoint_to_controller into
tools/routing.py and change all callers.

11 years agoRefactor routing in app.py.
Elrond [Sat, 1 Dec 2012 20:36:18 +0000 (21:36 +0100)]
Refactor routing in app.py.

Move some things out of app.py into functions in
routing.py. This makes app.py a bit more readable and
allows us to rewrite routing.

11 years agoCompare user by id not object equality
Sebastian Spaeth [Sun, 23 Dec 2012 11:12:11 +0000 (12:12 +0100)]
Compare user by id not object equality

Elrond correctly remarked that we should be comparing user by id
and not by comparing User objects (as I mistakenly did). He is
right, of course!

Also removing the 2 stray debug prints that were left over.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoImprove sqlalchemy filter rules
Sebastian Spaeth [Sun, 23 Dec 2012 11:08:51 +0000 (12:08 +0100)]
Improve sqlalchemy filter rules

Thanks to Elrond's review. 1) Use filter_by more consistently
rather than mixing filter and filter_by. 2) Add multiple AND
conditions in the same filter rule rather than using separate
ones. 3) The atom feeds used filter_by(Modelname.attr == ...)
which was the wrong pattern, of course.

Thanks for repairing my junk Elrond!

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoConvert return HttpException to raise HttpException
Sebastian Spaeth [Sun, 23 Dec 2012 10:58:51 +0000 (11:58 +0100)]
Convert return HttpException to raise HttpException

controllers (view function) raise HttpException's and do not return them.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoProvide tools.response.render_http_exception and use that
Sebastian Spaeth [Sun, 23 Dec 2012 10:57:45 +0000 (11:57 +0100)]
Provide tools.response.render_http_exception and use that

After the webob->werkzeug transition, controller functions can raise
werkzeug.HttpExceptions. We need to catch these in app.py when calling
the controller and handle them, rendering the corresponding error Response()
object. For consistency, we also want to allow meddleware functions to
raise HttpExceptions (e.g. the csrf meddleware needs to complain about lack
of cookies), so wrap the request and response parts of the meddleware too.

Finally, the urlmap.match() can also raise HttpExceptions, so we give it the
same treatment (render_http_exception). I am not sure, if we do not need to
handle the Redirect exception there in any different way though...

The new function render_http_exception makes use of the render_error infrastructure
to return a nicely templated error page. It also checks if the stock error
messages was used in cases where we have localizations (403, 404) and use those.

It is now possible to do things like "raise Forbidden(_('You suckr'))" or
raise NotFound(_('where is my left show again')) if you want to return
customized error messages to the user.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoRevert accidental checkin
Sebastian Spaeth [Sat, 22 Dec 2012 11:05:03 +0000 (12:05 +0100)]
Revert accidental checkin

Commit 8d19cb2445e2aa1f53431da26d866bf9b5e25872 accidentally included
my docs/source/build directory. Removing it again. Thanks to Elrond for
noticing.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoWe're in 0.3.3.dev territory now.
Christopher Allan Webber [Fri, 21 Dec 2012 15:08:52 +0000 (09:08 -0600)]
We're in 0.3.3.dev territory now.

11 years agoRemove mongolisms from auth.views
Sebastian Spaeth [Fri, 21 Dec 2012 09:35:05 +0000 (10:35 +0100)]
Remove mongolisms from auth.views

Remove find find_one etc and use sqlalchemy syntax

11 years agoRemove Mongoism query.skip()
Sebastian Spaeth [Mon, 17 Dec 2012 11:56:29 +0000 (12:56 +0100)]
Remove Mongoism query.skip()

sqlalchemy supports slice() or [n:m] just fine.

Right now, it seems we cannot distinguish beween "empty" results
and out-of bound slices. It would be nice if we could distinguish
these somehow.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoRemove mongolisms from user_pages.view #451
Sebastian Spaeth [Fri, 21 Dec 2012 10:25:38 +0000 (11:25 +0100)]
Remove mongolisms from user_pages.view #451

11 years agoRefactor media_collect
Sebastian Spaeth [Fri, 21 Dec 2012 10:25:13 +0000 (11:25 +0100)]
Refactor media_collect

Remove lots of MOngolisms. Refactor this to remove some indentation
levels. Don't do:
 if success:
   ...
   if success:
     ....
     if success:
     ...

11 years agoMerge branch '577_denoise_video_transcoding'
Sebastian Spaeth [Fri, 21 Dec 2012 08:11:21 +0000 (09:11 +0100)]
Merge branch '577_denoise_video_transcoding'

11 years agoDon't dbug log every added plugin route
Sebastian Spaeth [Fri, 21 Dec 2012 07:20:54 +0000 (08:20 +0100)]
Don't dbug log every added plugin route

It is killing testsuite output by drowning out all signals. It should
be sufficient to state in the pluginmanager that routes have been added,
if we need that kind of output.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
11 years agoDon't require webob as dependency
Sebastian Spaeth [Fri, 16 Nov 2012 10:32:35 +0000 (11:32 +0100)]
Don't require webob as dependency

It is pushing up the daisies. Also relnote the change.