From c85c9dc712f38af1403572f9367edc692306dc02 Mon Sep 17 00:00:00 2001 From: Elrond Date: Mon, 4 Jul 2011 23:47:13 +0200 Subject: [PATCH 01/38] Move setting up of staticdirector to init submodule This duplicates some exceptions, which will be fixed very soon. --- mediagoblin/app.py | 18 +++--------------- mediagoblin/init/__init__.py | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/mediagoblin/app.py b/mediagoblin/app.py index 9454b403..ab8549cb 100644 --- a/mediagoblin/app.py +++ b/mediagoblin/app.py @@ -20,13 +20,13 @@ import urllib import routes from webob import Request, exc -from mediagoblin import routing, util, storage, staticdirect +from mediagoblin import routing, util, storage from mediagoblin.init.config import ( read_mediagoblin_config, generate_validation_report) from mediagoblin.db.open import setup_connection_and_db_from_config from mediagoblin.mg_globals import setup_globals from mediagoblin.init.celery import setup_celery_from_config -from mediagoblin.init import get_jinja_loader +from mediagoblin.init import get_jinja_loader, get_staticdirector from mediagoblin.workbench import WorkbenchManager @@ -85,19 +85,7 @@ class MediaGoblinApp(object): self.routing = routing.get_mapper() # set up staticdirector tool - if app_config.has_key('direct_remote_path'): - self.staticdirector = staticdirect.RemoteStaticDirect( - app_config['direct_remote_path'].strip()) - elif app_config.has_key('direct_remote_paths'): - direct_remote_path_lines = app_config[ - 'direct_remote_paths'].strip().splitlines() - self.staticdirector = staticdirect.MultiRemoteStaticDirect( - dict([line.strip().split(' ', 1) - for line in direct_remote_path_lines])) - else: - raise ImproperlyConfigured( - "One of direct_remote_path or " - "direct_remote_paths must be provided") + self.staticdirector = get_staticdirector(app_config) # Setup celery, if appropriate if setup_celery and not app_config.get('celery_setup_elsewhere'): diff --git a/mediagoblin/init/__init__.py b/mediagoblin/init/__init__.py index b8ed2456..4bf69158 100644 --- a/mediagoblin/init/__init__.py +++ b/mediagoblin/init/__init__.py @@ -15,6 +15,11 @@ # along with this program. If not, see . import jinja2 +from mediagoblin import staticdirect + + +class Error(Exception): pass +class ImproperlyConfigured(Error): pass def get_jinja_loader(user_template_path=None): @@ -31,3 +36,19 @@ def get_jinja_loader(user_template_path=None): jinja2.PackageLoader('mediagoblin', 'templates')]) else: return jinja2.PackageLoader('mediagoblin', 'templates') + + +def get_staticdirector(app_config): + if app_config.has_key('direct_remote_path'): + return staticdirect.RemoteStaticDirect( + app_config['direct_remote_path'].strip()) + elif app_config.has_key('direct_remote_paths'): + direct_remote_path_lines = app_config[ + 'direct_remote_paths'].strip().splitlines() + return staticdirect.MultiRemoteStaticDirect( + dict([line.strip().split(' ', 1) + for line in direct_remote_path_lines])) + else: + raise ImproperlyConfigured( + "One of direct_remote_path or " + "direct_remote_paths must be provided") From fe289be4c85774b1d48f9db1ef644ee88b672e08 Mon Sep 17 00:00:00 2001 From: Elrond Date: Mon, 4 Jul 2011 23:57:45 +0200 Subject: [PATCH 02/38] Create setup_global_and_app_config Moving the config reading and error reporting from app.py to init/__init__.py. Straight forward. This also fixes the duplicated exceptions. --- mediagoblin/app.py | 17 +++-------------- mediagoblin/init/__init__.py | 13 +++++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/mediagoblin/app.py b/mediagoblin/app.py index ab8549cb..0ef670d7 100644 --- a/mediagoblin/app.py +++ b/mediagoblin/app.py @@ -21,19 +21,14 @@ import routes from webob import Request, exc from mediagoblin import routing, util, storage -from mediagoblin.init.config import ( - read_mediagoblin_config, generate_validation_report) from mediagoblin.db.open import setup_connection_and_db_from_config from mediagoblin.mg_globals import setup_globals from mediagoblin.init.celery import setup_celery_from_config -from mediagoblin.init import get_jinja_loader, get_staticdirector +from mediagoblin.init import get_jinja_loader, get_staticdirector, \ + setup_global_and_app_config from mediagoblin.workbench import WorkbenchManager -class Error(Exception): pass -class ImproperlyConfigured(Error): pass - - class MediaGoblinApp(object): """ WSGI application of MediaGoblin @@ -55,13 +50,7 @@ class MediaGoblinApp(object): ############## # Open and setup the config - global_config, validation_result = read_mediagoblin_config(config_path) - app_config = global_config['mediagoblin'] - # report errors if necessary - validation_report = generate_validation_report( - global_config, validation_result) - if validation_report: - raise ImproperlyConfigured(validation_report) + global_config, app_config = setup_global_and_app_config(config_path) ########################################## # Setup other connections / useful objects diff --git a/mediagoblin/init/__init__.py b/mediagoblin/init/__init__.py index 4bf69158..4a14fdf8 100644 --- a/mediagoblin/init/__init__.py +++ b/mediagoblin/init/__init__.py @@ -16,12 +16,25 @@ import jinja2 from mediagoblin import staticdirect +from mediagoblin.init.config import ( + read_mediagoblin_config, generate_validation_report) class Error(Exception): pass class ImproperlyConfigured(Error): pass +def setup_global_and_app_config(config_path): + global_config, validation_result = read_mediagoblin_config(config_path) + app_config = global_config['mediagoblin'] + # report errors if necessary + validation_report = generate_validation_report( + global_config, validation_result) + if validation_report: + raise ImproperlyConfigured(validation_report) + + return global_config, app_config + def get_jinja_loader(user_template_path=None): """ Set up the Jinja template loaders, possibly allowing for user From cca5d55d40fe5b4f097e015c72cbd8e6c4c3232a Mon Sep 17 00:00:00 2001 From: Elrond Date: Tue, 5 Jul 2011 00:02:04 +0200 Subject: [PATCH 03/38] Let setup_global_and_app_config call setup_globals Let setup_global_and_app_config set the global and app config in the mg_globals already. This way, the config is available to everyone very early. --- mediagoblin/app.py | 3 --- mediagoblin/init/__init__.py | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mediagoblin/app.py b/mediagoblin/app.py index 0ef670d7..6d6346d2 100644 --- a/mediagoblin/app.py +++ b/mediagoblin/app.py @@ -94,9 +94,6 @@ class MediaGoblinApp(object): ####################################################### setup_globals( - app_config=app_config, - global_config=global_config, - # TODO: No need to set these two up as globals, we could # just read them out of mg_globals.app_config email_sender_address=app_config['email_sender_address'], diff --git a/mediagoblin/init/__init__.py b/mediagoblin/init/__init__.py index 4a14fdf8..1c34c599 100644 --- a/mediagoblin/init/__init__.py +++ b/mediagoblin/init/__init__.py @@ -18,6 +18,7 @@ import jinja2 from mediagoblin import staticdirect from mediagoblin.init.config import ( read_mediagoblin_config, generate_validation_report) +from mediagoblin.mg_globals import setup_globals class Error(Exception): pass @@ -33,6 +34,10 @@ def setup_global_and_app_config(config_path): if validation_report: raise ImproperlyConfigured(validation_report) + setup_globals( + app_config=app_config, + global_config=global_config) + return global_config, app_config def get_jinja_loader(user_template_path=None): From cfe46f3e68b62bba0cfb943dc45e9b88c3f7c25e Mon Sep 17 00:00:00 2001 From: Caleb Forbes Davis V Date: Mon, 4 Jul 2011 19:42:45 -0500 Subject: [PATCH 04/38] uses the messaging system to notify user of result of verification check Feature #424 - Use messaging system for email verifification check response * uses add_message in verify_email and routes to the user page, bypassing verify_email.html --- mediagoblin/auth/views.py | 15 ++++++---- .../mediagoblin/auth/verify_email.html | 28 ------------------- 2 files changed, 10 insertions(+), 33 deletions(-) delete mode 100644 mediagoblin/templates/mediagoblin/auth/verify_email.html diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 1d00f382..435ad803 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -18,6 +18,7 @@ import uuid from webob import exc +from mediagoblin import messages from mediagoblin.util import render_to_response, redirect from mediagoblin.db.util import ObjectId from mediagoblin.auth import lib as auth_lib @@ -124,16 +125,20 @@ def verify_email(request): if user and user['verification_key'] == unicode(request.GET['token']): user['status'] = u'active' user['email_verified'] = True - verification_successful = True user.save() + messages.add_message(request, + messages.SUCCESS, + 'Your email address has been verified. ' \ + 'You may now login!') else: - verification_successful = False + messages.add_message(request, + messages.ERROR, + 'The verification key or user id is incorrect') return render_to_response( request, - 'mediagoblin/auth/verify_email.html', - {'user': user, - 'verification_successful': verification_successful}) + 'mediagoblin/user_pages/user.html', + {'user': user}) def resend_activation(request): diff --git a/mediagoblin/templates/mediagoblin/auth/verify_email.html b/mediagoblin/templates/mediagoblin/auth/verify_email.html deleted file mode 100644 index b6e6d1f8..00000000 --- a/mediagoblin/templates/mediagoblin/auth/verify_email.html +++ /dev/null @@ -1,28 +0,0 @@ -{# -# 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 . -#} -{% extends "mediagoblin/base.html" %} - -{% block mediagoblin_content %} -

