2581 Commits

Author SHA1 Message Date
Christopher Allan Webber
e9c3384b84 Removing unused geolocation_map_visible variable and turning geolocation on in default config 2013-01-30 13:22:18 -06:00
Christopher Allan Webber
a3f811a6e8 Geolocation stuff, including including templates seems to be working-ish
- I'm having trouble seeing if the geolocation stuff actually works,
   but plugins are included
 - including a list of template hooks works, however the macro to
   include them does not, so it's kinda verbose
2013-01-30 13:22:18 -06:00
Christopher Allan Webber
1c2d01ae3b Very start of plugin hooks and openstreetmap pluginification
- Added start of template hook code to pluginapi.py
 - Started to break openstreetmap into plugin; moved templates
 - Added plugin hooks in media and image media templates

... almost certainly, none of this works yet. :)
2013-01-30 13:22:18 -06:00
Elrond
04453ccf42 Better Py3 compat: d.has_key(k) -> k in d
py3 does not have dict.has_key any more. You have to use
"key in dict" instead. As that works in python2 as well,
let's use that.

Also some small bits of pep8.
2013-01-30 15:03:04 +01:00
Elrond
3f931680e3 Improve runtime of one test.
Do not commit so often. flushing is enough.
2013-01-29 21:45:16 +01:00
Elrond
ff68ca9fc2 Fix issue 611: Proper (back)relationship on MediaComment.
well, fix the relationship on the comments.
2013-01-29 21:23:21 +01:00
Elrond
e9b4e50007 Failing testcase for issue 611.
This currently fails (with foreign key constrain error):
1. Have user A and B.
2. User B creates media M.
3. User A post a comment on M.
4. User A deletes his own account.

The test is a little bit wider.
2013-01-29 21:13:49 +01:00
Joar Wandborg
f8107ccccc *docs* intersphinx, exception monitoring 2013-01-27 22:10:47 +01:00
Elrond
ae9f0aec38 Docs: Add a database guide to the plugin docs.
Plugin writers will often need to create new tables. So
give them some hints, what they need to do and where they
might find more info.
2013-01-26 19:38:52 +01:00
Elrond
3214c653dd Docs: Create new area for developers.
We need some "Part" for developers. Currently, it's named
"Part 4: Developer's Zone".  But we should come up with a
better name soon.

Moved the codebase docs in there for starters.
2013-01-26 19:20:18 +01:00
Elrond
b238a95464 Add Trim whitespace plugin docs.
Added the documentation (which was already present in
plugindocs/) to the TOC, so it's getting build and linked.
2013-01-26 13:03:54 +01:00
Elrond
92c597ca1c Allow doc string extraction and use for pluginapi.
Allow us to extract docstrings from our sources using the
sphinx.ext.autodoc module.

First use: Extract some of the docs for the pluginapi and
provide it in a new "Plugin API" section.
2013-01-26 00:15:57 +01:00
Joar Wandborg
3a8b18f85b Updated video apt-get to not use glob
Also changed some literal blocks to code-blocks
2013-01-25 21:43:49 +01:00
Christopher Allan Webber
d5600aa75c Fix reference of get_test_app->get_app in test_modelmethods
(This changed in master while this test was being written; correcting
post-merge.)
2013-01-25 12:10:27 -06:00
Christopher Allan Webber
c7d135b6ea Merge branch '216_cwebber_style_unique_slugs' 2013-01-25 12:03:40 -06:00
Christopher Allan Webber
a81082fcaf New mediaentry slug tests now pass!
- fixed some issues with "whacking uuid junk on the slug"
 - uuid4() -> uuid.uuid4() so that mock will work right
 - added all the tests!
2013-01-23 16:49:54 -06:00
Christopher Allan Webber
394a4a37f7 require mock for the new uuid-mocking tests 2013-01-23 16:47:30 -06:00
Christopher Allan Webber
b0118957ff We don't want any empty string slugs, so make "" -> None 2013-01-23 16:40:39 -06:00
Christopher Allan Webber
266b42b3dc Switching uuid4()[1:4] -> uuid4().hex[:4]
.hex is what we need to access to get at the ascii (hex) version
anyway.  Also, not sure why the previous version grabbed starting at
the index of 1... just grab the first characters instead.
2013-01-23 15:15:22 -06:00
Elrond
6194344bf9 Use better relationships to delete collections.
When deleting a User, his/her collections can be deleted by
sqlalchemy: Collections do not need any special code to be
executed on deletion.
2013-01-23 17:36:03 +01:00
Joar Wandborg
d63cc34e71 Made pil_filters a PIL_FILTERS (global) 2013-01-22 23:28:17 +01:00
Joar Wandborg
124081040b Changed sampling filter default to AA 2013-01-22 23:28:17 +01:00
Joar Wandborg
7cd7db5af4 Made the image sampling filter configurable
- Changed the default to BICUBIC instead of previous ANTIALIAS
2013-01-22 23:28:17 +01:00
Elrond
0c871f8122 Use inspect_table; default user license==None.
Use inspect_table in the new migration. Makes code more
readable, really.

