aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/edit
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/edit')
-rw-r--r--mediagoblin/edit/__init__.py17
-rw-r--r--mediagoblin/edit/forms.py3
-rw-r--r--mediagoblin/edit/views.py16
3 files changed, 26 insertions, 10 deletions
diff --git a/mediagoblin/edit/__init__.py b/mediagoblin/edit/__init__.py
index e69de29b..a8eeb5ed 100644
--- a/mediagoblin/edit/__init__.py
+++ b/mediagoblin/edit/__init__.py
@@ -0,0 +1,17 @@
+# GNU MediaGoblin -- federated, autonomous media hosting
+# Copyright (C) 2011 Free Software Foundation, Inc
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
diff --git a/mediagoblin/edit/forms.py b/mediagoblin/edit/forms.py
index e7a86bba..a1783a72 100644
--- a/mediagoblin/edit/forms.py
+++ b/mediagoblin/edit/forms.py
@@ -24,7 +24,8 @@ class EditForm(wtforms.Form):
'Title',
[wtforms.validators.Length(min=0, max=500)])
slug = wtforms.TextField(
- 'Slug')
+ 'Slug',
+ [wtforms.validators.Required(message="The slug can't be empty")])
description = wtforms.TextAreaField('Description of this work')
tags = wtforms.TextField(
'Tags',
diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py
index e4ebe8d7..5cbaadb5 100644
--- a/mediagoblin/edit/views.py
+++ b/mediagoblin/edit/views.py
@@ -22,13 +22,11 @@ from mediagoblin import messages
from mediagoblin import mg_globals
from mediagoblin.util import (
render_to_response, redirect, clean_html, convert_to_tag_list_of_dicts,
- media_tags_as_string)
+ media_tags_as_string, cleaned_markdown_conversion)
from mediagoblin.edit import forms
from mediagoblin.edit.lib import may_edit_media
from mediagoblin.decorators import require_active_login, get_user_media_entry
-import markdown
-
@get_user_media_entry
@require_active_login
@@ -59,11 +57,8 @@ def edit_media(request, media):
media['tags'] = convert_to_tag_list_of_dicts(
request.POST.get('tags'))
- md = markdown.Markdown(
- safe_mode = 'escape')
- media['description_html'] = clean_html(
- md.convert(
- media['description']))
+ media['description_html'] = cleaned_markdown_conversion(
+ media['description'])
media['slug'] = request.POST['slug']
media.save()
@@ -108,6 +103,9 @@ def edit_profile(request):
if request.method == 'POST' and form.validate():
user['url'] = request.POST['url']
user['bio'] = request.POST['bio']
+
+ user['bio_html'] = cleaned_markdown_conversion(user['bio'])
+
user.save()
messages.add_message(request,
@@ -115,7 +113,7 @@ def edit_profile(request):
'Profile edited!')
return redirect(request,
'mediagoblin.user_pages.user_home',
- username=edit_username)
+ user=edit_username)
return render_to_response(
request,