2666 Commits

Author SHA1 Message Date
Sebastian Spaeth
ad7420281c Create a active_user_from_url decorator
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>
2012-12-05 13:37:19 +01:00
Jef van Schendel
75a086dafa Add header_dropdown.js 2012-12-04 21:12:00 +01:00
Jef van Schendel
209bfb35cd Edit header styling (add border-bottom, remove background-color); add margin to header_dropdown 2012-12-04 21:11:42 +01:00
Sebastian Spaeth
2222278dcd Remove gridify_*
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>
2012-12-04 17:31:12 +01:00
Christopher Allan Webber
1244ffc8f5 We arean't using header_dropdown.js anymore because the dropdown is gone! 2012-12-04 09:35:07 -06:00
Sebastian Spaeth
5f8b4ae895 make media_manager a property of MediaEntry in mixin.py
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>
2012-12-04 15:15:41 +01:00
Sebastian Spaeth
c39b9afc83 Fallback to "en_US" if browser does not send preferred languages
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>
2012-12-04 09:44:07 +01:00
Christopher Allan Webber
78d932e792 Moving thingiview.js into extlib/ 2012-12-03 14:57:52 -06:00
Christopher Allan Webber
e7e435342a Switch stl processing over to using the workbench
Previously this was writing directly to the public store... that won't
work with cloudfiles backend, for example :)
2012-12-03 14:40:49 -06:00
Christopher Allan Webber
c31a501066 Correcting minor typo in exception string: Empyt->Empty 2012-12-03 14:40:49 -06:00
Christopher Allan Webber
7b8af389a9 Removing unused conversions subdir 2012-12-03 14:40:49 -06:00
Christopher Allan Webber
39c340f280 Moving blender render files to be accessed via pkg_resources
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.
2012-12-03 14:40:48 -06:00
Christopher Allan Webber
8bef424f24 Removing render_test.py, which isn't used 2012-12-03 14:40:48 -06:00
Aeva Ntsc
6fbde77313 Removed debug info from the sidebar. 2012-12-03 14:40:48 -06:00
Aeva Ntsc
ee3f876867 tweaking the template 2012-12-03 14:40:48 -06:00
Aeva Ntsc
de69f43aab Fixed the binary stl loader. 2012-12-03 14:40:48 -06:00
Aeva Ntsc
d93eac36fc Disabled thingiview for obj models, since thingiview's support for them seems to be broken. 2012-12-03 14:40:48 -06:00
Aeva Ntsc
d25ed5dd4c Added a table to store the file extension of a model. 2012-12-03 14:40:48 -06:00
Aeva Ntsc
418d1b149b Updated the template for viewing stl models. 2012-12-03 14:40:48 -06:00
Aeva Ntsc
12a104671d Added preview rendering for a bunch of different shots. 2012-12-03 14:40:48 -06:00
Aeva Ntsc
ecee8d62c1 Catching ValueError when trying to use ObjModel on binary stl files. 2012-12-03 14:40:48 -06:00
Aeva Ntsc
8f496712d0 Added script for manually testing the blender renderer. 2012-12-03 14:40:48 -06:00
Aeva Ntsc
1695bdf63e Added blender renderer 2012-12-03 14:40:47 -06:00
Aeva Ntsc
6645c4588b made 3d viewer a little cleaner 2012-12-03 14:40:47 -06:00
Aeva Ntsc
171dcbe3a8 disabled auto rotate 2012-12-03 14:40:47 -06:00
Aeva Ntsc
76918e52e0 Added the stl/obj mediatype. 2012-12-03 14:40:47 -06:00
Aeva Ntsc
62cc81fb99 Added a rudimentary template for the stl/obj viewer. 2012-12-03 14:40:47 -06:00
Aeva Ntsc
2b19fd5135 Added the thingiview.js library. 2012-12-03 14:40:47 -06:00
Aeva Ntsc
47cd2f66b6 Added the thingiview.js library. 2012-12-03 14:40:47 -06:00
Christopher Allan Webber
304934b31d Committing extracted and compiled translations 2012-12-03 13:23:55 -06:00
Christopher Allan Webber
0fa1cbc60e Committing present MediaGoblin translations before pushing extracted messages 2012-12-03 13:23:02 -06:00
Elrond
32255ec015 Fix translations around.
This includes:
- Mark more strings for translation
- Don't mark html-only nonsense for translation
- Mark a better part for translation.
2012-12-03 16:52:35 +01:00
Sebastian Spaeth
d3c6e2a042 Go back to pre-login URL after loging in
Simply append the current URL (sans querystring) as a ?next= parameter
to the login URL. This will always take us back to the original page
where we were pre-login.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-03 14:11:22 +01:00
Sebastian Spaeth
620e4e1b6e Provide jinja2 urlencode filter
Astonishingly, the great jinja2 does not provide a builtin urlquote filter,
although it is obviously needed. (jina1 had one) This is:
https://github.com/mitsuhiko/jinja2/issues/17