- {% if verification_successful %} - Your email address has been verified! - {% else %} - The verification key or user id is incorrect - {% endif %} -

-{% endblock %} From e054ae9b3dfc518a34eb4a7395b177f0e8a31469 Mon Sep 17 00:00:00 2001 From: Caleb Forbes Davis V Date: Mon, 4 Jul 2011 20:04:00 -0500 Subject: [PATCH 05/38] allows using messaging instead of verify_email.html to pass tests * re-instated verification_successful flag * modified test_auth to verify nav to user_pages/user.html template --- mediagoblin/auth/views.py | 5 ++++- mediagoblin/tests/test_auth.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 435ad803..47707ca5 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -126,11 +126,13 @@ def verify_email(request): user['status'] = u'active' user['email_verified'] = True user.save() + verification_successful = True messages.add_message(request, messages.SUCCESS, 'Your email address has been verified. ' \ 'You may now login!') else: + verification_successful = False messages.add_message(request, messages.ERROR, 'The verification key or user id is incorrect') @@ -138,7 +140,8 @@ def verify_email(request): return render_to_response( request, 'mediagoblin/user_pages/user.html', - {'user': user}) + {'user': user, + 'verification_successful' : verification_successful}) def resend_activation(request): diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py index 3a13cbb1..ad9dd35b 100644 --- a/mediagoblin/tests/test_auth.py +++ b/mediagoblin/tests/test_auth.py @@ -189,7 +189,7 @@ def test_register_views(test_app): "/auth/verify_email/?userid=%s&token=total_bs" % unicode( new_user['_id'])) context = util.TEMPLATE_TEST_CONTEXT[ - 'mediagoblin/auth/verify_email.html'] + 'mediagoblin/user_pages/user.html'] assert context['verification_successful'] == False new_user = mg_globals.database.User.find_one( {'username': 'happygirl'}) @@ -201,7 +201,7 @@ def test_register_views(test_app): util.clear_test_template_context() test_app.get("%s?%s" % (path, get_params)) context = util.TEMPLATE_TEST_CONTEXT[ - 'mediagoblin/auth/verify_email.html'] + 'mediagoblin/user_pages/user.html'] assert context['verification_successful'] == True new_user = mg_globals.database.User.find_one( {'username': 'happygirl'}) From 77b958018b8ef6343394b8f138e52944334a5e1c Mon Sep 17 00:00:00 2001 From: Caleb Forbes Davis V Date: Mon, 4 Jul 2011 20:24:57 -0500 Subject: [PATCH 06/38] Feature #423 - gallery and scroll image ordering match --- mediagoblin/db/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 8aa35ca9..e764d368 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -147,9 +147,9 @@ class MediaEntry(Document): """ Provide a url to the previous entry from this user, if there is one """ - cursor = self.db.MediaEntry.find({'_id' : {"$lt": self['_id']}, + cursor = self.db.MediaEntry.find({'_id' : {"$gt": self['_id']}, 'uploader': self['uploader']}).sort( - '_id', DESCENDING).limit(1) + '_id', ASCENDING).limit(1) if cursor.count(): return urlgen('mediagoblin.user_pages.media_home', @@ -160,9 +160,9 @@ class MediaEntry(Document): """ Provide a url to the next entry from this user, if there is one """ - cursor = self.db.MediaEntry.find({'_id' : {"$gt": self['_id']}, + cursor = self.db.MediaEntry.find({'_id' : {"$lt": self['_id']}, 'uploader': self['uploader']}).sort( - '_id', ASCENDING).limit(1) + '_id', DESCENDING).limit(1) if cursor.count(): return urlgen('mediagoblin.user_pages.media_home', From ce2ac488263470270dea8619c88de648831b06ec Mon Sep 17 00:00:00 2001 From: Caleb Forbes Davis V Date: Tue, 5 Jul 2011 21:33:02 -0500 Subject: [PATCH 07/38] f#435 - avoids linking to unprocessed media in prev and next --- mediagoblin/db/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 8aa35ca9..3bd1f61f 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -148,7 +148,8 @@ class MediaEntry(Document): Provide a url to the previous entry from this user, if there is one """ cursor = self.db.MediaEntry.find({'_id' : {"$lt": self['_id']}, - 'uploader': self['uploader']}).sort( + 'uploader': self['uploader'], + 'state': 'processed'}).sort( '_id', DESCENDING).limit(1) if cursor.count(): @@ -161,7 +162,8 @@ class MediaEntry(Document): Provide a url to the next entry from this user, if there is one """ cursor = self.db.MediaEntry.find({'_id' : {"$gt": self['_id']}, - 'uploader': self['uploader']}).sort( + 'uploader': self['uploader'], + 'state': 'processed'}).sort( '_id', ASCENDING).limit(1) if cursor.count(): From b1db2c2e744dc0e5fcd10b53792c6ce306fc7149 Mon Sep 17 00:00:00 2001 From: Caleb Forbes Davis V Date: Tue, 5 Jul 2011 21:40:00 -0500 Subject: [PATCH 08/38] slug-style urls in previous and next urls look much better Bug #434 - identifies media by slug instead of _id in prev/next --- mediagoblin/db/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 8aa35ca9..c7506dbb 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -154,7 +154,7 @@ class MediaEntry(Document): if cursor.count(): return urlgen('mediagoblin.user_pages.media_home', user=self.uploader()['username'], - media=unicode(cursor[0]['_id'])) + media=unicode(cursor[0]['slug'])) def url_to_next(self, urlgen): """ @@ -167,7 +167,7 @@ class MediaEntry(Document): if cursor.count(): return urlgen('mediagoblin.user_pages.media_home', user=self.uploader()['username'], - media=unicode(cursor[0]['_id'])) + media=unicode(cursor[0]['slug'])) def uploader(self): return self.db.User.find_one({'_id': self['uploader']}) From 20d82d604620c8aa885ba0f8109a1a1d3dd6632d Mon Sep 17 00:00:00 2001 From: Caleb Forbes Davis V Date: Tue, 5 Jul 2011 22:11:56 -0500 Subject: [PATCH 09/38] B #429 - form validation allows blank profile url --- mediagoblin/edit/forms.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mediagoblin/edit/forms.py b/mediagoblin/edit/forms.py index 2efdb9e4..d5e7f0a9 100644 --- a/mediagoblin/edit/forms.py +++ b/mediagoblin/edit/forms.py @@ -31,4 +31,5 @@ class EditProfileForm(wtforms.Form): [wtforms.validators.Length(min=0, max=500)]) url = wtforms.TextField( 'Website', - [wtforms.validators.URL(message='Improperly formed URL')]) + [wtforms.validators.Optional(), + wtforms.validators.URL(message='Improperly formed URL')]) From 02542d54e1c0556cee79c9f1d75c5dc64aeb18c8 Mon Sep 17 00:00:00 2001 From: Caleb Forbes Davis V Date: Wed, 6 Jul 2011 17:14:07 -0500 Subject: [PATCH 10/38] edit profile submit redirects to user home page --- mediagoblin/edit/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py index 5a7aa4bd..5cfe904e 100644 --- a/mediagoblin/edit/views.py +++ b/mediagoblin/edit/views.py @@ -87,7 +87,9 @@ def edit_profile(request): messages.add_message(request, messages.SUCCESS, 'Profile edited!') - return redirect(request, "mediagoblin.edit.profile") + return redirect(request, + 'mediagoblin.user_pages.user_home', + user=user['username']) return render_to_response( request, From 983e11f09ee1c0801b646299b352c35291c5f674 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Wed, 6 Jul 2011 22:29:12 -0500 Subject: [PATCH 11/38] Instructions for installing MediaGoblin on Fedora --- docs/hackinghowto.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/hackinghowto.rst b/docs/hackinghowto.rst index 08b228f1..914a5135 100644 --- a/docs/hackinghowto.rst +++ b/docs/hackinghowto.rst @@ -57,6 +57,11 @@ requirements:: sudo apt-get install mongodb git-core python python-dev \ python-lxml +On Fedora:: + + yum install mongodb-server python-paste-deploy python-paste-script \ + git-core python python-devel + .. YouCanHelp:: If you have instructions for other GNU/Linux distributions to set From fe80cb06c499723a4e557c10b993b754f4b60456 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Wed, 6 Jul 2011 22:52:08 -0500 Subject: [PATCH 12/38] Also encourages editing your profile and submitting images --- mediagoblin/auth/views.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 47707ca5..2450023f 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -127,10 +127,11 @@ def verify_email(request): user['email_verified'] = True user.save() verification_successful = True - messages.add_message(request, - messages.SUCCESS, - 'Your email address has been verified. ' \ - 'You may now login!') + messages.add_message( + request, + messages.SUCCESS, + ('Your email address has been verified. ' + 'You may now login, edit your profile, and submit images!')) else: verification_successful = False messages.add_message(request, From e6fd112d429d1fcc5994ff19c61bd67367a33ce5 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Thu, 7 Jul 2011 08:22:12 -0500 Subject: [PATCH 13/38] This should actually fix the next and previous buttons now. Sorry I borked the merge! --- mediagoblin/db/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 2b7933a4..279cb9f2 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -147,7 +147,7 @@ class MediaEntry(Document): """ Provide a url to the previous entry from this user, if there is one """ - cursor = self.db.MediaEntry.find({'_id' : {"$lt": self['_id']}, + cursor = self.db.MediaEntry.find({'_id' : {"$gt": self['_id']}, 'uploader': self['uploader'], 'state': 'processed'}).sort( '_id', ASCENDING).limit(1) @@ -160,7 +160,7 @@ class MediaEntry(Document): """ Provide a url to the next entry from this user, if there is one """ - cursor = self.db.MediaEntry.find({'_id' : {"$gt": self['_id']}, + cursor = self.db.MediaEntry.find({'_id' : {"$lt": self['_id']}, 'uploader': self['uploader'], 'state': 'processed'}).sort( '_id', DESCENDING).limit(1) From fd9807ffc33c85552e39d5f7d367ba7a32d8cc2e Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Thu, 7 Jul 2011 17:21:02 +0200 Subject: [PATCH 14/38] Experimental black-and-white style change --- mediagoblin/static/css/base.css | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 53e019f6..0fc33ed7 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -1,6 +1,6 @@ body { - background-color: #272727; - color: #f7f7f7; + background-color: #1F1F1F; + color: #aaa; font-family: sans-serif; padding:none; margin:0px; @@ -18,7 +18,7 @@ form { font-family: 'Carter One'; font-style: normal; font-weight: normal; - src: local('CarterOne'), url('http://themes.googleusercontent.com/font?kit=VjW2qt1pkqVtO22ObxgEBRsxEYwM7FgeyaSgU71cLG0') format('woff'); + src: local('CarterOne'), url('http://themes.googleusercontent.com/font?kit=FWNn6ITYqL6or7ZTmBxRhq3fkYX5z1QtDUdIWoaaD_k') format('woff'); } /* text styles */ @@ -39,7 +39,7 @@ p { } a { - color: #86D4B1; + color: #fff; } label { @@ -56,7 +56,7 @@ label { .mediagoblin_header { width:100%; height:36px; - background-color:#393939; + background-color:#2F2F2F; padding-top:14px; margin-bottom:40px; } @@ -64,7 +64,7 @@ label { .mediagoblin_footer { width:100%; height:26px; - background-color:#393939; + background-color:#2F2F2F; bottom:0px; padding-top:8px; position:absolute; @@ -160,6 +160,7 @@ text-align:center; .form_field_error { background-color:#87453b; + color:#fff; border:none; font-size:16px; padding:9px; From 4924d6a50cbc80b7a3a721de72fa7879446610d3 Mon Sep 17 00:00:00 2001 From: Caleb Forbes Davis V Date: Thu, 7 Jul 2011 10:45:23 -0500 Subject: [PATCH 15/38] bug #404 - corrects querystring variable name in redirect --- mediagoblin/edit/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py index a3326b2d..3bcf788b 100644 --- a/mediagoblin/edit/views.py +++ b/mediagoblin/edit/views.py @@ -108,7 +108,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, From d6ae709c14a628edb2c493654f0c02146503b7d8 Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Thu, 7 Jul 2011 17:54:33 +0200 Subject: [PATCH 16/38] Additional style changes to navigation; add three navigation images --- mediagoblin/static/css/base.css | 12 ++++++------ mediagoblin/static/images/navigation_end.png | Bin 0 -> 718 bytes mediagoblin/static/images/navigation_left.png | Bin 0 -> 406 bytes mediagoblin/static/images/navigation_right.png | Bin 0 -> 383 bytes .../templates/mediagoblin/utils/prev_next.html | 13 ++++++++----- 5 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 mediagoblin/static/images/navigation_end.png create mode 100644 mediagoblin/static/images/navigation_left.png create mode 100644 mediagoblin/static/images/navigation_right.png diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 0fc33ed7..09f08445 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -205,14 +205,14 @@ img.media_icon{ /* navigation */ .navigation_button{ - width: 139px; + width:139px; display:block; float:left; - text-align: center; - background-color: #393939; - text-decoration: none; - padding: 6px 0pt; - font-family: 'Carter One', arial, serif; + text-align:center; + background-color:#393939; + text-decoration:none; + padding:12px 0pt; + font-family:'Carter One', arial, serif; font-size:2em; margin:0 0 20px } diff --git a/mediagoblin/static/images/navigation_end.png b/mediagoblin/static/images/navigation_end.png new file mode 100644 index 0000000000000000000000000000000000000000..b2f2729698bf8443ce687ab4a6a872726735cc19 GIT binary patch literal 718 zcmV;<0x|uGP)FN`H1O zGH5A6C_;f`MhjtFI9koZg(x`MCTgMJLI_*A5QG#Xgo(6`(Ss6#CE~PdF}wr1w_3aE>Z@J4ZMz>1RO?6Ly*LxY(PX0WZ2--9y^bLKJC#gCY4Tqkcv#Cs*T zt8uJFe>5{6bTjh_4zvhiCL+d)@if*n=>EV7=nP+8L|nxCE%3eg88U43v>aWmJ{8IU>bk7z?)(=Gk%!_I0y#%6|tZsGPrY;F*r%FH<^ zjR literal 0 HcmV?d00001 diff --git a/mediagoblin/static/images/navigation_left.png b/mediagoblin/static/images/navigation_left.png new file mode 100644 index 0000000000000000000000000000000000000000..d1645120322caaa60c8173e8c7dbcc7fc2575397 GIT binary patch literal 406 zcmeAS@N?(olHy`uVBq!ia0vp^YCtT_!3HD+ZvMRsq*#ibJVQ8upoSx*1IXtr@Q5r1 zs=p4xj7}P}D}aKMC9V-A!TD(=<%vb94CUqJdYO6I#mR{Use1WE>9gP2NHH)l3VXUZ zhD5Z!y|z2+Pyj>wM}N(rBRlyYYIRKCDPAHzUGLVy{0A!**S0+~s$4VM_Y`&$HkIw&br^mF2APpwHij;&h9SRZ=GM>}y@EZ1sAXXyzk=IQUQvn)GM zyrCw&T{x8~n?d;j>x*O8*01eq`g9=bfVRQ0|GCR%1aGvt=B%^ x+IqF2`oUp7^;ba=iGOd)A3dZ6bhz#t@wbP>H(mHWF9R5c44$rjF6*2UngBDsrLq73 literal 0 HcmV?d00001 diff --git a/mediagoblin/static/images/navigation_right.png b/mediagoblin/static/images/navigation_right.png new file mode 100644 index 0000000000000000000000000000000000000000..d4caa7b8ba1fa404cefa63a7d216f346a64960f5 GIT binary patch literal 383 zcmeAS@N?(olHy`uVBq!ia0vp^YCtT_!3HD+ZvMRsq*#ibJVQ8upoSx*1IXtr@Q5r1 zs=p4xj7}P}D}aKMC9V-A!TD(=<%vb94CUqJdYO6I#mR{Use1WE>9gP2NC6f7@pN$v ziD-R$Wv|x}2a&di>fIZf%x-a23troHuYK);>kIcLJmT~v-c~ax*lA*l!4%7XMomZC%ulDBJ$kgpSdx_BQgN9+t|GG`o zI6luH_-(tzifb>{^9FU^O@4QHv-q4u{^edjDa!S?S9mU}Ut^eia-)AqQt8Vh auRd|D{C?4*OEDZ2ybPYMelF{r5}E+h>7 - < + Previous image {% else %} {# This is the first entry. display greyed-out 'previous' image #} - + {% endif %} - {# Likewise, this could be the very last media entry #} {% if next_entry_url %} - > + Next image {% else %} {# This is the last entry. display greyed-out 'next' image #} - + {% endif %} From af2fcba5c4ce16bde1a2267b95803bc2afc9e572 Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Thu, 7 Jul 2011 18:04:19 +0200 Subject: [PATCH 17/38] Issue #431 - Prevent comment link expiry - Added functionality for comment linking * `media.html` * Changed comment textarea handle from `comment` => `field_comment` * Active comment is hilighted with the CSS class name `comment_active` and also with the hyperlink anchor #comment * Changed media.html so that pagination always uses Route('mediagoblin.user_pages.media_home') as base_url * `user_pages/forms.py` * Renamed MediaComment form field `comment` => `field_comment` * `user_pages/routing.py` * Added route for `/u/joar/m/123..456/c/234..567/`, points to `media_home` * `user_pages/views.py` * `media_home` now checks if the request contains a comment id parameter then acts accordingly with pagination whether to call it with a `jump_to_id` or not. * `media_post_comment` - Updated MediaCommentForm field name `comment` => `field_comment` * `util.py` * `redirect` now supports querystring arguments. - NOT USED (should we keep it? I think so, it might be useful, sometime [don't call me a code hoarder]). * `Pagination.__init__` now accepts one further argument, the `jump_to_id`. It assist the comment linking functionality in finding and returning the proper page for a comment. This feature will work for all kinds of objects. It might not be optimal, but it is well functional :) --- .../mediagoblin/user_pages/media.html | 19 +++++++--- mediagoblin/user_pages/forms.py | 4 +-- mediagoblin/user_pages/routing.py | 3 ++ mediagoblin/user_pages/views.py | 10 ++++-- mediagoblin/util.py | 36 ++++++++++++++++--- 5 files changed, 60 insertions(+), 12 deletions(-) diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index 1484cc73..477eae61 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -55,7 +55,7 @@
- {{ wtforms_util.render_field_div(comment_form.comment) }} + {{ wtforms_util.render_field_div(comment_form.field_comment) }}
@@ -65,7 +65,12 @@ {% if comments %} {% for comment in comments %} {% set comment_author = comment.author() %} -
+ {% if pagination.active_id == comment._id %} +
+ + {% else %} + {% endif %}
diff --git a/mediagoblin/user_pages/forms.py b/mediagoblin/user_pages/forms.py index 9f7d2fbd..b234d739 100644 --- a/mediagoblin/user_pages/forms.py +++ b/mediagoblin/user_pages/forms.py @@ -17,5 +17,5 @@ import wtforms class MediaCommentForm(wtforms.Form): - comment = wtforms.TextAreaField('Comment', - [wtforms.validators.Required()]) \ No newline at end of file + field_comment = wtforms.TextAreaField('Comment', + [wtforms.validators.Required()]) diff --git a/mediagoblin/user_pages/routing.py b/mediagoblin/user_pages/routing.py index 255b6f66..3be0617d 100644 --- a/mediagoblin/user_pages/routing.py +++ b/mediagoblin/user_pages/routing.py @@ -24,6 +24,9 @@ user_routes = [ Route('mediagoblin.user_pages.media_home', '/{user}/m/{media}/', requirements=dict(m_id="[0-9a-fA-F]{24}"), controller="mediagoblin.user_pages.views:media_home"), + Route('mediagoblin.user_pages.media_home.view_comment', + '/{user}/m/{media}/c/{comment}/', + controller="mediagoblin.user_pages.views:media_home"), Route('mediagoblin.edit.edit_media', "/{user}/m/{media}/edit/", controller="mediagoblin.edit.views:edit_media"), Route('mediagoblin.user_pages.atom_feed', '/{user}/atom/', diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py index 3a8684d3..ca1060a3 100644 --- a/mediagoblin/user_pages/views.py +++ b/mediagoblin/user_pages/views.py @@ -95,8 +95,14 @@ def media_home(request, media, page, **kwargs): """ 'Homepage' of a MediaEntry() """ + if ObjectId(request.matchdict.get('comment')): + pagination = Pagination( + page, media.get_comments(), MEDIA_COMMENTS_PER_PAGE, + ObjectId(request.matchdict.get('comment'))) + else: + pagination = Pagination( + page, media.get_comments(), MEDIA_COMMENTS_PER_PAGE) - pagination = Pagination(page, media.get_comments(), MEDIA_COMMENTS_PER_PAGE) comments = pagination() comment_form = user_forms.MediaCommentForm(request.POST) @@ -118,7 +124,7 @@ def media_post_comment(request): comment = request.db.MediaComment() comment['media_entry'] = ObjectId(request.matchdict['media']) comment['author'] = request.user['_id'] - comment['content'] = request.POST['comment'] + comment['content'] = request.POST['field_comment'] comment['content_html'] = cleaned_markdown_conversion(comment['content']) diff --git a/mediagoblin/util.py b/mediagoblin/util.py index ab219df0..7b1e4a2a 100644 --- a/mediagoblin/util.py +++ b/mediagoblin/util.py @@ -14,6 +14,8 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from __future__ import division + from email.MIMEText import MIMEText import gettext import pkg_resources @@ -21,7 +23,7 @@ import smtplib import sys import re import urllib -from math import ceil +from math import ceil, floor import copy from babel.localedata import exists @@ -35,6 +37,8 @@ from mediagoblin import mg_globals from mediagoblin import messages from mediagoblin.db.util import ObjectId +from itertools import izip, count + TESTS_ENABLED = False def _activate_testing(): """ @@ -133,7 +137,16 @@ def render_to_response(request, template, context): def redirect(request, *args, **kwargs): """Returns a HTTPFound(), takes a request and then urlgen params""" - return exc.HTTPFound(location=request.urlgen(*args, **kwargs)) + + querystring = None + if kwargs.get('querystring'): + querystring = kwargs.get('querystring') + del kwargs['querystring'] + + return exc.HTTPFound( + location=''.join([ + request.urlgen(*args, **kwargs), + querystring if querystring else ''])) def setup_user_in_request(request): @@ -418,7 +431,8 @@ class Pagination(object): get actual data slice through __call__(). """ - def __init__(self, page, cursor, per_page=PAGINATION_DEFAULT_PER_PAGE): + def __init__(self, page, cursor, per_page=PAGINATION_DEFAULT_PER_PAGE, + jump_to_id=False): """ Initializes Pagination @@ -426,11 +440,25 @@ class Pagination(object): - page: requested page - per_page: number of objects per page - cursor: db cursor + - jump_to_id: ObjectId, sets the page to the page containing the object + with _id == jump_to_id. """ - self.page = page + self.page = page self.per_page = per_page self.cursor = cursor self.total_count = self.cursor.count() + self.active_id = None + + if jump_to_id: + cursor = copy.copy(self.cursor) + + for (doc, increment) in izip(cursor, count(0)): + if doc['_id'] == jump_to_id: + self.page = 1 + int(floor(increment / self.per_page)) + + self.active_id = jump_to_id + break + def __call__(self): """ From 0e1c036c7ae388b10940606dca28f1c638035a45 Mon Sep 17 00:00:00 2001 From: Caleb Forbes Davis V Date: Thu, 7 Jul 2011 11:11:03 -0500 Subject: [PATCH 18/38] Bug #437 - adds required validator to slug field for media edit' otherwise we get a 404 because we navigate to blank slug --- mediagoblin/edit/forms.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mediagoblin/edit/forms.py b/mediagoblin/edit/forms.py index d5e7f0a9..0ed52af1 100644 --- a/mediagoblin/edit/forms.py +++ b/mediagoblin/edit/forms.py @@ -23,7 +23,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') class EditProfileForm(wtforms.Form): From 0a45fa590395a12dfd529a67a8264aab48099819 Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Thu, 7 Jul 2011 20:04:30 +0200 Subject: [PATCH 19/38] Change pagination styling; add 2 images --- mediagoblin/static/css/base.css | 4 ++++ mediagoblin/static/images/pagination_left.png | Bin 0 -> 252 bytes mediagoblin/static/images/pagination_right.png | Bin 0 -> 249 bytes .../mediagoblin/utils/pagination.html | 17 +++++++++-------- 4 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 mediagoblin/static/images/pagination_left.png create mode 100644 mediagoblin/static/images/pagination_right.png diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 09f08445..18a60f50 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -122,6 +122,10 @@ a.mediagoblin_logo:hover { text-align:center; } +.pagination_arrow{ + margin:5px; +} + /* forms */ .form_box { diff --git a/mediagoblin/static/images/pagination_left.png b/mediagoblin/static/images/pagination_left.png new file mode 100644 index 0000000000000000000000000000000000000000..56a26596d12e370eae8d853c7dde982fbc72f805 GIT binary patch literal 252 zcmeAS@N?(olHy`uVBq!ia0vp^f%RlvAJf4T$n6bEg+wkZczIZ$u9ae r$?5LwlN?)C`uNqVU!NFjJCnh{XJO)^NnUn9M=*H0`njxgN@xNAeOg#b literal 0 HcmV?d00001 diff --git a/mediagoblin/static/images/pagination_right.png b/mediagoblin/static/images/pagination_right.png new file mode 100644 index 0000000000000000000000000000000000000000..84f8abba7d6249ea6780add165e790b5b902753e GIT binary patch literal 249 zcmeAS@N?(olHy`uVBq!ia0vp^fV#>Z0u|to=`a{&CVg6Wuq&Q*n_Wq|E zcduZ1wK^f-{T>~DHKucFU7-)oO5@Zq&7k7D0)fPIG9)oh-u#cA0>%%0~AnAb;7 nQgNs}?)Pt>U(Sh__CFb$4ALKbi#=!$bOD2>tDnm{r-UW|u4-1f literal 0 HcmV?d00001 diff --git a/mediagoblin/templates/mediagoblin/utils/pagination.html b/mediagoblin/templates/mediagoblin/utils/pagination.html index aae50d22..23d49463 100644 --- a/mediagoblin/templates/mediagoblin/utils/pagination.html +++ b/mediagoblin/templates/mediagoblin/utils/pagination.html @@ -34,9 +34,16 @@ {% if pagination.has_prev %} « Prev + pagination.page - 1) }}">Previous pageNewer {% endif %} - + {% if pagination.has_next %} + OlderNext page + + {% endif %} +
+ Go to page: {%- for page in pagination.iter_pages() %} {% if page %} {% if page != pagination.page %} @@ -50,12 +57,6 @@ {% endif %} {%- endfor %} - - {% if pagination.has_next %} - Next » - {% endif %}

{% endif %} From 7664b4db81f1449b37c774cecb4fba4a505ae5d0 Mon Sep 17 00:00:00 2001 From: Elrond Date: Thu, 7 Jul 2011 22:08:20 +0200 Subject: [PATCH 20/38] Factor setup_workbench into init submodule. --- mediagoblin/app.py | 7 +++---- mediagoblin/edit/forms.py | 3 ++- mediagoblin/init/__init__.py | 10 ++++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/mediagoblin/app.py b/mediagoblin/app.py index 6d6346d2..c5fcc1dd 100644 --- a/mediagoblin/app.py +++ b/mediagoblin/app.py @@ -25,8 +25,7 @@ from mediagoblin.db.open import setup_connection_and_db_from_config from mediagoblin.mg_globals import setup_globals from mediagoblin.init.celery import setup_celery_from_config from mediagoblin.init import get_jinja_loader, get_staticdirector, \ - setup_global_and_app_config -from mediagoblin.workbench import WorkbenchManager + setup_global_and_app_config, setup_workbench class MediaGoblinApp(object): @@ -104,8 +103,8 @@ class MediaGoblinApp(object): db_connection=self.connection, database=self.db, public_store=self.public_store, - queue_store=self.queue_store, - workbench_manager=WorkbenchManager(app_config['workbench_path'])) + queue_store=self.queue_store) + setup_workbench() def __call__(self, environ, start_response): request = Request(environ) diff --git a/mediagoblin/edit/forms.py b/mediagoblin/edit/forms.py index 2efdb9e4..d5e7f0a9 100644 --- a/mediagoblin/edit/forms.py +++ b/mediagoblin/edit/forms.py @@ -31,4 +31,5 @@ class EditProfileForm(wtforms.Form): [wtforms.validators.Length(min=0, max=500)]) url = wtforms.TextField( 'Website', - [wtforms.validators.URL(message='Improperly formed URL')]) + [wtforms.validators.Optional(), + wtforms.validators.URL(message='Improperly formed URL')]) diff --git a/mediagoblin/init/__init__.py b/mediagoblin/init/__init__.py index 1c34c599..6320d21b 100644 --- a/mediagoblin/init/__init__.py +++ b/mediagoblin/init/__init__.py @@ -18,7 +18,9 @@ import jinja2 from mediagoblin import staticdirect from mediagoblin.init.config import ( read_mediagoblin_config, generate_validation_report) +from mediagoblin import mg_globals from mediagoblin.mg_globals import setup_globals +from mediagoblin.workbench import WorkbenchManager class Error(Exception): pass @@ -70,3 +72,11 @@ def get_staticdirector(app_config): raise ImproperlyConfigured( "One of direct_remote_path or " "direct_remote_paths must be provided") + + +def setup_workbench(): + app_config = mg_globals.app_config + + workbench_manager = WorkbenchManager(app_config['workbench_path']) + + setup_globals(workbench_manager = workbench_manager) From f646f5d36df0730a8c34019dfcc37cca31cc6bb6 Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Thu, 7 Jul 2011 22:45:51 +0200 Subject: [PATCH 21/38] Updated `MediaCommentForm.field_comment` => `MediaCommentForm.comment_content` * Also changed file encoding of `user_pages/forms.py` from dos to unix. --- .../mediagoblin/user_pages/media.html | 2 +- mediagoblin/user_pages/forms.py | 43 ++++++++++--------- mediagoblin/user_pages/views.py | 2 +- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html index 477eae61..3f4dce3b 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/media.html +++ b/mediagoblin/templates/mediagoblin/user_pages/media.html @@ -55,7 +55,7 @@ - {{ wtforms_util.render_field_div(comment_form.field_comment) }} + {{ wtforms_util.render_field_div(comment_form.comment_content) }}
diff --git a/mediagoblin/user_pages/forms.py b/mediagoblin/user_pages/forms.py index b234d739..8829b674 100644 --- a/mediagoblin/user_pages/forms.py +++ b/mediagoblin/user_pages/forms.py @@ -1,21 +1,22 @@ -# 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 . - -import wtforms - -class MediaCommentForm(wtforms.Form): - field_comment = wtforms.TextAreaField('Comment', - [wtforms.validators.Required()]) +# 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 . + +import wtforms + +class MediaCommentForm(wtforms.Form): + comment_content = wtforms.TextAreaField( + 'Comment', + [wtforms.validators.Required()]) diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py index ca1060a3..a3172ebd 100644 --- a/mediagoblin/user_pages/views.py +++ b/mediagoblin/user_pages/views.py @@ -124,7 +124,7 @@ def media_post_comment(request): comment = request.db.MediaComment() comment['media_entry'] = ObjectId(request.matchdict['media']) comment['author'] = request.user['_id'] - comment['content'] = request.POST['field_comment'] + comment['content'] = request.POST['comment_content'] comment['content_html'] = cleaned_markdown_conversion(comment['content']) From 7fb39157e0e4e5610dc8cfaf6c91278688d2d977 Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Fri, 8 Jul 2011 15:14:27 +0200 Subject: [PATCH 22/38] Remove p style; not need yet --- mediagoblin/static/css/base.css | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 18a60f50..02fa3469 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -33,11 +33,6 @@ h2{ margin-top:20px; } -p { - font-family: sans-serif; - font-size:16px; -} - a { color: #fff; } From cdc8cb285dc4aec215cac763d423c6c7e12d0926 Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Fri, 8 Jul 2011 15:22:15 +0200 Subject: [PATCH 23/38] Added sidebar to profile page; moved some content --- mediagoblin/static/css/base.css | 8 ------ .../mediagoblin/user_pages/user.html | 5 ++++ .../templates/mediagoblin/utils/profile.html | 25 ++++++++----------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 02fa3469..9dc6444b 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -257,11 +257,3 @@ ul.mediagoblin_messages { background-color: #f7f7f7; color:#272727; } - -/* profile stuff */ - -.profile_content { - padding: 6px; - background-color: #393939; - margin-bottom: 10px; -} diff --git a/mediagoblin/templates/mediagoblin/user_pages/user.html b/mediagoblin/templates/mediagoblin/user_pages/user.html index aed330c8..97a882c6 100644 --- a/mediagoblin/templates/mediagoblin/user_pages/user.html +++ b/mediagoblin/templates/mediagoblin/user_pages/user.html @@ -28,6 +28,7 @@ {% if user %}

{{ user.username }}'s profile

+
{% include "mediagoblin/utils/profile.html" %} {% if request.user['_id'] == user['_id'] or request.user['is_admin'] %} @@ -40,6 +41,8 @@ Submit an item

{% endif %} +
+
{% set pagination_base_url = user_gallery_url %} {% include "mediagoblin/utils/object_gallery.html" %} @@ -55,4 +58,6 @@ {# This *should* not occur as the view makes sure we pass in a user. #}

Sorry, no such user found.

{% endif %} + +

{% endblock %} diff --git a/mediagoblin/templates/mediagoblin/utils/profile.html b/mediagoblin/templates/mediagoblin/utils/profile.html index cd60bbfc..f44defa5 100644 --- a/mediagoblin/templates/mediagoblin/utils/profile.html +++ b/mediagoblin/templates/mediagoblin/utils/profile.html @@ -17,19 +17,14 @@ #} {% block profile_content -%} - {% if user.url or user.bio %} -
- {% if user.url %} - - {% endif %} - - {% if user.bio %} -
- {{ user.bio }} -
- {% endif %} -
+ {% if user.bio %} +

+ {{ user.bio }} +

{% endif %} -{% endblock %} + {% if user.url %} +

+ {{ user.url }} +

+ {% endif %} +{% endblock %} From 681e137194ec68632e0feb54955f2e23c0c7ed71 Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Fri, 8 Jul 2011 15:53:45 +0200 Subject: [PATCH 24/38] Moved Submit button to header, styled button --- mediagoblin/static/css/base.css | 17 +++++++ mediagoblin/templates/mediagoblin/base.html | 6 ++- .../mediagoblin/user_pages/user.html | 51 +++++++------------ 3 files changed, 41 insertions(+), 33 deletions(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 9dc6444b..1cc26cad 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -56,6 +56,23 @@ label { margin-bottom:40px; } +.header_submit{ + background-color:#aaa; + background-image: -webkit-gradient(linear, left top, left bottom, from(##D2D2D2), to(#aaa)); + background-image: -webkit-linear-gradient(top, #D2D2D2, #aaa); + background-image: -moz-linear-gradient(top, #D2D2D2, #aaa); + background-image: -ms-linear-gradient(top, #D2D2D2, #aaa); + background-image: -o-linear-gradient(top, #D2D2D2, #aaa); + background-image: linear-gradient(top, #D2D2D2, #aaa); + box-shadow:0px 0px 4px #000; + color:#272727; + border-radius:5px 5px 5px 5px; + padding:5px 8px; + text-decoration:none; + border:medium none; + font-family:'Carter One',arial,serif; +} + .mediagoblin_footer { width:100%; height:26px; diff --git a/mediagoblin/templates/mediagoblin/base.html b/mediagoblin/templates/mediagoblin/base.html index b71fca24..d6890ac0 100644 --- a/mediagoblin/templates/mediagoblin/base.html +++ b/mediagoblin/templates/mediagoblin/base.html @@ -39,7 +39,11 @@
{% block mediagoblin_logo %} - {% endblock %}{% block mediagoblin_header_title %}{% endblock %} + {% endblock %} + {% if request.user %} + Submit media + {% endif %} + {% block mediagoblin_header_title %}{% endblock %}
{% if request.user %} - {% include "mediagoblin/utils/profile.html" %} - - {% if request.user['_id'] == user['_id'] or request.user['is_admin'] %} - Edit profile - {% endif %} - - {% if request.user['_id'] == user['_id'] %} -

- Submit an item -

- {% endif %} +

{{ user.username }}'s profile

+
+ {% include "mediagoblin/utils/profile.html" %} + {% if request.user['_id'] == user['_id'] or request.user['is_admin'] %} + Edit profile + {% endif %} +
+
+ {% set pagination_base_url = user_gallery_url %} + {% include "mediagoblin/utils/object_gallery.html" %} +
+

View all of {{ user.username }}'s media

+ atom feed + {% else %} + {# This *should* not occur as the view makes sure we pass in a user. #} +

Sorry, no such user found.

-
- - {% set pagination_base_url = user_gallery_url %} - {% include "mediagoblin/utils/object_gallery.html" %} - -
- -

View all of {{ user.username }}'s media

- - atom feed - {% else %} - {# This *should* not occur as the view makes sure we pass in a user. #} -

Sorry, no such user found.

{% endif %} - -

{% endblock %} From 8d74ec4dde8b7afca11f3e8fad3d775849f5b06a Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Fri, 8 Jul 2011 16:01:07 +0200 Subject: [PATCH 25/38] Fix logo styling, positioning --- mediagoblin/static/css/base.css | 18 +++--------------- mediagoblin/static/images/icon.png | Bin 1670 -> 0 bytes mediagoblin/static/images/logo.png | Bin 0 -> 839 bytes mediagoblin/templates/mediagoblin/base.html | 2 +- 4 files changed, 4 insertions(+), 16 deletions(-) delete mode 100644 mediagoblin/static/images/icon.png create mode 100644 mediagoblin/static/images/logo.png diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 1cc26cad..10f9e223 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -57,6 +57,7 @@ label { } .header_submit{ + color:#272727; background-color:#aaa; background-image: -webkit-gradient(linear, left top, left bottom, from(##D2D2D2), to(#aaa)); background-image: -webkit-linear-gradient(top, #D2D2D2, #aaa); @@ -65,9 +66,9 @@ label { background-image: -o-linear-gradient(top, #D2D2D2, #aaa); background-image: linear-gradient(top, #D2D2D2, #aaa); box-shadow:0px 0px 4px #000; - color:#272727; border-radius:5px 5px 5px 5px; - padding:5px 8px; + margin:8px; + padding:3px 8px; text-decoration:none; border:medium none; font-family:'Carter One',arial,serif; @@ -89,19 +90,6 @@ label { padding-bottom:74px; } -a.mediagoblin_logo { - width:34px; - height:25px; - margin-right:10px; - background-image:url('../images/icon.png'); - background-position:0px 0px; - display:inline-block; -} - -a.mediagoblin_logo:hover { - background-position:0px -28px; -} - .mediagoblin_header_right { float:right; } diff --git a/mediagoblin/static/images/icon.png b/mediagoblin/static/images/icon.png deleted file mode 100644 index 4f4f3e9c3c1b43c0f4149e031b69e34b2e9ce95b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1670 zcmV;126_33P)#|Q!@^B~073qN zAPA6(K!8+9;UXVJ3L{7*qzHsShJ!%=fm;;@oB#q+xijJ}F=7~rn;?co(jq09JDi=} zop(~q>~cxYK2r7j{q2kHdITNd zYTJOBZF*zJu4aq+e!nsXgF)+QG}xRbnb?VZcFOwQJkOWYG+mxdCJXMqU}g(dRV}#t z0?_GpyYB#`X}S`-ely$Z00yi?Cj76hzbwmNNO~K{k|ZI7fO~zol4dsbiM|66LRc}g zRw7kZZTa5b-U^VkO$Z@;-qtVaRp2Zh`($dkdo(iLecQ7vTZ>IFv(3oR?K6-#L zHmTd~ZhHvf)(H!3Juf1XV*3n%!X>r(2h@osGISF8dF;#)iS4rs;AR#Ls}RB$5rSuW zNzOlrnZ&&sm=p`;>&kas$rK~+_Q(P%VST3X71QDnWFZJm;8 zB0wyBTm1vr%d+fPHP`F)5}?1ozkef1lEtd3t|duwt0}r(CKA5069JYY8!i+@alffa zQ=liQZ)S@?A6RVK)b0Yf`z*VjrN)u;WJ=^(WX_72{ptw&Qx`rjrYGXWPvlY%LYNU* zevw3g|3ZB==PkEJO)Fde9ZG4%xrNy9($Um z6)=`GmNX6_Osc9HUA=mBy2+Sx)~RQOU7&jZT5ysKyb$hx`Y_vttiM0(mhM^NmIX_? zXdK-uOuR5j-2LR;8%&ZvWAqG5g;G!|S!%8n&2mX+QrIyqpDekY>z+~Um~6$b}^nBmJ8(= zIascs+)*y`9Fz-{$by?yGTlRMFF)!Zojjg5`!+|S$K z?#J)lYaeN}udwLVj2XUn=k<+U0A9N&g&AUXYps2;=+}VJo%M#qSH%5KA7+SN+nCX4 zUsLo%S_Rfcus1HEYC&kTxtjKn{Lw?5*Q}X5eQnvyw$Fh#o8IduWWg=} z&$qMH=~^v_UCmj;{Xpr3sg=)k1z}ePiUI@~Ag^MEhD?f*gXxOzBxXhtxHz`w2B`)vkR7XVSj1 zF#jN@XkSA7Ye3RDM&wT)Jm?YmD0l4l@&oOwQ?xI#sE=HERvaUe_q#78hr@6LHUJHT z<%R|r`-nYH^xFFS7{?yu z@Q&@#X-p-jxEaYJt^Uz${OI@Zzu$SZ%;F#Z@z=gAEPCqwgs@o2`i>TnmW1DyX$|S7 znZ44M&kjz+>{@HaGj84e*I)jQks!ISuAx5IBB+1mCRwe|n$NHy5CEGMn+6C|V@Hze z!HJ-D?JIhq?@kx6*-Fn>epquNPF#dv3Zw%O9u411f$I~fqb8@;BSwAU<5@E%Xr^gv zJu6B%B~od4DKs>rRHJ7dKd_xrvH}Z*f{lTZn-%gM)2RW_Hxe%Yy Q$p8QV07*qoM6N<$f&>RAdH?_b diff --git a/mediagoblin/static/images/logo.png b/mediagoblin/static/images/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..cf28a6d4118a823c937235335ac6e03cee5f1df3 GIT binary patch literal 839 zcmV-N1GxN&P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01egv01egwkZ*aM00007bV*G`2ipe- z4L30gxPk5f00PHJL_t(Y$HiB{Zqq;zeKWReJ5ETOmKIcT=Ti`0z?mb0FG1>sKj=^N zAGmVkhCnDuNkd5-+i`Xu2kah!e7>0kFg@a8-YwevJF-ejPABYM* zfQ};~eXVp?Y6ew)|5>Kf=|RJGziu+FhovS(&Oj)G!Q>8%nqD*m|}lHO4FYsWZP(G*oNtNmJ{6 zC?F(VesTbrlI%4^#8tW{TLKxa0CD-b0ss{eXIWWmFC754`jcFJ5fM3T1VZwlfkc~t z>^1#njnqF@ZjYLP_^NvBs_!riZvn}&?ATR?m6QNx045|q-__nlcly2iRN3@`0Q)zJ0SRlduJ0O&d#wz4eyP|c(PfS6<=B5eQ(fOfTNJ*s%M?5^9)I3&k4 zkVlSZdLr_64gG^pXLUrhAtL`pthGxZ`#T<-ztpL@@3=LuR@8U%p>P?9W3me$&ZF=pQBbZRH%edp9|
{% block mediagoblin_logo %} - + {% endblock %} {% if request.user %} Submit media From aa84bdd09ee15c6313e1f918c254174d0ed29d40 Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Fri, 8 Jul 2011 16:03:17 +0200 Subject: [PATCH 26/38] Tiny padding fix for forms/h1 --- mediagoblin/static/css/base.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 10f9e223..2bc9ef6b 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -134,7 +134,7 @@ text-align:center; background-repeat:repeat-x; font-size:18px; padding-bottom:30px; - padding-top:1px; + padding-top:30px; margin-left:auto; margin-right:auto; display:block; From 77e63c8f2ebdc1ab61c1e514a489dd392383f22b Mon Sep 17 00:00:00 2001 From: Jef van Schendel Date: Fri, 8 Jul 2011 16:05:20 +0200 Subject: [PATCH 27/38] Tiny height fix to footer --- mediagoblin/static/css/base.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css index 2bc9ef6b..31b8ebc2 100644 --- a/mediagoblin/static/css/base.css +++ b/mediagoblin/static/css/base.css @@ -76,7 +76,7 @@ label { .mediagoblin_footer { width:100%; - height:26px; + height:30px; background-color:#2F2F2F; bottom:0px; padding-top:8px; From eedc5428fd4fa775405084c74baa186d9c41efda Mon Sep 17 00:00:00 2001 From: Rasmus Larsson Date: Sat, 9 Jul 2011 02:47:06 +0200 Subject: [PATCH 28/38] Removed route, view and template file for "Submit Success" page --- mediagoblin/submit/routing.py | 5 +---- mediagoblin/submit/views.py | 5 ----- .../templates/mediagoblin/submit/success.html | 22 ------------------- 3 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 mediagoblin/templates/mediagoblin/submit/success.html diff --git a/mediagoblin/submit/routing.py b/mediagoblin/submit/routing.py index 3edbab70..5585ecb0 100644 --- a/mediagoblin/submit/routing.py +++ b/mediagoblin/submit/routing.py @@ -18,7 +18,4 @@ from routes.route import Route submit_routes = [ Route('mediagoblin.submit.start', '/', - controller='mediagoblin.submit.views:submit_start'), - Route('mediagoblin.submit.success', '/success/', - template='mediagoblin/submit/success.html', - controller='mediagoblin.views:simple_template_render')] + controller='mediagoblin.submit.views:submit_start')] diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py index 4c7476b0..1848f5e5 100644 --- a/mediagoblin/submit/views.py +++ b/mediagoblin/submit/views.py @@ -95,8 +95,3 @@ def submit_start(request): request, 'mediagoblin/submit/start.html', {'submit_form': submit_form}) - - -def submit_success(request): - return render_to_response( - request, 'mediagoblin/submit/success.html', {}) diff --git a/mediagoblin/templates/mediagoblin/submit/success.html b/mediagoblin/templates/mediagoblin/submit/success.html deleted file mode 100644 index afc9f9d1..00000000 --- a/mediagoblin/templates/mediagoblin/submit/success.html +++ /dev/null @@ -1,22 +0,0 @@ -{# -# 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 . -#} -{% extends "mediagoblin/base.html" %} - -{% block mediagoblin_content %} - Woohoo! Submitted! -{% endblock %} From 13677ef97a24fea19fe8df1cce4812c18623d88f Mon Sep 17 00:00:00 2001 From: Rasmus Larsson Date: Sat, 9 Jul 2011 15:12:00 +0200 Subject: [PATCH 29/38] Added configuration variable to toggle registrations, if disabled the registration page redirects to index and no link to register is shown --- mediagoblin.ini | 3 +++ mediagoblin/auth/views.py | 6 ++++++ mediagoblin/config_spec.ini | 5 ++++- mediagoblin/templates/mediagoblin/root.html | 2 ++ mediagoblin/views.py | 4 +++- 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/mediagoblin.ini b/mediagoblin.ini index 596107dc..e889646a 100644 --- a/mediagoblin.ini +++ b/mediagoblin.ini @@ -8,6 +8,9 @@ email_sender_address = "notice@mediagoblin.example.org" # set to false to enable sending notices email_debug_mode = true +# Set to false to disable registrations +allow_registration = true + ## Uncomment this to put some user-overriding templates here #local_templates = %(here)s/user_dev/templates/ diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 2450023f..a6ae1407 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -19,6 +19,7 @@ import uuid from webob import exc from mediagoblin import messages +from mediagoblin import mg_globals from mediagoblin.util import render_to_response, redirect from mediagoblin.db.util import ObjectId from mediagoblin.auth import lib as auth_lib @@ -30,6 +31,11 @@ def register(request): """ Your classic registration view! """ + + # Redirects to indexpage if registrations are disabled + if not mg_globals.app_config["allow_registration"]: + return redirect(request, "index") + register_form = auth_forms.RegistrationForm(request.POST) if request.method == 'POST' and register_form.validate(): diff --git a/mediagoblin/config_spec.ini b/mediagoblin/config_spec.ini index aadf5c21..b6356b0e 100644 --- a/mediagoblin/config_spec.ini +++ b/mediagoblin/config_spec.ini @@ -21,6 +21,9 @@ direct_remote_path = string(default="/mgoblin_static/") email_debug_mode = boolean(default=True) email_sender_address = string(default="notice@mediagoblin.example.org") +# Set to false to disable registrations +allow_registration = boolean(default=True) + # By default not set, but you might want something like: # "%(here)s/user_dev/templates/" local_templates = string() @@ -73,4 +76,4 @@ celeryd_eta_scheduler_precision = float() # known lists celery_routes = string_list() -celery_imports = string_list() \ No newline at end of file +celery_imports = string_list() diff --git a/mediagoblin/templates/mediagoblin/root.html b/mediagoblin/templates/mediagoblin/root.html index 5b744999..ad9aabcb 100644 --- a/mediagoblin/templates/mediagoblin/root.html +++ b/mediagoblin/templates/mediagoblin/root.html @@ -29,10 +29,12 @@ If you have an account, you can Login.

+ {% if allow_registration %}

If you don't have an account, please Register.

+ {% endif %} {% endif %} {# temporarily, an "image gallery" that isn't one really ;) #} diff --git a/mediagoblin/views.py b/mediagoblin/views.py index 5b6d9773..6145484b 100644 --- a/mediagoblin/views.py +++ b/mediagoblin/views.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from mediagoblin import mg_globals from mediagoblin.util import render_to_response from mediagoblin.db.util import DESCENDING @@ -23,7 +24,8 @@ def root_view(request): return render_to_response( request, 'mediagoblin/root.html', - {'media_entries': media_entries}) + {'media_entries': media_entries, + 'allow_registration': mg_globals.app_config["allow_registration"]}) def simple_template_render(request): From 13bb1d676e3363605d87acd34bdb6b701ec467dd Mon Sep 17 00:00:00 2001 From: Rasmus Larsson Date: Sat, 9 Jul 2011 15:19:55 +0200 Subject: [PATCH 30/38] Updated the loginpage to not show a link to register if registrations are disabled --- mediagoblin/auth/views.py | 3 ++- mediagoblin/templates/mediagoblin/auth/login.html | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index a6ae1407..01bfc066 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -104,7 +104,8 @@ def login(request): 'mediagoblin/auth/login.html', {'login_form': login_form, 'next': request.GET.get('next') or request.POST.get('next'), - 'login_failed': login_failed}) + 'login_failed': login_failed, + 'allow_registration': mg_globals.app_config["allow_registration"]}) def logout(request): diff --git a/mediagoblin/templates/mediagoblin/auth/login.html b/mediagoblin/templates/mediagoblin/auth/login.html index 2303ce5c..ebf5200a 100644 --- a/mediagoblin/templates/mediagoblin/auth/login.html +++ b/mediagoblin/templates/mediagoblin/auth/login.html @@ -35,7 +35,9 @@ {% endif %} + {% if allow_registration %}

Don't have an account yet?
Create one here!

+ {% endif %}
{% endblock %} From 5647d641a27b1ebd9f9de4c8b6c452d80be0f4a2 Mon Sep 17 00:00:00 2001 From: Rasmus Larsson Date: Sat, 9 Jul 2011 15:52:30 +0200 Subject: [PATCH 31/38] Updated spacings in code for better readability --- mediagoblin/templates/mediagoblin/auth/login.html | 2 +- mediagoblin/templates/mediagoblin/root.html | 8 ++++---- mediagoblin/views.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mediagoblin/templates/mediagoblin/auth/login.html b/mediagoblin/templates/mediagoblin/auth/login.html index ebf5200a..e25783ea 100644 --- a/mediagoblin/templates/mediagoblin/auth/login.html +++ b/mediagoblin/templates/mediagoblin/auth/login.html @@ -36,7 +36,7 @@ style="display: none;"/> {% endif %} {% if allow_registration %} -

Don't have an account yet?
Create one here!

+

Don't have an account yet?
Create one here!

{% endif %}
diff --git a/mediagoblin/templates/mediagoblin/root.html b/mediagoblin/templates/mediagoblin/root.html index ad9aabcb..bae033c4 100644 --- a/mediagoblin/templates/mediagoblin/root.html +++ b/mediagoblin/templates/mediagoblin/root.html @@ -30,10 +30,10 @@ Login.

{% if allow_registration %} -

- If you don't have an account, please - Register. -

+

+ If you don't have an account, please + Register. +

{% endif %} {% endif %} diff --git a/mediagoblin/views.py b/mediagoblin/views.py index 6145484b..e7d9dbdd 100644 --- a/mediagoblin/views.py +++ b/mediagoblin/views.py @@ -25,7 +25,7 @@ def root_view(request): return render_to_response( request, 'mediagoblin/root.html', {'media_entries': media_entries, - 'allow_registration': mg_globals.app_config["allow_registration"]}) + 'allow_registration': mg_globals.app_config["allow_registration"]}) def simple_template_render(request): From 166dc91aca21048e235dec126c0518a807fead41 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 9 Jul 2011 09:02:17 -0500 Subject: [PATCH 32/38] Add a warning to the user that registrations are disabled. --- mediagoblin/auth/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 01bfc066..7facc1bf 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -31,9 +31,12 @@ def register(request): """ Your classic registration view! """ - # Redirects to indexpage if registrations are disabled if not mg_globals.app_config["allow_registration"]: + messages.add_message( + request, + messages.WARNING, + ('Sorry, registration is disabled on this instance.')) return redirect(request, "index") register_form = auth_forms.RegistrationForm(request.POST) From 7b31a11c80afa4f7e819ca102553e5de5c2e4746 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 9 Jul 2011 09:02:57 -0500 Subject: [PATCH 33/38] Removing trailing whitespace from this file --- mediagoblin/auth/views.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 7facc1bf..7fe507b1 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -61,7 +61,7 @@ def register(request): entry['pw_hash'] = auth_lib.bcrypt_gen_password_hash( request.POST['password']) entry.save(validate=True) - + send_verification_email(entry, request) return redirect(request, "mediagoblin.auth.register_success") @@ -114,7 +114,7 @@ def login(request): def logout(request): # Maybe deleting the user_id parameter would be enough? request.session.delete() - + return redirect(request, "index") @@ -138,16 +138,16 @@ def verify_email(request): user.save() verification_successful = True messages.add_message( - request, - messages.SUCCESS, + request, + messages.SUCCESS, ('Your email address has been verified. ' 'You may now login, edit your profile, and submit images!')) else: verification_successful = False - messages.add_message(request, - messages.ERROR, - 'The verification key or user id is incorrect') - + messages.add_message(request, + messages.ERROR, + 'The verification key or user id is incorrect') + return render_to_response( request, 'mediagoblin/user_pages/user.html', From 50bb8fe5e44eae5974121e9b518d373205251eb9 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 9 Jul 2011 16:51:19 -0500 Subject: [PATCH 34/38] Changing things back so that we keep information about deprecated indexes around. --- mediagoblin/db/util.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mediagoblin/db/util.py b/mediagoblin/db/util.py index 70c37945..37e6586f 100644 --- a/mediagoblin/db/util.py +++ b/mediagoblin/db/util.py @@ -81,18 +81,25 @@ def remove_deprecated_indexes(database, deprecated_indexes=DEPRECATED_INDEXES): Args: - database: pymongo or mongokit database instance. - deprecated_indexes: the indexes to deprecate in the pattern of: - {'collection': ['index_identifier1', 'index_identifier2']} + {'collection_name': { + 'identifier': { + 'index': [index_foo_goes_here], + 'unique': True}} + + (... although we really only need the 'identifier' here, as the + rest of the information isn't used in this case. But it's kept + around so we can remember what it was) Returns: A list of indexes removed in form ('collection', 'index_name') """ indexes_removed = [] - for collection_name, index_names in deprecated_indexes.iteritems(): + for collection_name, indexes in deprecated_indexes.iteritems(): collection = database[collection_name] collection_indexes = collection.index_information().keys() - for index_name in index_names: + for index_name, index_data in indexes.iteritems(): if index_name in collection_indexes: collection.drop_index(index_name) From 7ecb1b0726c1ebdafa62af3eb21d31b02ab79a8c Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 9 Jul 2011 16:52:57 -0500 Subject: [PATCH 35/38] Adjusting documentation in indexes.py also re: more info in deprecation --- mediagoblin/db/indexes.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mediagoblin/db/indexes.py b/mediagoblin/db/indexes.py index d379a52b..a832e013 100644 --- a/mediagoblin/db/indexes.py +++ b/mediagoblin/db/indexes.py @@ -45,11 +45,13 @@ REQUIRED READING: To remove deprecated indexes ---------------------------- -Removing deprecated indexes is easier, just do: +Removing deprecated indexes is the same, just move the index into the +deprecated indexes mapping. -INACTIVE_INDEXES = { - 'collection_name': [ - 'deprecated_index_identifier1', 'deprecated_index_identifier2']} +DEPRECATED_INDEXES = { + 'collection_name': { + 'deprecated_index_identifier1': { + 'index': [index_foo_goes_here]}} ... etc. From 1fd97db348fb8eb7b455f4f991fe73143611a945 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 9 Jul 2011 17:11:23 -0500 Subject: [PATCH 36/38] Added a note about workbench only currently being used by celery --- mediagoblin/app.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mediagoblin/app.py b/mediagoblin/app.py index c5fcc1dd..ae39694f 100644 --- a/mediagoblin/app.py +++ b/mediagoblin/app.py @@ -104,6 +104,9 @@ class MediaGoblinApp(object): database=self.db, public_store=self.public_store, queue_store=self.queue_store) + + # Workbench *currently* only used by celery, so this only + # matters in always eager mode :) setup_workbench() def __call__(self, environ, start_response): From f4cd7a4ade374bdace27d8f0216f36c96c652efc Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 9 Jul 2011 17:13:21 -0500 Subject: [PATCH 37/38] Oh well... Did I really have this wtforms cruft in my setup_workbench commit. :-( I don't know even, how it got in there. :-| --- mediagoblin/edit/forms.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mediagoblin/edit/forms.py b/mediagoblin/edit/forms.py index 0ed52af1..fdbd5c75 100644 --- a/mediagoblin/edit/forms.py +++ b/mediagoblin/edit/forms.py @@ -32,5 +32,4 @@ class EditProfileForm(wtforms.Form): [wtforms.validators.Length(min=0, max=500)]) url = wtforms.TextField( 'Website', - [wtforms.validators.Optional(), - wtforms.validators.URL(message='Improperly formed URL')]) + [wtforms.validators.URL(message='Improperly formed URL')]) From 3054e2b3cb08839aca7da2e1c5b4cce1768bf705 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 9 Jul 2011 17:16:18 -0500 Subject: [PATCH 38/38] Sorry, that OptionalField belonged there. I am a bad person and am not allowed to commit anything else today. --- mediagoblin/edit/forms.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mediagoblin/edit/forms.py b/mediagoblin/edit/forms.py index fdbd5c75..0ed52af1 100644 --- a/mediagoblin/edit/forms.py +++ b/mediagoblin/edit/forms.py @@ -32,4 +32,5 @@ class EditProfileForm(wtforms.Form): [wtforms.validators.Length(min=0, max=500)]) url = wtforms.TextField( 'Website', - [wtforms.validators.URL(message='Improperly formed URL')]) + [wtforms.validators.Optional(), + wtforms.validators.URL(message='Improperly formed URL')])