Anonymous committed 70ad297

more lookup fixes.

  • Participants
  • Parent commits 090dd51

Comments (0)

Files changed (2)

File tg/controllers/

         self.remainder = None
         self.dispatcher = None
         self.params = params
+        self._last_tried_lookup = None
         #remove the ignore params from self.params
         remove_params = pylons.config.get('ignore_parameters', [])
         #xxx: add logging?
         if hasattr(controller, '_dispatch'):
-#            print 'controller', controller
             if isclass(controller):
                 warn("this functionality is going to removed in the next minor version,"
                      " please create an instance of your sub-controller instead")
                 return state
             if self._is_exposed(controller, '_lookup'):
                 new_controller, new_remainder = controller._lookup(*remainder)
-                last_tried_abstraction = getattr(self, '_last_tried_abstraction', None)
-                if type(last_tried_abstraction) != type(new_controller):
+                last_tried_lookup = getattr(self, '_last_tried_lookup', None)
+                if type(last_tried_lookup) != type(new_controller):
                     self._last_tried_abstraction = new_controller
                     state.add_controller(remainder[0], new_controller)
                     return self._dispatch(state, new_remainder)
         This method defines how the object dispatch mechanism works, including
         checking for security along the way.
         current_controller = state.controller
         if hasattr(current_controller, '_check_security'):
             return self._dispatch_first_found_default_or_lookup(state, remainder)
         current_path = remainder[0]
         #an exposed method matching the path is found
         if self._is_exposed(current_controller, current_path):
             #check to see if the argspec jives

File tg/tests/

     def _lookup(self, *args):
-        print args
-        return LookupHelperWithArgs(), args
+        l = LookupHelperWithArgs()
+#        print 'inside _lookup', l, args
+        return l, args
 class LoookupController(TGController):
         assert 'some_url' in r
 class TestTGController(TestWSGIController):
-    def __init__(self, *args, **kargs):
-        TestWSGIController.__init__(self, *args, **kargs)
+    def setUp(self, *args, **kargs):
+        TestWSGIController.setUp(self, *args, **kargs) = make_app(BasicTGController)
     def test_lookup(self):