2387 Commits

Author SHA1 Message Date
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
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
Sebastian Spaeth
a30fb1d89d Make ENABLED_MEDDLEWARES a list and not a tuple, so we can modify it
Plugins may want to insert meddlewares, so this list should be modifiable
at very list (if we don't want to provide helper methods for this, which
seems a tad overkill for now).

This change is required for the upcoming trim_whitespace plugin.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-01 20:19:43 +01:00
Sebastian Spaeth
d7d422ca04 Remove the NoOp meddleware
There is really no reason to provide and enable a meddleware that
does exactly... NOTHING ...by default.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-01 20:19:43 +01:00
Sebastian Spaeth
138a18fd6e Implement licenses.get_license_by_url
Rather than exploding in the user's face (for example if we custom-configure
licenses in our MG instance, and there are still media with now "unknown"
licenses in the db), simply return a License object as a fallback, where all
attributes are set to the URL we were handed.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-11-30 14:31:43 +01:00
Sebastian Spaeth
8e5fae9b43 Improve mediagoblin.tools.licenses
"Objectify" our licenses to have .uri, .abbreviation, .name attributes
that we can pass into the templates and use there. namedtuples are a good
poor man's choice to make a License a class. (a named tuple really)

Document and optimize licenses_as_choices(), it is a one-liner really.
No need for verbose appends here...
2012-11-30 14:31:43 +01:00
Sebastian Spaeth
df1c497609 Use mediagoblin import machinery
Rather than manually __importing__ the MEDIA_MANAGER, we should have
been using tools.common.import_component in the first place.

But even better to use the existing get_media_manager() function that
exists for exactly our purpose. Also improve documentation of what happens
in case of failure.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-11-30 14:25:26 +01:00
Sebastian Spaeth
27886480ab Remove importlib (python2.7'ism)
importlib is cool, but only included in python2.7 which is beyond our
minimum python version that we support. So simply use plain old
__import__.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-11-30 11:25:50 +01:00
Elrond
e4f33f4093 Merge remote-tracking branch 'spaetz/formerge/538_FORBIDDEN_admin_pages'
* spaetz/formerge/538_FORBIDDEN_admin_pages:
  Fix error page text
  Return code 403 when accessing admin pages
  Implement generic error pages
2012-11-29 15:27:50 +01:00
Sebastian Spaeth
26c71029b4 Fix error page text
Thanks to Elrond for noticing. We wrap error messages in <p> tags,
so there is no need to start the error message with <p>. DOH

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-11-29 14:51:24 +01:00
Elrond
6adcea2451 Merge remote-tracking branch 'spaetz/formerge/bundle_xml_templates_too'
* spaetz/formerge/bundle_xml_templates_too:
  Also package webfinger.xml
2012-11-29 14:34:16 +01:00
Sebastian Spaeth
e501c619cb Also package webfinger.xml
MANIFEST.in did not include *.xml for our templates, so the webfinger
template files got left out of our packaging with e.g. "setup.py install".
Fixed.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-11-29 14:32:28 +01:00
Elrond
f52301d261 Merge remote-tracking branch 'spaetz/formerge/507_remove_routes'
* spaetz/formerge/507_remove_routes:
  Purge routes package from MG (#507)
2012-11-29 14:29:43 +01:00
Sebastian Spaeth
60de3209b9 Return code 403 when accessing admin pages
without being an admin. Previously we were just returning a 404 page
and this confused the heck out of me, as I did not understand why the
admin pages were not there at all (I was no admin).

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-11-29 09:10:43 +01:00
Sebastian Spaeth
6b5f1ca79b Implement generic error pages
Rather than having a 404.html, a 403.html, a 500.html,...
we have a generic error.html template that we pass in an
error code, a title and a (html'ish) error message.

Implement the common render_404 and render_403 shortcuts. More exotic
cases can be achieved by the generic render_error function.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-11-29 09:01:08 +01:00
Elrond
efb70b529f Merge some small bits by spaetz. Needed later.
* commit '9437ea4742':
  Add commit argument to clean_orphan_tags
  Add "commit" argument to Base model delete()
2012-11-28 16:45:15 +01:00
Sebastian Spaeth
9437ea4742 Add commit argument to clean_orphan_tags
So we can prevent the session from being committed if we don't want it.
2012-11-28 14:43:04 +01:00
Elrond
329e39034b Add "commit" argument to Base model delete()
In case we want to bundle db actions into a single transaction, we
can now use delete(commit=False) to prevent the transaction from being
committed immediately. This is useful when e.g. deleting a User() and
thousands of his MediaEntries in a single commit.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-11-28 13:52:41 +01:00
Jef van Schendel
0d599e5341 Merge remote-tracking branch 'spaetz/focus_on_user_creation' 2012-11-27 13:56:38 +01:00
Christopher Allan Webber
fbfcf1a57a Merge remote-tracking branch 'refs/remotes/elrond/sql/migrate_new_tables' 2012-11-26 15:15:13 -06:00
Sebastian Spaeth
a3009452fa Autofocus the username field on user creation
On a page with the single purpose to enter new user data, we should
auto-focus the username field. It is very annoying to have to click in
that field before starting to type. Theoretically, there is the "autofocus"
attribute in html5, but IE does not support that.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-11-26 21:38:29 +01:00
Elrond
fa2f6ba162 Merge remote-tracking branch 'spaetz/390_delim' into review
* spaetz/390_delim:
  No need to strip the tag 4 times
  Slightly shorten the media_tags_as_string function
  Remove tag delimiter configurability (#390), fixed pep-8 compliance
2012-11-26 19:52:11 +01:00
Christopher Allan Webber
dc0b39b747 Merge remote-tracking branch 'elrond/for-schendje' 2012-11-26 12:50:17 -06:00
Christopher Allan Webber
f891d5fe50 geolocation now on by default 2012-11-26 11:57:33 -06:00
Christopher Allan Webber
11e887f274 Merge remote-tracking branch 'remotes/spaetz/410_OSM_attrib_v2' 2012-11-26 11:53:59 -06:00
Elrond
9498e3e73b Some small template changes
1) Change the "dashboard":
   - Add a bunch of new links: Processing panel, Add media
   - Use <ul>+<li> for the *list* of possible actions
2) Add a title attribute to the "add media to collection" link
2012-11-26 00:36:07 +01:00
Elrond
9abd664bf2 Stop unicode conversion warning during dbupdate.
Just force the passed in name to MigrationManager() to unicode.
2012-11-24 22:57:46 +01:00
Elrond
316e1dfdde SQL Migrations: Rewrite table creation completely.
We have migrations creating new tables. Those currently use
"raw" table definitions. This easily gives errors (we
already had this problem).

So instead rewrite those to use declarative tables and use
those to create new tables. Just copy the new table over to
the migration, strip it down to the bare minimum, rename to
_v0, base it on declarative_base() and be done!

Do this for the current migrations.
2012-11-24 19:23:08 +01:00
Christopher Allan Webber
4211d03014 Marking "attachment" stuff for translation (thanks for catching AVRS) 2012-11-24 10:22:11 -06:00
Elrond
df7e06c40c Require werkzeug >= 0.7
We need it, really. For csrf.py's request.scheme.

Thanks to Sebastian Spaeth!
2012-11-24 00:16:51 +01:00
Elrond
c356dc1635 Very small typo fix in deploying docs.
Thanks to #mediagoblin.
2012-11-20 14:32:29 +01:00