178 Commits

Author SHA1 Message Date
Hans Lo
dc03850b7a Use WTForms data field in edit/views.py 2013-03-27 23:56:20 -04:00
Elrond
954b407cf8 Use the media id for attachmemt editing.
And remove some stray white space from the output.
2013-02-24 12:36:07 +01:00
András Veres-Szentkirályi
596b3410db removed unused import cgi.FieldStorage 2013-02-22 22:24:29 +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
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
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
Sebastian Spaeth
380f22b859 Allowing to delete a user account (#302)
Add a "Delete user account" template and link to it from the user
account settings page.

Create a delete_account function and fill in most blanks. We can now
successfully delete our own account.

Thanks to Elrond for catching a stray csrf_exempt in a previous iteration
of this patch.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2013-01-17 12:19:52 +01:00
Christopher Allan Webber
27aebe05a6 Merge remote-tracking branch 'refs/remotes/elrond/misc/use_media_id' 2013-01-16 11:06:22 -06:00
Sebastian Spaeth
65969d3fb7 Simplify check_media_slug_used
Remove the unused dummy_db argument and generally make the function
readable.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2013-01-15 14:49:50 +01:00
Elrond
461dd9717c Start to use the media_id in "admin" URLs.
We have a bunch of URLs that are more for internal use. At
least they're definitely not intended to be posted
somewhere for long term useage.

When those things affect a media, it's much better to
reference the media by its id. This can't change, ever.
This is better for races.
Like someone posting a comment while the owner
corrects a typo in the slug.
2013-01-11 21:48:03 +01:00
Sebastian Spaeth
abc4da2927 Enable /u/USERNAME/edit/ pattern #588
Transition from the inconsistent /edit/profile/?username=FOO to
the nicer /u/FOO/edit/. The old pattern will still work and
redirects to the new URL.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2013-01-09 09:56:53 +01:00
Elrond
3d91433230 Move things from routing.py to tools/routing.py
This stops a cyclic import.

Move add_route, mount and endpoint_to_controller into
tools/routing.py and change all callers.
2012-12-23 12:26:34 +01:00
Sebastian Spaeth
cfa922295e Convert return HttpException to raise HttpException
controllers (view function) raise HttpException's and do not return them.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-23 11:58:51 +01:00
Sebastian Spaeth
950124e640 webob.HTTPFound --> MG.tools.redirect
Transition away from webob.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-21 08:11:40 +01:00
Sebastian Spaeth
62d14bf50b Transition webob.HttpForbidden to webob's exceptions Forbidden
Also the BadRequest exception.
2012-12-21 08:11:40 +01:00
Sebastian Spaeth
5c2b84869f Move DBModel._id -> DBModel.id
We were refering to model._id in most of the code base as this is
what Mongo uses. However, each use of _id required a) fixup of queries:
e.g. what we did in our find() and find_one() functions moving all
'_id' to 'id'. It also required using AliasFields to make the ._id
attribute available. This all means lots of superfluous fixing and
transitioning in a SQL world.

It will also not work in the long run. Much newer code already refers
to the objects by model.id (e.g. in the oauth plugin), which will break
with Mongo. So let's be honest, rip out the _id mongoism and live with
.id as the one canonical way to address objects.

This commit modifies all users and providers of model._id to use
model.id instead. This patch works with or without Mongo removed first,
but will break Mongo usage (even more than before)

I have not bothered to fixup db.mongo.* and db.sql.convert
(which converts from Mongo to SQL)

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-12-21 00:30:48 +01: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
Christopher Allan Webber
ee62c51d79 Merge remote-tracking branch 'refs/remotes/spaetz/trac_475_email_notification_checkbox' 2012-11-13 08:55:14 -06:00
LotusEcho
5e5b8acfec Don't put checkbox text on separate line (#475)
Manually render the "notify me" checkbox line in the account settings
to not put the form label as a heading but in the same line as the
checkbox.

Edit forms.py to use the label attribute for the caption.

Original patch modified by Sebastian Spaeth to 1) not translate the
checkbox label in the template, it is translated in forms.py already.
2) Simplify the HTML, manually constructing the <label> tag is not
necessary, WTforms does it automatically.

Author:    LotusEcho <Emma.C.Echo@gmail.com>
Modified-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2012-11-13 15:47:34 +01:00
Joar Wandborg
c43f8c1d92 Fixed attachments 2012-10-23 01:10:46 +02:00
Joar Wandborg
7742dcc1fb Switched most stuff over from Routes
Removed the Routes routing functionality and replaced it with
werkzeug.routes. Most views are functional.

Known issues:

 - Translation integration with the request object is not yet figured
   out. This breaks 404 pages.
