# itself)
celery_setup_elsewhere = boolean(default=False)
+# Whether or not users are able to upload files of any filetype with
+# their media entries -- This is useful if you want to provide the
+# source files for a media file but can also be a HUGE security risk.
+allow_attachments = boolean(default=False)
+
++
+ [storage:publicstore]
+ base_dir = string(default="%(here)s/user_dev/media/public")
+ base_url = string(default="/mgoblin_media/")
+
+ [storage:queuestore]
+ base_dir = string(default="%(here)s/user_dev/media/queue")
+
++
[celery]
# known booleans
celery_result_persistent = boolean()
[tag_length_validator])
class EditProfileForm(wtforms.Form):
- bio = wtforms.TextAreaField('Bio',
+ bio = wtforms.TextAreaField(
+ _('Bio'),
[wtforms.validators.Length(min=0, max=500)])
url = wtforms.TextField(
- 'Website',
+ _('Website'),
[wtforms.validators.Optional(),
- wtforms.validators.URL(message=_('Improperly formed URL'))])
+ wtforms.validators.URL(message='Improperly formed URL')])
+
+class EditAttachmentsForm(wtforms.Form):
+ attachment_name = wtforms.TextField(
+ 'Title')
+ attachment_file = wtforms.FileField(
+ 'File')
{'slug': request.POST['slug'],
'uploader': media['uploader'],
'_id': {'$ne': media['_id']}}).count()
-
+
if existing_user_slug_entries:
form.slug.errors.append(
- u'An entry with that slug already exists for this user.')
+ _(u'An entry with that slug already exists for this user.'))
else:
media['title'] = request.POST['title']
media['description'] = request.POST.get('description')
and request.method != 'POST':
messages.add_message(
request, messages.WARNING,
- "You are editing another user's media. Proceed with caution.")
+ _("You are editing another user's media. Proceed with caution."))
-
return render_to_response(
request,
# 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/>.
-
+import mediagoblin.mg_globals as mg_globals
- from datetime import datetime
-
+ import uuid
-
from os.path import splitext
from cgi import FieldStorage
- from string import split
from werkzeug.utils import secure_filename
<div class="grid_5 omega">
{% include "mediagoblin/utils/prev_next.html" %}
- <h3>Sidebar content here!</h3>
- {% if media.attachment_files or media['uploader'] == request.user['_id'] or
- request.user['is_admin'] %}
-
- <p>
-- {% if media['uploader'] == request.user['_id'] or
-- request.user['is_admin'] %}
- <h3>Temporary button holder</h3>
-- <p>
-- <a href="{{ request.urlgen('mediagoblin.edit.edit_media',
-- user= media.uploader().username,
-- media= media._id) }}"
-- ><img src="{{ request.staticdirect('/images/icon_edit.png') }}"
-- class="media_icon" />edit</a>
-- </p>
-- <p>
-- <img src="{{ request.staticdirect('/images/icon_delete.png') }}"
- class="media_icon" />delete
- class="media_icon" />{% trans %}delete{% endtrans %}
-- </p>
-- {% endif %}
- </p>
++
++ {% if media['uploader'] == request.user['_id'] or
++ request.user['is_admin'] %}
++ <h3>Temporary button holder</h3>
++ <p>
++ <a href="{{ request.urlgen('mediagoblin.edit.edit_media',
++ user= media.uploader().username,
++ media= media._id) }}"
++ ><img src="{{ request.staticdirect('/images/icon_edit.png') }}"
++ class="media_icon" />edit</a>
++ </p>
++ <p>
++ <img src="{{ request.staticdirect('/images/icon_delete.png') }}"
++ class="media_icon" />{% trans %}delete{% endtrans %}
++ </p>
++ {% endif %}
+
+ {% if media.attachment_files|count %}
- <h3>Attachments</h3>
- <ul>
- {% for attachment in media.attachment_files %}
- <li>
- <a href="{{ request.app.public_store.file_url(
- attachment.filepath) }}">
- {{ attachment.name }}
- </a>
- </li>
- {% endfor %}
- {% endif %}
- </ul>
++ <h3>Attachments</h3>
++ <ul>
++ {% for attachment in media.attachment_files %}
++ <li>
++ <a href="{{ request.app.public_store.file_url(attachment.filepath) }}">
++ {{ attachment.name }}
++ </a>
++ </li>
++ {% endfor %}
++ </ul>
+ {% endif %}
- {% if app_config['allow_attachments'] %}
++
++ {% if app_config['allow_attachments']
++ and (media['uploader'] == request.user['_id']
++ or request.user['is_admin']) %}
+ <a href="{{ request.urlgen('mediagoblin.edit.attachments',
- user= media.uploader().username,
- media= media._id) }}">Add attachment</a>
++ user=media.uploader().username,
++ media=media._id) }}">Add attachment</a>
+ {% endif %}
{% if media.tags %}
{% include "mediagoblin/utils/tags.html" %}
from webob import exc
-from mediagoblin import messages
+from mediagoblin import messages, mg_globals
from mediagoblin.db.util import DESCENDING, ObjectId
from mediagoblin.util import (
- Pagination, render_to_response, redirect, cleaned_markdown_conversion)
+ Pagination, render_to_response, redirect, cleaned_markdown_conversion,
+ render_404)
from mediagoblin.user_pages import forms as user_forms
from mediagoblin.decorators import (uses_pagination, get_user_media_entry,