Upgrade to Pylons 1.0. #283 veekun-promotions/2010082201 veekun-promotions/2010091201 veekun-promotions/2010091202 veekun-promotions/2010091501 veekun-promotions/2010091901 veekun-promotions/2010091902 veekun-promotions/2010092101 veekun-promotions/2010101501 veekun-promotions/2010101701
authorEevee <git@veekun.com>
Mon, 23 Aug 2010 00:58:50 +0000 (17:58 -0700)
committerEevee <git@veekun.com>
Mon, 23 Aug 2010 00:58:50 +0000 (17:58 -0700)
splinext/users/__init__.py
splinext/users/controllers/accounts.py
splinext/users/controllers/admin.py
splinext/users/controllers/users.py

index f01995d..e395542 100644 (file)
@@ -1,6 +1,6 @@
 from pkg_resources import resource_filename
 
-from pylons import c, config, session
+from pylons import config, session, tmpl_context as c
 
 from spline.lib.plugin import PluginBase, PluginLink, Priority
 import spline.model.meta as meta
@@ -39,7 +39,7 @@ def add_routes_hook(map, *args, **kwargs):
     # Big-boy admin
     map.connect('/admin/users/permissions', controller='admin_users', action='permissions')
 
-def monkeypatch_user_hook(*args, **kwargs):
+def monkeypatch_user_hook(config, *args, **kwargs):
     """Hook to tell the `User` model who the root user is."""
     try:
         users_model.User._root_user_id \
index c70ad6d..45d3b1e 100644 (file)
@@ -6,7 +6,7 @@ from openid.yadis.discover import DiscoveryFailure
 from sqlalchemy.orm.exc import NoResultFound
 
 from pylons import config, request, response, session, tmpl_context as c, url
-from pylons.controllers.util import abort, redirect_to
+from pylons.controllers.util import abort, redirect
 from routes import request_config
 
 from spline.model import meta
@@ -59,7 +59,7 @@ class AccountsController(BaseController):
         return_url = url(host=host, controller='accounts', action='login_finish')
         new_url = auth_request.redirectURL(return_to=return_url,
                                            realm=protocol + '://' + host)
-        redirect_to(new_url)
+        redirect(new_url)
 
     def login_finish(self):
         """Step two of logging in; the OpenID provider redirects back here."""
@@ -72,7 +72,7 @@ class AccountsController(BaseController):
         if res.status == CANCEL:
             # I guess..  just..  back to the homepage?
             h.flash(u"""Login canceled.""", icon='user-silhouette')
-            redirect_to(url('/'))
+            redirect(url('/'))
         elif res.status != SUCCESS:
             return 'Error!  %s' % res.message
 
@@ -106,7 +106,7 @@ class AccountsController(BaseController):
         h.flash(u"""Hello, {0}!""".format(user.name),
                 icon='user')
 
-        redirect_to('/', _code=303)
+        redirect(url('/'), code=303)
 
     def logout(self):
         """Logs the user out."""
@@ -118,4 +118,4 @@ class AccountsController(BaseController):
             h.flash(u"""Logged out.""",
                     icon='user-silhouette')
 
-        redirect_to('/', _code=303)
+        redirect(url('/'), code=303)
index 4497774..e85167a 100644 (file)
@@ -1,7 +1,7 @@
 import logging
 
 from pylons import config, request, response, session, tmpl_context as c, url
-from pylons.controllers.util import abort, redirect_to
+from pylons.controllers.util import abort, redirect
 
 from spline.model import meta
 from spline.lib.base import BaseController, render
index dac037b..5e3826c 100644 (file)
@@ -4,7 +4,7 @@ import unicodedata
 from wtforms import Form, ValidationError, fields, validators, widgets
 
 from pylons import config, request, response, session, tmpl_context as c, url
-from pylons.controllers.util import abort, redirect_to
+from pylons.controllers.util import abort, redirect
 from routes import request_config
 from sqlalchemy.orm.exc import NoResultFound
 
@@ -84,6 +84,8 @@ class UsersController(BaseController):
 
         h.flash('Saved your profile.', icon='tick')
 
-        redirect_to(controller='users', action='profile',
-                    id=c.page_user.id, name=c.page_user.name,
-                    _code=303)
+        redirect(
+            url(controller='users', action='profile',
+                id=c.page_user.id, name=c.page_user.name),
+            code=303,
+        )