import uuid
-from webob import Response, exc
+from webob import exc
-from mediagoblin.util import render_template
+from mediagoblin.util import render_to_response
from mediagoblin.db.util import ObjectId
from mediagoblin.auth import lib as auth_lib
from mediagoblin.auth import forms as auth_forms
location=request.urlgen("mediagoblin.auth.register_success"))
# render
- return Response(
- render_template(
+ return render_to_response(
request, 'mediagoblin/auth/register.html',
- {'register_form': register_form}))
+ {'register_form': register_form})
def register_success(request):
- return Response(
- render_template(
- request, 'mediagoblin/auth/register_success.html', {}))
+ return render_to_response(
+ request, 'mediagoblin/auth/register_success.html', {})
def login(request):
login_failed = True
# render
- return Response(
- render_template(
+ return render_to_response(
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})
def logout(request):
else:
verification_successful = False
- return Response(
- render_template(
+ return render_to_response(
request, 'mediagoblin/auth/verify_email.html',
{'user': user,
- 'verification_successful': verification_successful}))
+ 'verification_successful': verification_successful})
def verify_email_notice(request):
"""
When the user tries to do some action that requires their account
to be verified beforehand, this view is called upon!
"""
- return Response(
- render_template(
- request, 'mediagoblin/auth/verification_needed.html', {}))
+ return render_to_response(
+ request, 'mediagoblin/auth/verification_needed.html', {})
def resend_activation(request):
def resend_activation_success(request):
- return Response(
- render_template(
- request, 'mediagoblin/auth/resent_verification_email.html', {}))
+ return render_to_response(
+ request, 'mediagoblin/auth/resent_verification_email.html', {})
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from webob import Response, exc
+from webob import exc
-from mediagoblin.util import render_template
+from mediagoblin.util import render_to_response
from mediagoblin.edit import forms
from mediagoblin.edit.lib import may_edit_media
from mediagoblin.decorators import require_active_login, get_user_media_entry
user=media.uploader()['username'], media=media['slug']))
# render
- return Response(
- render_template(
+ return render_to_response(
request, 'mediagoblin/edit/edit.html',
{'media': media,
- 'form': form}))
+ 'form': form})
from os.path import splitext
from cgi import FieldStorage
-from webob import Response, exc
+from webob import exc
from werkzeug.utils import secure_filename
-from mediagoblin.util import render_template
+from mediagoblin.util import render_to_response
from mediagoblin.decorators import require_active_login
from mediagoblin.submit import forms as submit_forms
from mediagoblin.process_media import process_media_initial
location=request.urlgen("mediagoblin.submit.success"))
# render
- return Response(
- render_template(
+ return render_to_response(
request, 'mediagoblin/submit/start.html',
- {'submit_form': submit_form}))
+ {'submit_form': submit_form})
def submit_success(request):
# render
- return Response(
- render_template(
- request, 'mediagoblin/submit/success.html', {}))
+ return render_to_response(
+ request, 'mediagoblin/submit/success.html', {})
# 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/>.
-from webob import Response, exc
+from webob import exc
from mediagoblin.db.util import DESCENDING
-from mediagoblin.util import Pagination, render_template
+from mediagoblin.util import Pagination, render_to_response
from mediagoblin.decorators import uses_pagination, get_user_media_entry
if media_entries == None:
return exc.HTTPNotFound()
- return Response(
- render_template(
+ return render_to_response(
request, 'mediagoblin/user_pages/user.html',
{'user': user,
'media_entries': media_entries,
- 'pagination': pagination}))
+ 'pagination': pagination})
@get_user_media_entry
def media_home(request, media):
"""'Homepage' of a MediaEntry()"""
- return Response(
- render_template(
+ return render_to_response(
request, 'mediagoblin/user_pages/media.html',
- {'media': media}))
+ {'media': media})
ATOM_DEFAULT_NR_OF_UPDATED_ITEMS = 5
import jinja2
import translitcodec
from paste.deploy.loadwsgi import NicerConfigParser
+from webob import Response
from mediagoblin import globals as mgoblin_globals
from mediagoblin.db.util import ObjectId
TEMPLATE_TEST_CONTEXT = {}
+def render_to_response(request, template, context):
+ """Much like Django's shortcut.render()"""
+ return Response(render_template(request, template, context))
+
+
def setup_user_in_request(request):
"""
Examine a request and tack on a request.user parameter if that's
# 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/>.
-from webob import Response
-
-from mediagoblin.util import render_template
+from mediagoblin.util import render_to_response
from mediagoblin.db.util import DESCENDING
def root_view(request):
media_entries = request.db.MediaEntry.find(
{u'state': u'processed'}).sort('created', DESCENDING)
- return Response(
- render_template(
+ return render_to_response(
request, 'mediagoblin/root.html',
- {'media_entries': media_entries}))
+ {'media_entries': media_entries})