Merge branch 'master' into jwandborg-f482_media_attachments
authorChristopher Allan Webber <cwebber@dustycloud.org>
Tue, 23 Aug 2011 02:48:45 +0000 (21:48 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Tue, 23 Aug 2011 02:48:45 +0000 (21:48 -0500)
Conflicts:
mediagoblin/config_spec.ini
mediagoblin/edit/forms.py
mediagoblin/edit/views.py
mediagoblin/submit/views.py
mediagoblin/templates/mediagoblin/user_pages/media.html

1  2 
mediagoblin/config_spec.ini
mediagoblin/edit/forms.py
mediagoblin/edit/views.py
mediagoblin/submit/views.py
mediagoblin/templates/mediagoblin/user_pages/media.html
mediagoblin/user_pages/routing.py
mediagoblin/user_pages/views.py

index a82541b6fd64ba99ef2dc7288bf8d229bdf78917,6e0d52b4b770e23db28f7bfda5a6b4009152f5f3..11badc1fe9ec3d13923fb0194b3e1bc787239d5c
@@@ -37,11 -32,13 +32,20 @@@ local_templates = string(
  # 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()
index 3969e5098176ef538c597a26fb3137edbb84a828,2f3ed203e5e6632bd9a7eaff9c85c5d1e25821c0..c5ab9fd94f3390f2c9aa9ec6f45c40266406fe19
@@@ -32,15 -34,10 +34,16 @@@ class EditForm(wtforms.Form)
          [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')
index c4d503b7ad299b265c0d23f58971872192138ec7,0b1a98f1d6617fb89b1adc4fc810b0ed28b7695d..b0145a0482c937ea7b0d3c05b4b1375bc1279ca2
@@@ -58,10 -48,10 +59,10 @@@ def edit_media(request, media)
              {'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')
@@@ -90,7 -72,8 +91,7 @@@
              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,
index 126cf3a88a15ebdc4765ac08568e957608a90c22,1ba17954fa684f9bd5df22afccf9ea6ef955fe68..4481adeb403d00a46b1747994babcdef970984a3
  # 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
  
index 1a5eed1f452eff70b0aa6c754fa5dbd98e7f281d,6747fddc59e7eeab45505c78491ad07f2a9845e4..08d5dbe9411e229e9222133aa3d4ca136922e12a
  
      <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" %}
Simple merge
index 8b9d94e52e2ca285bf768c76d68ad6b28afaae37,3677c134a1e9d2cf5c2799792d705f529c7c1c62..2d9bcd2104f8242302044de4767e8929d518813b
  
  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,