Sebastian Spaeth [Tue, 22 Jan 2013 21:18:08 +0000 (22:18 +0100)]
user.get('moo') -> user.moo
User fields are always existent, so there is no need to .get() them,
just use them directly.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Christopher Allan Webber [Tue, 22 Jan 2013 19:43:02 +0000 (13:43 -0600)]
Merge remote-tracking branch 'refs/remotes/spaetz/521_license_preference' into mergetest
Joar Wandborg [Tue, 22 Jan 2013 13:38:53 +0000 (14:38 +0100)]
Moved MediaComment form descriptions to apt. place
Sebastian Spaeth [Mon, 21 Jan 2013 15:27:19 +0000 (16:27 +0100)]
Also set login_failed in case of form errors
If we send a POST request to the login page which contained form errors
(e.g. a too short password), the variable "login_failed" was not set to
true. This condition was tested by the test suite however, so we should
make sure that login_failed is set even if the form failed to validate.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Sebastian Spaeth [Mon, 7 Jan 2013 09:17:52 +0000 (10:17 +0100)]
Restructure ForgotPassword view
1) Remove mongo limitations (no 'or' when querying for either username
or email).
2) Lost password function revealed if an user name or email address
is registered, which can be considered a data leak.
Leaking user names is OK, they are public anyway, but don't reveal
lookup success in case the lookup happened by email address.
Simply respond: "If you have an account here, we have send you
your email"?
3) username and email search was case sensitive. Made username search
case insensitive (they are always stored lowercase in the db).
Keep email-address search case sensitive for now. This might need
further discussion
4) Remove a whole bunch of indention in the style of:
if no error:
...
if no error:
...
if no error:
actually do something in the regular case
by restructuring the function.
5) Outsource the sanity checking for username and email fields into the
validator function. This way, we get automatic case sanity checking
and sanitizing for all required fields.
6) Require 5-char password and fix tests
Originally, the Change password form required a password between 6-30
chars while the registration and login form did not require anything
special. This commit introduces a common minimum limit for all forms
which breaks the test suite which uses a 5 char password by
default. :-). As 5 chars seem sensible enough to enforce (people
should be picking much longer ones anyway), just reduce the limit to
5 chars, thereby making all tests pass.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Sebastian Spaeth [Mon, 7 Jan 2013 09:16:20 +0000 (10:16 +0100)]
Normalize the email address in the same way in all places
We were case normalizing the email address for registration, but not at
all for the forgotten password retrieval. Make a
tools.mail.normalize_email helper that can be used to normalize the
email in the same way in all places.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Christopher Allan Webber [Sun, 20 Jan 2013 19:13:39 +0000 (13:13 -0600)]
Merge remote-tracking branch 'refs/remotes/spaetz/436_celery_push'
Sebastian Spaeth [Wed, 9 Jan 2013 11:38:08 +0000 (12:38 +0100)]
Sanitize slug input on media edit
Previously we allowed EVERYTHING, even slashes as slug when editing the media.
Make sure we slugify the input to sanitize it.
(+ string formdata is unicode, so there is no need to convert it)
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Elrond [Fri, 18 Jan 2013 20:17:52 +0000 (21:17 +0100)]
Add (failing) test for editing the slug.
This test fails, because it tries to set a slug with an "="
in it. And tests that the "=" gets replaced by "-".
Well, it currently is not being replaced.
The next (cherry picked) commit by Sebastian Spaeth fixes
this test!
Elrond [Fri, 18 Jan 2013 17:42:52 +0000 (18:42 +0100)]
Enable foreign key checking on sqlite.
sqlite normally does not check foreign key referential
integrity. But it can do so.
So let's use it. Better safe than sorry.
Elrond [Fri, 18 Jan 2013 12:05:57 +0000 (13:05 +0100)]
Turn comment list into a real <ul>.
Well, I like semantic html. And the list of comments, well,
is now a list: <ul>.
Using list-style:none it looks nearly the same as before.
Elrond [Fri, 18 Jan 2013 10:42:56 +0000 (11:42 +0100)]
Add some simple collection test.
Elrond [Fri, 18 Jan 2013 10:40:40 +0000 (11:40 +0100)]
Rename get_test_app to get_app.
nosetests runs everything that even vaguely looks like a
test case... even our get_test_app. And as it is imported
everywhere... it is run everywhere as a test case. Renaming
it saves us about 10+ tests and a few seconds of time.
Elrond [Thu, 17 Jan 2013 22:55:49 +0000 (23:55 +0100)]
Remove useless spaces in comment stuff.
When rendering a comment, we had a lot of whitespace. And
some of it made it into the rendered page:
"""<a href=...>abc </a>""" the trailing space gets
rendered and looks ugly.
Elrond [Thu, 17 Jan 2013 22:54:48 +0000 (23:54 +0100)]
Translate account deletion.
Mark all the strings in the new account deletion stuff for
translation.
Elrond [Thu, 17 Jan 2013 22:50:51 +0000 (23:50 +0100)]
Fix linking to comments.
when linking to a comment in a MediaEntry, the page did not
contain a <a name="comment"> because, well:
We fetched a string comment-id from the routing. And the
pagination code tried to compare that to the int id on the
comment.
Fix is to let routing fetch an int from the url. Easy.
Relatedly remove duplicated comment_id fetching from the
URL in the view.
Christopher Allan Webber [Thu, 17 Jan 2013 21:51:30 +0000 (15:51 -0600)]
Merge branch 'master' of gitorious.org:mediagoblin/mediagoblin
Sebastian Spaeth [Thu, 17 Jan 2013 21:37:41 +0000 (22:37 +0100)]
Return to media collection page if no collection selected
schendje rightly pointed out that we should not return to the media
homepage if we did not select a collection on the "collect" page, but
should actually return to the collect page.
This is an improvement of the user experience ;-)
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Elrond [Thu, 17 Jan 2013 21:10:43 +0000 (22:10 +0100)]
Move workbench into tools directory.
Elrond [Wed, 16 Jan 2013 18:50:48 +0000 (19:50 +0100)]
Remove DEFAULT_WORKBENCH_DIR.
We never used this.
Removed, as okayed by cwebber.
Christopher Allan Webber [Thu, 17 Jan 2013 21:02:52 +0000 (15:02 -0600)]
Merge remote-tracking branch 'refs/remotes/spaetz/565_workbench_cleanup'
Mark Holmquist [Sun, 11 Nov 2012 00:59:37 +0000 (16:59 -0800)]
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>
Jef van Schendel [Thu, 17 Jan 2013 19:04:22 +0000 (20:04 +0100)]
Add "Browse collections" link to profile pages
Christopher Allan Webber [Thu, 17 Jan 2013 17:53:32 +0000 (11:53 -0600)]
adding back dropdown.js now that we have, well, a dropdown again :)
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
Christopher Allan Webber [Thu, 17 Jan 2013 17:12:13 +0000 (11:12 -0600)]
Merge commit '
9408938' from 565_workbench_cleanup (spaetz)
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
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
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>
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>
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>
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>
Sebastian Spaeth [Thu, 17 Jan 2013 10:52:22 +0000 (11:52 +0100)]
Merge branch '540_User_delete_deletes_related_entries'
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)
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>
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>
Sebastian Spaeth [Wed, 19 Dec 2012 14:03:43 +0000 (15:03 +0100)]
Do not read complete videos in RAM (#419)
We were reading the complete "medium" "thumbnail" and "original"
in RAM via dst.write(src.read()). Just call the appropriate storage
methods copy_local_to_storage which are responsible for streaming
local files efficiently.
The efficiency of this patch depends on the separate branch that
actually implements chunked copying for Storage().copy_local_to_storage()
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>
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>
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>
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>
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>
Christopher Allan Webber [Wed, 16 Jan 2013 18:12:57 +0000 (12:12 -0600)]
Make the workbench destroy itself for video processing also.
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'
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'
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.
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
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
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
Tiberiu C. Turbureanu [Tue, 15 Jan 2013 16:03:06 +0000 (18:03 +0200)]
#571: Fixed. Display collection description with Markdown formatting.
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>
Sebastian Spaeth [Tue, 15 Jan 2013 14:03:00 +0000 (15:03 +0100)]
Don't pass request into run_process_media
People(tm) want to start run_process_media from the CLI and might not
have a request object handy. So pass in the feed_url into
run_process_media rather than the request object and allow the feed url
to be empty (resulting in no PuSH notification at all then).
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Sebastian Spaeth [Tue, 15 Jan 2013 13:41:30 +0000 (14:41 +0100)]
Make PuSHing the Pubhubsubbub server an async task (#436, #585)
Notifying the PuSH servers had 3 problems.
1) it was done immediately after sending of the processing task to celery. So if celery was run in a separate
process we would notify the PuSH servers before the new media was processed/
visible. (#436)
2) Notification code was called in submit/views.py, so submitting via the
API never resulted in notifications. (#585)
3) If Notifying the PuSH server failed, we would never retry.
The solution was to make the PuSH notification an asynchronous subtask. This
way: 1) it will only be called once async processing has finished, 2) it
is in the main processing code path, so even API calls will result in
notifications, and 3) We retry 3 times in case of failure before giving up.
If the server is in a separate process, we will wait 3x 2 minutes before
retrying the notification.
The only downside is that the celery server needs to have access to the internet
to ping the PuSH server. If that is a problem, we need to make the task belong
to a special group of celery servers that has access to the internet.
As a side effect, I believe I removed the limitation that prevented us from
upgrading celery.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
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>
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>
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.
Elrond [Sun, 16 Dec 2012 13:08:38 +0000 (14:08 +0100)]
Use the new logo.html thingy in airy.
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.
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.
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.
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".
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.
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>
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>
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.
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.
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.
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.
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.
Sebastian Spaeth [Tue, 8 Jan 2013 15:57:15 +0000 (16:57 +0100)]
Merge branch 'WIP/test_performance'
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.
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>
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>
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>
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>
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>
Joar Wandborg [Mon, 7 Jan 2013 20:33:43 +0000 (21:33 +0100)]
Made the airy header element responsive again
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>
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.
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.
Sebastian Spaeth [Fri, 30 Nov 2012 09:10:35 +0000 (10:10 +0100)]
Move db.sql.models* to db.models*
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.
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>
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
Christopher Allan Webber [Mon, 7 Jan 2013 03:41:08 +0000 (21:41 -0600)]
Make translitcodec optional, and work nicely without it.
Joar Wandborg [Wed, 2 Jan 2013 19:05:07 +0000 (20:05 +0100)]
Made api_test use @require_active_login
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.
Elrond [Tue, 18 Dec 2012 11:32:42 +0000 (12:32 +0100)]
upload refactor: Use prepare_entry in 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.
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.
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.
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.
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
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>
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>
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 :-)
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>
Sebastian Spaeth [Fri, 30 Nov 2012 09:03:53 +0000 (10:03 +0100)]
Move db.sql.migrations to db.migrations
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.
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