Example #1
0
    def __init__(self, accept):
        from sys import exc_info
        from ZPublisher import publish_module
        from ZPublisher.WSGIPublisher import publish_module as publish_wsgi
        while 1:
            try:
                name, a, b = accept()
                if name == "Zope2":
                    try:
                        publish_module(name, request=a, response=b)
                    finally:
                        b._finish()
                        a = b = None

                elif name == "Zope2WSGI":
                    try:
                        res = publish_wsgi(a, b)
                        for r in res:
                            a['wsgi.output'].write(r)
                    finally:
                        # TODO: Support keeping connections open.
                        a['wsgi.output']._close = 1
                        a['wsgi.output'].close()
            except:
                LOG.error('exception caught', exc_info=True)
    def ZServerPublisher__init__(self, accept):
        from sys import exc_info
        from ZPublisher import publish_module
        from ZPublisher.WSGIPublisher import publish_module as publish_wsgi
        while 1:
          try:
            name, a, b=accept()
            if name == "Zope2WSGI":
                try:
                    res = publish_wsgi(a, b)
                    for r in res:
                        a['wsgi.output'].write(r)
                finally:
                    # TODO: Support keeping connections open.
                    a['wsgi.output']._close = 1
                    a['wsgi.output'].close()
            else: # originally "if name == "Zope2"
                try:
                    publish_module(
                        name,
                        request=a,
                        response=b)
                finally:
                    b._finish()
                    a=b=None

          except:
            LOG.error('exception caught', exc_info=True)
 def __init__(self, accept):
     while 1:
         try:
             name, request, response=accept()
             publish_module(
                 name,
                 request=request,
                 response=response)
         finally:
             response._finish()
             request=response=None
Example #4
0
def newrelic__init__(self, accept):
    from sys import exc_info
    from ZPublisher import publish_module
    from ZPublisher.WSGIPublisher import publish_module as publish_wsgi
    trans = None
    while 1:
        try:
            name, a, b = accept()
            if name == "Zope2":

                try:
                    application = newrelic.api.application.application_instance(
                    )
                    environ = {}
                    trans = newrelic.api.web_transaction.WebTransaction(
                        application, environ)
                    trans.name_transaction(PLACEHOLDER,
                                           group='Zope2',
                                           priority=1)
                    trans.__enter__()

                    publish_module(name, request=a, response=b)
                finally:
                    b._finish()
                    if trans:
                        if trans.name == 'PLACEHOLDER':
                            newrelic.agent.ignore_transaction()
                        trans.__exit__(None, None, None)
                    a = b = None

            elif name == "Zope2WSGI":
                try:
                    res = publish_wsgi(a, b)
                    for r in res:
                        a['wsgi.output'].write(r)
                finally:
                    # TODO: Support keeping connections open.
                    a['wsgi.output']._close = 1
                    a['wsgi.output'].close()
        except:
            LOG.error('exception caught', exc_info=True)
def newrelic__init__(self, accept):
    from sys import exc_info
    from ZPublisher import publish_module
    from ZPublisher.WSGIPublisher import publish_module as publish_wsgi
    trans = None
    while 1:
        try:
            name, a, b = accept()
            if name == "Zope2":

                try:
                    application = newrelic.api.application.application_instance()
                    environ = {}
                    trans = newrelic.api.web_transaction.WebTransaction(application, environ)
                    trans.name_transaction(PLACEHOLDER, group='Zope2', priority=1)
                    trans.__enter__()

                    publish_module(
                        name,
                        request=a,
                        response=b)
                finally:
                    b._finish()
                    if trans:
                        if trans.name == 'PLACEHOLDER':
                            newrelic.agent.ignore_transaction()
                        trans.__exit__(None, None, None)
                    a = b = None

            elif name == "Zope2WSGI":
                try:
                    res = publish_wsgi(a, b)
                    for r in res:
                        a['wsgi.output'].write(r)
                finally:
                    # TODO: Support keeping connections open.
                    a['wsgi.output']._close = 1
                    a['wsgi.output'].close()
        except:
            LOG.error('exception caught', exc_info=True)
Example #6
0
 def zserver_handler(app, request, response):
     from ZPublisher import publish_module
     publish_module(app, request=request, response=response)
 def zserver_handler(app, request, response):
     from ZPublisher import publish_module
     publish_module(app, request=request, response=response)
Example #8
0
 def zserver_handler(app, request, response):
     publish_module(app, request=request, response=response)