On Mon, 2007-17-12 at 21:34 +0100, Alberto Valverde wrote:
> Hi,
> 
> I've just ported tg.redirect and tg.flash to TG2. I've lightly
> unittested it (and updated the unittests on the way so they work with
> latest Pylons-dev) and they seem to work but some "real-app" testing +
> feedback won't hurt at all (hint, hint ;).
> 
> Some notes:
> 
> 1) middleware.py should be updated to match the changes I made in the
> quickstart template, that is, httpexceptions' middleware should be
> stacked or else raising httpexceptions won't do any good. BTW, I wonder
> why this needs to be done at all and if pylons' abort() worked at all
> before the change? Any ideas why middleware.py didn't stack
> httpexceptions before?

Thanks for getting on that so fast!

I just did a wipe and fresh checkout of tg2 and tried redirect, but am
still getting a pylons error page.

Code:
from app1b.lib.base import BaseController
from tg import expose, validate, redirect

from pylons.controllers.util import redirect_to

class RootController(BaseController):

    @expose()
    def redir(self):
        # tried both these        
        #raise redirect('/target')
        redirect('/target')

    @expose()
    def target(self):
        return "reached target"

Traceback:
URL: http://localhost:8080/redir
File
'/home/xornot/www/tg2_ve2/lib/python2.4/site-packages/WebError-0.8dev_20071119-py2.4.egg/weberror/evalexception/middleware.py',
 line 344 in respond
  app_iter = self.application(environ, detect_start_response)
File
'/home/xornot/www/tg2_ve2/lib/python2.4/site-packages/ToscaWidgets-0.2rc3dev_r3795-py2.4.egg/toscawidgets/middleware.py',
 line 40 in __call__
  return self.wsgi_app(environ, start_response)
File
'/home/xornot/www/tg2_ve2/lib/python2.4/site-packages/Paste-1.5.1-py2.4.egg/paste/registry.py',
 line 334 in __call__
  app_iter = self.application(environ, start_response)
File
'/home/xornot/www/tg2_ve2/lib/python2.4/site-packages/ToscaWidgets-0.2rc3dev_r3795-py2.4.egg/toscawidgets/middleware.py',
 line 55 in wsgi_app
  app_iter = self.application(environ, start_response)
File
'/usr/lib/python2.4/site-packages/Beaker-0.8.1-py2.4.egg/beaker/cache.py', line 
180 in __call__
  return self.app(environ, start_response)
File
'/usr/lib/python2.4/site-packages/Beaker-0.8.1-py2.4.egg/beaker/session.py', 
line 401 in __call__
  response = self.wrap_app(environ, session_start_response)
File '/home/xornot/www/tg2_ve2/tg2/tg/__init__.py', line 63 in __call__
  return self.root(environ, start_response)
File '/home/xornot/www/tg2_ve2/app1b/app1b/lib/base.py', line 21 in
__call__
  return TurboGearsController.__call__(self, environ, start_response)
File '/home/xornot/www/tg2_ve2/Pylons/pylons/controllers/core.py', line
188 in __call__
  response = self._dispatch_call()
File '/home/xornot/www/tg2_ve2/tg2/tg/controllers.py', line 15 in
_dispatch_call
  return self._perform_call(None, None)
File '/home/xornot/www/tg2_ve2/tg2/tg/controllers.py', line 12 in
_perform_call
  return DecoratedController._perform_call(self, controller, params,
remainder=remainder)
File '/home/xornot/www/tg2_ve2/Pylons/pylons/controllers/decorated.py',
line 108 in _perform_call
  output = controller(*remainder, **dict(params))
File '/home/xornot/www/tg2_ve2/app1b/app1b/controllers/root.py', line 16
in redir
  redirect('/target')
File '/home/xornot/www/tg2_ve2/tg2/tg/controllers.py', line 27 in
redirect
  raise found
HTTPFound: 302 Found
The resource was found at
/target





> 
> 2) To display the flash, tg.get_flash() should be called in master.html.
> The tg namespace should be imported so this is available. A patch won't
> hurt :)
> 
> The implementation is kinda hurried and quite rudimentary... but its a
> start :)
> 
> Gotta run now...
> Alberto
> 
> > 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to