Provide an urlencode filter, based on werkzeug's url_quote_plus function.
This is dead easy to implement and gives us all the freedom we want.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-03 14:11:22 +01:00
Sebastian Spaeth
fd7c348415 Add extlibs to packaging
setup.py bdist fails as it can't find the extlib's. DOH, that is because
we don't package them.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-03 13:53:32 +01:00
Sebastian Spaeth
1ac1f00ebe Use pypi-compatible license signature
It complains about a non-compatible license string. so use the
GNU AGPL v3+ string that is listed at
http://pypi.python.org/pypi?%3Aaction=list_classifiers

With this change, we are able to create a  pypi mediagoblin package.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-03 09:32:29 +01:00
Sebastian Spaeth
826919c97c en_US is always available
We were using "en" as fallback only when no preferred language matched.
This is obviously bad. Always insert en_US as available locale, so we
can match it with the accept_languages.

Don't set available_locales as mg_global, per discussion with paroneaya,
make it a global var in translate.py

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-02 02:46:50 +01:00
Christopher Allan Webber
e4e7fbeeaa Fixing bug where not all conditions returned a language in get_locale_from_request()
Just had to change the indentation level of the last commit.
2012-12-01 19:36:52 -06:00
Jef van Schendel
3351e5b242 Fix header width again: this is a better approach 2012-12-02 02:34:29 +01:00
Jef van Schendel
f2578595cd Fix header width issue on small screens 2012-12-02 02:29:29 +01:00
Jef van Schendel
a7d079aca6 Fix small user error 2012-12-02 02:25:53 +01:00
Jef van Schendel
2369feb58a Give elements proper, more descriptive class names 2012-12-02 02:22:18 +01:00
Jef van Schendel
3afe739c41 Several edits to header dropdown:
- Style the up/down arrow as a button
- Remove the Actions header
- Remove redundant original "Add media" button
- Style "Add media" and "Create new collection" links as buttons
2012-12-02 02:19:20 +01:00
Jef van Schendel
5a42915b68 First commit to add header dropdown 2012-12-02 02:13:22 +01:00
Sebastian Spaeth
d53ca5e506 Fall back to "en" if we don't find matching translations
In case of no matching translations, target_lang was "None" which
blew up things. Fall back to "en" in case we don't find a
corresponding translation.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-02 01:39:53 +01:00
Sebastian Spaeth
1aac6a3c3c Also package i18n/*.mo
....
and I wondered why my production site fails to display German pages...

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-02 01:09:35 +01:00
Sebastian Spaeth
6ef75af50e Honor user's browser language (#558)
Previously we would attempt to satisfy the user's first language
preference, immediately falling back to english if that was not
possible. Now, we will get the best match of the user's preferred
languages.

This requires storing the available locales on app startup, so we
have mg_globals.available_locales ready to compare them against the
list of preferred user languages.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-02 00:29:30 +01:00
Sebastian Spaeth
7b9f9d1edb Fix i18n in our browser
We only ever served english pages since the switch to werkzeug's requests.
Fix this by actually checking the accepted languages that our web browser
sends and using that or falling back to english.

This is not optimal, imaging our browser sends "klingon, de" as accepted
languages and we happen to not have a klingon translation ready (a deficiency
that should be corrected immediately anyway!!). We would then fall back
to english rather than sending the sensible and pleasant German language
which the user would understand. This will require more backend work though.

Removing the gettext.find() in mg_globals.py. It looked in the wrong directory
anyway (mediagoblin/translations) and as that does not exist, had always returned
None without anyone noticing.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-01 23:40:10 +01:00
Sebastian Spaeth
7989cd6e49 docs: Add trim_whitespaces plugin to relnotes and documentation
Rather than mentioning a hypothetical module restrictfive, we use the
existing plugin mediagoblin-licenses that people can install. Also,
mention that plugin in the release notes.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-01 20:31:18 +01:00
Sebastian Spaeth
9945468603 trim_whitespace meddleware plugin
Our HTML output is very verbose (=whitespacy) as our templates are
written with an 80 char limit and lots of newlines between blocks,
variables etc....

This is a plugin that naively strips of all but the first whitespace
from the HTML response. We might want to have an all-fancy html tidy
interface here at some point, but it nicely decreases the HTML size
about a third on some simple pages.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-01 20:19:43 +01:00