2012-10-14 13:46:31 +02:00
Joar Wandborg
111a609df5 Replaced all request.POST with request.form, ...
- Fixed error handling in OAuth plugin
- Changed request.POST file fields to request.files
2012-09-29 21:08:20 +02:00
Christopher Allan Webber
a648102890 Too much was marked for translation this gettext message.
Thanks for catching AVRS!
2012-09-24 14:00:34 -05:00
Aaron Williamson
b5a64f7884 Removed unnecessary reference to may_edit_collection in edit views.py 2012-09-18 18:10:36 +02:00
Aaron Williamson
be5be1154f Added basic collection functionality 2012-09-18 18:10:36 +02:00
Jef van Schendel
e175251899 Edit comment-notification text 2012-07-20 22:03:43 +02:00
Joar Wandborg
825b136227 Added some security checks to attachment upload, it's still not
waterproof.
2012-06-24 21:29:07 +02:00
Joar Wandborg
879ff4bde6 Merge remote-tracking branch 'is_derek/bug405_email_notifications_for_comments' into notifications-merge
Conflicts:
	mediagoblin/db/mongo/migrations.py
2012-06-10 15:53:46 +02:00
Will Kahn-Greene
a855e92a98 Fix problems from pyflakes output 2012-06-03 15:53:34 -04:00
Jakob Kramer
f646e2e11b use _ function on some now untranslatable strings 2012-04-19 20:15:07 +02:00
Derek Moore
fa72e51689 Updates to send email comments, included translation, better validation. 2012-03-25 22:25:54 -07:00
Derek Moore
252eaf21d5 These are changes for issue #405, add email comment notification. 2012-03-15 16:38:56 -07:00
Joar Wandborg
703d09b985 Changed from key-notation to dot-notation in edit_profile 2012-03-08 01:02:40 +01:00
Elrond
b62b3b982a Generic check_media_slug_used db utility.
In two cases (generating a new slug and editing the slug)
it is nice to know in advance (before the db gets angry)
that the slug is used/free. So created a db utility
function to check for this on mongo and sql:
check_media_slug_used()
2012-03-05 21:37:05 +01:00
Elrond
3502958113 Attachment support in the SQL backend
attachments working with the sql backend.

- SQL Schema for attachment files, ordering attachments by
  their name, not by the submission order (as earlier).
- Dot-Notation for attachments, where missing.
- convert existing attachments over from mongo -> sql
2012-02-28 20:52:35 +01:00
Elrond
1e72e075f8 Drop pre-rendered html: MediaEntry.description_html
After a bit of discussion, we decided to drop the
pre-rendered html from the database and render it on
the fly.

In another step, we will use some proper caching method to
cache this stuff.

This commit affects the MediaEntry.description_html part.
2012-02-18 12:41:25 +01:00
Elrond
e61ab0998b Drop pre-rendered html: User.bio_html
After a bit of discussion, we decided to drop the
pre-rendered html from the database and render it on
the fly.

In another step, we will use some proper caching method to
cache this stuff.

This commit affects the User.bio_html part.
2012-02-18 12:35:30 +01:00
Christopher Allan Webber
cf29e8a824 It's 2012 all up in here 2012-02-02 09:44:13 -06:00
Elrond
de91730336 Nearly complete support for Tags
These changes allow all of the rest of the code to use tags
in sql as they were used on mongo. It's not efficient at
all, as changing tags usually means to remove all old tags
and adding all new.

The only problem here is: Old slugs for tags are not
removed, because they're shared across all MediaTags and
dropping orphans is not always easy.
2012-01-28 19:32:43 +01:00
Christopher Allan Webber
da6206c4be Oops, I broke teh all rights reserved ;) 2012-01-21 16:56:49 -06:00
Christopher Allan Webber
2788e6a164 License "all rights reserved" default should be None/NULL, not empty string 2012-01-21 16:40:39 -06:00
Elrond
3c351460e1 Fix unit tests with new license support
Make the license field in the forms optional and let them
properly be defaulted to "".
2012-01-21 19:24:36 +01:00
Aaron Williamson
97ec97dbc7 Minor formatting and syntax fix. 2012-01-18 21:21:49 -05:00
Aaron Williamson
a6c49d49dc Fixed a syntax error in edit/views and added back in some missing license stuff from models 2012-01-17 01:22:02 -05:00
Aaron Williamson
99a270e952 Merged changes with upstream 2012-01-17 00:59:21 -05:00
Aaron Williamson
25b48323a8 First crack at basic license support. 2012-01-17 00:33:55 -05:00
Jef van Schendel
fafec72740 Remove unnecessary piece of text in media.html. Fix "Markdown text" indentation so they are the same. 2012-01-13 23:23:02 +01:00
Elrond
0ab21f981a Dot-Notation: Some random places 2012-01-11 11:42:26 +01:00
Elrond
49af00e491 Make show-password-js work for change password too
The show password js depends on the password field to have
an id of "password". So give it a proper id.

Also fixed the label generation for the case of field.name
and field.id being different.
2012-01-05 14:47:15 +01:00