And make the default for the preferred license be None.
This is a userspace thing, so we can even change the
migration here. Changing the migration means, that people
running the migration before this commit get a "" in
User.license_preference, while people running the migration
now get a None. Both values are okay.

None has been designated as "Use the site's default". We're
not actually having a site default right now. Which means
no license is selected in the dropdown.

While "" means "All rights reserved" being chosen by the
user.

Side note: Having no license being selected in the submit
dropdown is as "worse" as before and does not really hurt
much. MediaEntry.license==None means "All rights reserved"
as does "" also do.
2013-01-22 23:10:30 +01:00
Sebastian Spaeth
066d49b2c1 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>
2013-01-22 22:18:08 +01:00
Christopher Allan Webber
79f7cfd900 Merge remote-tracking branch 'refs/remotes/spaetz/521_license_preference' into mergetest 2013-01-22 13:43:02 -06:00
Joar Wandborg
55a04f01b8 Moved MediaComment form descriptions to apt. place 2013-01-22 14:38:53 +01:00
Sebastian Spaeth
69b5623552 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>
2013-01-21 17:15:39 +01:00
Sebastian Spaeth
a89df96132 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>
2013-01-21 17:14:59 +01:00
Sebastian Spaeth
0f9cf6ef32 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>
2013-01-21 15:38:57 +01:00
Christopher Allan Webber
0c97a82556 Merge remote-tracking branch 'refs/remotes/spaetz/436_celery_push' 2013-01-20 13:13:39 -06:00
Sebastian Spaeth
9e9d908325 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>
2013-01-18 21:24:19 +01:00
Elrond
d92fbdc4ea 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!
2013-01-18 21:21:42 +01:00
Elrond
afbfd40578 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.
2013-01-18 18:42:52 +01:00
Elrond
5bae4af14e 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.
2013-01-18 13:05:57 +01:00
Elrond
cd75b2280f Add some simple collection test. 2013-01-18 11:42:56 +01:00
Elrond
1be247b36e 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.
2013-01-18 11:40:40 +01:00
Elrond
4637d50cfc 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.
2013-01-17 23:57:41 +01:00
Elrond
7341cc8e34 Translate account deletion.
Mark all the strings in the new account deletion stuff for
translation.
2013-01-17 23:57:40 +01:00
Elrond
7d16a01bae 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.
2013-01-17 23:57:40 +01:00
Christopher Allan Webber
00cf28da21 Merge branch 'master' of gitorious.org:mediagoblin/mediagoblin 2013-01-17 15:51:30 -06:00
Sebastian Spaeth
ba5ea989a5 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>
2013-01-17 22:39:22 +01:00
Elrond
626a093ccc Move workbench into tools directory. 2013-01-17 22:15:57 +01:00
Elrond
9d8285864a Remove DEFAULT_WORKBENCH_DIR.
We never used this.
Removed, as okayed by cwebber.
2013-01-17 22:11:05 +01:00
Christopher Allan Webber
c813f0bd57 Merge remote-tracking branch 'refs/remotes/spaetz/565_workbench_cleanup' 2013-01-17 15:02:52 -06:00
Mark Holmquist
dc4dfbde35 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>
2013-01-17 21:34:04 +01:00
Jef van Schendel
49745d5138 Add "Browse collections" link to profile pages 2013-01-17 20:04:22 +01:00
Christopher Allan Webber
3c912132d6 adding back dropdown.js now that we have, well, a dropdown again :) 2013-01-17 11:53:32 -06:00
Christopher Allan Webber
d1d535602c Merge remote-tracking branch 'refs/remotes/origin/533-new-dropdown'
Conflicts:
	mediagoblin/templates/mediagoblin/base.html
	mediagoblin/templates/mediagoblin/root.html
2013-01-17 11:47:29 -06:00
Christopher Allan Webber
30af7ce6ad Merge commit '9408938' from 565_workbench_cleanup (spaetz) 2013-01-17 11:12:13 -06:00