Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
    def __call__(self, *args, **kargs):
        """Makes our controller a callable to handle requests
        
        This is called when dispatched to as the Controller class docs explain
        more fully.
        
        """
        self._req = pylons.request.current_obj()
        
        # Keep private methods private
        if self._req.environ['pylons.routes_dict'].get('action').startswith('_'):
            return pylons.Response(code=404)
        
        if hasattr(self, '__before__'):
            self._inspect_call(self.__before__, **kargs)
        response = self._dispatch_call()
        if hasattr(self, '__after__'):
            self._inspect_call(self.__after__)
        return response