We accidentally used the fake translation mechanism here which will not
actually translate anything.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
The oauth plugin used timedelta.total_seconds which was introduced
in python 2.7 only. To preserve backwards compatability, we simply
calculate the time difference in seconds manually.
I considered monkeypatching total_seconds to the timedelta object,
but it is a built-in type written in C (I believe) and modifying
attributes failed horribly. Switch this to use total_seconds once we
require python 2.7 as minimum version.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This button used to be a css style <a href=...> </a> (note:
No contents for the <a>). Using this approach has various
drawbacks. Most notably:
- Not clickable in text mode browsers
- Possibly getting marked as a hidden (spam) link
- No alt attribute
So replaced with a real <img/>.
I have no idea what to put in the alt attribute.
No point in translating <p>{{ var }}</p>. Really.
This does not hurt the string freeze, as it removes a
translateable string. So any translations of this string
are just well ... usefuless afterwards.
We had """<a href="abc.dat"> abc.dat</a>""" (note the
apace). And this space is being rendered as a link by
browsers. This looks strange, really.
So fix the spacing.
Pass in unicode not (binary) strings where sqlite expects unicode
values to prevent the test suite from (correctly) complaining about
errors.
I now pass the full suite without any complaints.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
These tests output noisy sql complaints about receiving non-unicode
for an unicode field. This was ... well ... because we were handing
in non-unicode usernames and passwords.
Prefixing usernames/passwords with u'' makes the testsuite less noisy
and verbose.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
CSRF tests apparently passed with earlier versions of webtest, but
failed with the latest webtest (1.4.0) package. It choked on passing
a "key=value; " cookie as it split at the semicolon and failed to
find additional values or something like that. Removing the semicolon
makes this test pass.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
The reason for wanting to give extra information to the user (this is
a very special case migration) is good, but we don't have a nice
"official" way to capture and present that information during tests,
so removing this.
_fix_query_dict modifies its argument in place. Ensure that the
argument passed in has a local name and will be passed into the
subsequent filter_by call.
We were fetching the user collection gallery by slug only, so if two users
had the same collection slug, we would not have been sure which one we'd get.
Fix this by explicitly only fetching the specific user's collections. Also
switch over the view function to make use of the new active_user_from_url
decorator that fetches the User() object for us.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This switches the user gallery page over to use the new decorator, and
cleans up the queries to be in proper sqlalchemy format rather than the
old mongo format.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This can be used for URL patterns containing a <user> element. It will look
up the corresponding user among all active users and return a 404 NOT FOUND
page if there is no such active user. It then passes the User() instance as
url_user keyword argument to the decorated view function.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
We injected a gridify_list and gridify_cursor function into each jinja2
template that we render. This was used to split the list of media_entries
into batches of 5 for nicer table columns. However, jinja2 has a nice |batch
filter built in that does the job for us just as well with less code (on our side)
Less code=good
so let's merge this one.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
In all cases where get_media_manager(_media_type_as_string) was called in
our code base we ultimately passed in a "MediaEntry().media_type" to get
the matching MEDIA_MANAGER. It so makes sense to make this a function of
the MediaEntry rather than a global function in mediagoblin.media_types and
passing around media_entry.media_type as arguments all the time.
It saves a few import statements and arguments. I also made it so the
Media_manager property is cached for subsequent calls, although I am not too
sure that this is needed (there are other cases for which this would make
more sense)
Also add a get_media_manager test to the media submission tests. It submits
an image and checks that both media.media_type and media.media_manager
return the right thing. Not sure if these tests could not be merged with an
existing submission test, but it can't hurt to have things explicit.
TODO: Right now we iterate through all existing media_managers to find the
right one based on the string of its module name. This should be made a simple
dict lookup to avoid all the extra work.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
E.g. in our test suite we don't send an "accepted languages" header, which
caused the language matching to fail. So we need to explicitely fallback to
en_US, in case request.accepted_languages is None. This fixes the tests and
all cases where user browsers don't send preferred languages.
This also fixes issue #562, the AVAILABLE_LOCALES are already case-normalized
and we don't need to fudge the preferred language through the lower_upper_locale
thing for each and every request.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Previously the .blend and .py files had to be in the same directory
mediagoblin/celery launched from. This is now fixed so it pulls them
out of the package proper.