
from webob import dec

from restalchemy.api import resources
from restalchemy.api import routes


DEFAULT_CONTENT_TYPE = 'application/json'


class WSGIApp(object):

    def __init__(self, route_class):
        super(WSGIApp, self).__init__()
        self._main_route = routes.route(route_class)
        resources.ResourceMap.set_resource_map(
            routes.Route.build_resource_map(route_class))

    @dec.wsgify
    def __call__(self, req):
        return self._main_route(req).do()


Application = WSGIApp


from webob import dec

from restalchemy.api import resources
from restalchemy.api import routes


DEFAULT_CONTENT_TYPE = 'application/json'


class WSGIApp(object):

    def __init__(self, route_class):
        super(WSGIApp, self).__init__()
        self._main_route = routes.route(route_class)
        resources.ResourceMap.set_resource_map(
            routes.Route.build_resource_map(route_class))

    def process_request(self, req):
        return self._main_route(req).do()

    @dec.wsgify
    def __call__(self, req):
        return self.process_request(req)


Application = WSGIApp

Add process_request method to Application
Add process_request method to Application

This allows to override a process_request method without having to
add webob to child project.

Change-Id: Ic5369076704f1ba459b2872ed0f4632a15b75c25

  
  from webob import dec
  
  from restalchemy.api import resources
  from restalchemy.api import routes
  
  
  DEFAULT_CONTENT_TYPE = 'application/json'
  
  
  class WSGIApp(object):
  
      def __init__(self, route_class):
          super(WSGIApp, self).__init__()
          self._main_route = routes.route(route_class)
          resources.ResourceMap.set_resource_map(
              routes.Route.build_resource_map(route_class))
  
+     def process_request(self, req):
+         return self._main_route(req).do()
+ 
      @dec.wsgify
      def __call__(self, req):
-         return self._main_route(req).do()
+         return self.process_request(req)
  
  
  Application = WSGIApp
  
Add process_request method to Application
## Code Before:

from webob import dec

from restalchemy.api import resources
from restalchemy.api import routes


DEFAULT_CONTENT_TYPE = 'application/json'


class WSGIApp(object):

    def __init__(self, route_class):
        super(WSGIApp, self).__init__()
        self._main_route = routes.route(route_class)
        resources.ResourceMap.set_resource_map(
            routes.Route.build_resource_map(route_class))

    @dec.wsgify
    def __call__(self, req):
        return self._main_route(req).do()


Application = WSGIApp

## Instruction:
Add process_request method to Application
## Code After:

from webob import dec

from restalchemy.api import resources
from restalchemy.api import routes


DEFAULT_CONTENT_TYPE = 'application/json'


class WSGIApp(object):

    def __init__(self, route_class):
        super(WSGIApp, self).__init__()
        self._main_route = routes.route(route_class)
        resources.ResourceMap.set_resource_map(
            routes.Route.build_resource_map(route_class))

    def process_request(self, req):
        return self._main_route(req).do()

    @dec.wsgify
    def __call__(self, req):
        return self.process_request(req)


Application = WSGIApp
