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.
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>
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>
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.
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
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>
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>
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.
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.
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.
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.
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>
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>
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>
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>
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>
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>
Remove the aliases we provided for webob compatability as webob is
now gone. Grepped the code base to check for occurences of the old
parameters to be safe. Keep request.GET attribute as alias for
request.args as it is often used and django is also using that
attribute.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
The werkzeug.Response().headers do not offer an update() method as
the same key can be twice in the header 'dict'. Thus, iterate over
the header keys and use header.set(key, value) which replaces an
existing header key.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Replace webob usage in one more file. Document a TODO that should
be clarified, we should probably be using json_response rather than
Response() here.
Modify the TestMeddleware to not rely on the content_type attribute
being present, while werkzeug.wrappers Response() has it the BaseResponse()
object which is often returned in tests does not have it.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
webob's 404 status is "404 NOT FOUND" while werkzeug's is
"404 Not Found". Our test suite was checking the upper case string
for equality. Just test the status error code "404" rather than the
full string which might change at some points/versions and should
not need to be tested.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>