{ "info": { "author": "Sylvain Viollon", "author_email": "info@infrae.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Zope2", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "===========\ninfrae.wsgi\n===========\n\n``infrae.wsgi`` provides a support to run Zope 2 as a WSGI application.\n\n.. contents::\n\nIntroduction\n============\n\nIt basically does the same work than:\n\n- ``repoze.zope2``,\n\n- Zope 2 new builtin WSGI publisher.\n\nExcept than:\n\n- It work with real Zope 2 applications and no monkey-patches,\n\n- It pay specially attention to properly implement streaming. You can\n use your ZODB connection while streaming, (either with the\n ``.write`` method of request, or returning an ``IResult`` or an\n ``IStreamIterator`` iterator). ConflictError generate a final error\n if they happens during a streaming operation, not re-sending things\n again on the same HTTP connection,\n\n- All ConflictError are properly managed.\n\n- All those cases are tested.\n\nIt does not:\n\n- Provide Zope 2 as a collection of WSGI middlewares, as Zope 2 paradigm /\n code base is not good for it,\n\n- Do all fancy request body changes that old Zope 2 publisher does, as\n nobody use it anymore since a very long time.\n\nErrors\n------\n\nError messages are handled a bit differently than in\ntraditional Zope 2, in order to make things simpler.\n\nThey are views on errors (called ``error.html``), and wrapped in\nacquisition around the context where they happened::\n\n from five import grok\n\n class CorpError(Exception):\n \"\"\"Custom corporate error.\n \"\"\"\n\n class CorpErrorMessage(grok.View):\n grok.context(CorpError)\n grok.name('error.html')\n\n def render(self):\n # aq_parent(self) is where the error happened\n return u'I Failed: %s' % str(self.error.args)\n\n\nErrors are logged with useful information:\n\n- Which is the URL triggering this error,\n\n- The user-agent,\n\n- The referent,\n\n- The logged in username,\n\n- On which object, its physical path and meta_type if possible.\n\nThe error log can be accessible online via ``/errorlog.html`` on any\nZope 2 content.\n\nErrors can also be sent to a Sentry service (see Paste Deploy section).\n\nThe error log ignores certain errors by default: NotFound, Redirect,\nUnauthorized, Forbidden, BadRequest, BrokenReferenceError. The errlog.html page\nhas a form configure some (or all) of these errors to not be ignored. This is\nnot a persistent setting and is forgotten on restart.\n\nInstallation\n============\n\n``infrae.wsgi`` has been and deployed with Paste Deploy, ``mod_wsgi``\nand ``nginx``. It correctly respect the WSGI specification and should\nwork with any WSGI server.\n\nPaste Deploy\n------------\n\nThe application is available with the entry point\n``infrae.wsgi#zope2``.\n\nIt expect an option variable called ``zope_conf`` that point to the\nZope 2 configuration file.\n\nThe option ``debug_mode`` can as well be specified, to run Zope in\ndebug mode. In debug mode, error pages will not be rendered by Zope\nand the errors will propagate in the WSGI stack. This behavior will\nlet you debug errors with specialized middlewares.\n\nTo disable the error propagation in debug mode, the option\n``debug_exceptions`` can be set to ``off``.\n\nThe option ``zope_workers`` can be used to specify the maximum of\nthreads Zope should allow to process requests at the same time\n(default to ``4``). This can be usefull if you wish to allow more\nthreads in your wsgi environment, in case you have middlewares or\nother applications that intercept the requests and support more\nthreads than Zope does.\n\nThe option ``show_errors`` accepts a comma-separated list of\nerrors which will not be ignored. This overrides the default list of\nignored errors (see the Errors section, above)\n\nThe option ``ignore_errors`` accepts a comma-separated list of errors\nwhich will be ignored. This overrides the default list of ignored\nerrors too.\n\nThe configuration accepts options for `Raven`_ (Sentry's client)::\n\n raven.dsn = http://public:secret@example.com/1\n raven.include_paths = my.package, my.other.package\n raven.exclude_paths = my.package.crud\n\nThose options requires `Raven`_ to be installed.\n\nVirtual Hosting\n---------------\n\nYou can add two headers in your proxy in order to control the virtual\nhosting:\n\n- ``X-VHM-URL``: That would the complete URL of your site, at which\n you want to see your Zope application, like\n ``http://www.mysite.com/application``.\n\n- ``X-VHM-Path``: That would be an optional path to the Zope folder\n you see at the given URL instead of the Zope root, lile\n ``/my/folder``.\n\n\nTesting\n=======\n\nA test request ``TestRequest`` can be imported from\n``infrae.wsgi.testing``. It behaves *exactly* like a request used by\nZope. It takes the following parameters when creating it:\n\n``application``\n WSGI application to use with the request.\n\n``layers``\n Zope layers to apply on the request.\n\n``url``\n URL used with the request.\n\n``method``\n HTTP method used with the request.\n\n``headers``\n HTTP headers that where sent with the request.\n\n``debug``\n Should the request ran with the debug mode.\n\n``form``\n Form data associated with the request.\n\n\nFunctional Testing\n------------------\n\nA layer inheriting of `infrae.testing`_ ``Zope2Layer`` layer called\n``ZopeBrowserLayer`` let you write functional tests.\n\nIt provides both an ``http`` function and a ``ZopeBrowser`` class (like\nthe one provided by ``zope.testbrowser``) that you can use, and that\nwill connect to the tested application using the WSGI support provided\nby this package.\n\nThis will let you do functional testing, and things will work exactly\nlike in your browser, as the requests will be processed the same way\nthan they are in real life (which is not really the case with the\n``Testing`` module of Zope 2).\n\nYou will be actually able to test applications that do use streaming::\n\n\n import unittest\n\n from infrae.wsgi.testing import ZopeBrowser, ZopeBrowserLayer\n import corp.testpackage\n\n\n class CorpTestCase(unittest.TestCase):\n layer = BrowserLayer(corp.testpackage)\n\n def setUp(self):\n self.root = self.layer.get_application()\n # Create some test content\n\n def test_feature(self):\n browser = ZopeBrowser()\n browser.open('http://localhost/somepage')\n self.assertEqual(browser.status, 200)\n ...\n\nThis feature is provided by `wsgi_intercept`_. It is available only if\n`wsgi_intercept`_ is included in the environment.\n\n\n.. _wsgi_intercept: http://pypi.python.org/pypi/wsgi_intercept\n.. _infrae.testing: http://pypi.python.org/pypi/infrae.testing\n.. _Raven: http://raven.readthedocs.org/en/latest/\n\nChanges\n=======\n\n2.2.1 (2013-10-08)\n------------------\n\n- Fix an UnicodeError in error message logging facilities.\n\n2.2 (2013-06-22)\n----------------\n\n- Improve logging with raven: the message used to contain the\n annotated traceback, that was too long.\n\n- Fix HTTP status code 204 that was set even when a Content-Length was\n defined.\n\n- Fixed paster startup crash when multiple mount points don't exists yet.\n\n- ``wsgi_intercept`` support is now optional for testing. There is a\n simple test layer ``BrowserLayer`` that provides a test WSGI\n application without the feature. The layers and browser with the\n support have been prefixed with ``Zope``. In order to enable this\n feature you must depend on the feature ``[intercept]``.\n\n2.1 (2012-12-10)\n----------------\n\n- In paster, the propagations of errors in the stack can be disabled\n with ``debug_exceptions``, if you set it to ``off``. This option\n only has an effect if ``debug_mode`` is activated.\n\n- In paster, the list of default errors that are ignored in the log\n can be customized by both options ``show_errors`` and\n ``ignore_errors``.\n\n- Add a plugin to log errors in Sentry (this requires raven to be\n installed).\n\n2.0.1 (2012-09-19)\n------------------\n\n- Add an optional WSGI middleware that display the same debug\n information than ``debugzope.html`` does.\n\n- Add an event that is triggered before an error page is rendered.\n\n- If an error view implements ``IBrowserPublisher``, call\n ``browserDefault`` in order to retrieve the real view to render.\n\n2.0 (2012-09-04)\n----------------\n\n- Refactor the virtual hosting, traversing and authentication code\n from Zope 2 BaseRequest into three different pieces of code, that\n can be customized. This makes possible to change how authentication,\n or virtual hosting is done.\n\n- Add a ``TestRequest`` that can be used in tests. This is the same\n thing than a ``zope.publisher`` test request, except it is based on\n a Zope 2 request, and have all the same behavior than a Zope 2\n request.\n\n- A configurable semaphore have been added to limit the number of\n concurrent threads that can access the Zope 2 application. This is\n usefull when you have middleware that handles requests on their own,\n so they are not limited to the restriction imposed by Zope 2 on the\n number of threads.\n\n1.3 (2011-07-27)\n----------------\n\n- Improve logging.\n\n- BadRequest and Forbidden exceptions are now ignored by default in\n the logs.\n\n- Fix a bug the original CONTENT_LENGTH header is empty.\n\n- When an error happens on an IBrowserPage, use the page's context\n when handling the error (to prevent falling back to the nearest Site)\n\n1.2 (2011-02-02)\n----------------\n\n- Add a view ``debugzope.html`` that display a dump of the server\n threads. You need to be manager to access it.\n\n- You can from the ``errorlog.html`` configure the error you wish to\n ignore (not log). This is a non persistent setting.\n\n- Handle buggy PAS unauthorized plugins, by catching any error, and\n logging them. In case of problem, a basic 401 response is sent back.\n\n- Add the ZPublisher *insertBase* functionality: if a base is set by\n the request, and we render HTML, with an HEAD tag and no BASE tag,\n insert a BASE tag with the value provided by the request. This fix\n broken ZMI screens.\n\n1.1 (2010-10-07)\n----------------\n\n- Fix a bug where `Content-Length` is not set and cannot be set.\n\n- Correctly encode payload when needed before sending it (if it was a\n unicode string).\n\n- Error codes less when 500 triggers a commit now, this let you\n support login pages that uses a Zope session ID.\n\n- Add some hooks in the testing code to be more extensible (used for\n `infrae.testbrowser`).\n\n1.0 (2010-07-15)\n----------------\n\n- Initial release.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://svn.infrae.com/infrae.wsgi/trunk", "keywords": "zope2 wsgi silva infrae", "license": "ZPL", "maintainer": null, "maintainer_email": null, "name": "infrae.wsgi", "package_url": "https://pypi.org/project/infrae.wsgi/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/infrae.wsgi/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://svn.infrae.com/infrae.wsgi/trunk" }, "release_url": "https://pypi.org/project/infrae.wsgi/2.2.1/", "requires_dist": null, "requires_python": null, "summary": "WSGI support for Zope 2", "version": "2.2.1" }, "last_serial": 945374, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "da518b889f77d37c73ac1f29e613aad9", "sha256": "fc340f4e35419687e083d9aef659d2f84067b27b2132d2663baf22b4f0f67363" }, "downloads": -1, "filename": "infrae.wsgi-1.0.tar.gz", "has_sig": false, "md5_digest": "da518b889f77d37c73ac1f29e613aad9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21523, "upload_time": "2010-07-15T18:10:47", "url": "https://files.pythonhosted.org/packages/b1/59/197ab229d942779fb40a1fb626d724b9d58bde6fadd787e2e7786f0860fe/infrae.wsgi-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "b304014a967b999792b1ab14831d3401", "sha256": "ca83a00755dd67cc2d4d61af2d094e2091198e469521d253243a6d5d8dee8271" }, "downloads": -1, "filename": "infrae.wsgi-1.1.tar.gz", "has_sig": false, "md5_digest": "b304014a967b999792b1ab14831d3401", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22223, "upload_time": "2010-10-07T11:40:37", "url": "https://files.pythonhosted.org/packages/2b/15/4f35ff7b2b02ddaad8edc8503bebf4f90a3568a79d92096c30e6403dd4c3/infrae.wsgi-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "7ffd6fc31d1fb57284f88f1de89bc426", "sha256": "97aa77a0f699d07e1b480efab55af8653737d29f3da06ceb8892e616bdc72a6e" }, "downloads": -1, "filename": "infrae.wsgi-1.2.tar.gz", "has_sig": false, "md5_digest": "7ffd6fc31d1fb57284f88f1de89bc426", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24501, "upload_time": "2011-02-02T15:35:33", "url": "https://files.pythonhosted.org/packages/05/05/95ef869efca5a4dbb5f277c1448b683ad3152521e35f41c62316548d8b0a/infrae.wsgi-1.2.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "b25972dfcd8b4095201dc3378ee332fe", "sha256": "b8f4392f1a8caeac8f2b6264dc19f5409be0b280e90bcc8c9f801e7b0b80c19a" }, "downloads": -1, "filename": "infrae.wsgi-1.3.tar.gz", "has_sig": false, "md5_digest": "b25972dfcd8b4095201dc3378ee332fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26220, "upload_time": "2011-07-27T12:31:12", "url": "https://files.pythonhosted.org/packages/33/8f/2dd5c2b3485ecd7edbaaea4fbf49571d5aecb08265ceaf4e14d0aa1a3f72/infrae.wsgi-1.3.tar.gz" } ], "2.0": [ { "comment_text": "", "digests": { "md5": "e15d6318853b626b2f34eae300b3f65e", "sha256": "32e3fe10e39987c2baed84c23fab994b534f35c308815067b7b2f229aba90918" }, "downloads": -1, "filename": "infrae.wsgi-2.0.tar.gz", "has_sig": false, "md5_digest": "e15d6318853b626b2f34eae300b3f65e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33252, "upload_time": "2012-09-04T09:42:08", "url": "https://files.pythonhosted.org/packages/81/0e/7a63cf7132f4e2e441d143a7404c994cd08ee99a35eaf9051083e808d204/infrae.wsgi-2.0.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "8db5726f29d345bf27ce25f6f4a3413e", "sha256": "32b7996d55a31d420ecc2a3cf548a37fbaee8724eca4041e845d27d696e2c9d7" }, "downloads": -1, "filename": "infrae.wsgi-2.0.1.tar.gz", "has_sig": false, "md5_digest": "8db5726f29d345bf27ce25f6f4a3413e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33994, "upload_time": "2012-09-24T10:14:53", "url": "https://files.pythonhosted.org/packages/d3/c7/0f798dc489140265cbe5fcec7effd30ff4b7af65d192efe10f5663cb91e5/infrae.wsgi-2.0.1.tar.gz" } ], "2.1": [ { "comment_text": "", "digests": { "md5": "212c6a90df397dc3f90d98aee9bb2a64", "sha256": "4f0ebeae4459ab913a8be37c951366f35fd0e727d1d4d1f2833b2815277f0577" }, "downloads": -1, "filename": "infrae.wsgi-2.1.tar.gz", "has_sig": false, "md5_digest": "212c6a90df397dc3f90d98aee9bb2a64", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36520, "upload_time": "2012-12-10T16:04:21", "url": "https://files.pythonhosted.org/packages/23/4d/e1d658243455fe60efc435f6a3a13ea2624a5dd3a3bf38cc97070aecace4/infrae.wsgi-2.1.tar.gz" } ], "2.2": [ { "comment_text": "", "digests": { "md5": "cf5224926c2c07b87e02d483ca3873c4", "sha256": "8c5a6b7ae8b00adedb656fb737c8418851058de9b4e334a77b7273ae414d752e" }, "downloads": -1, "filename": "infrae.wsgi-2.2.tar.gz", "has_sig": false, "md5_digest": "cf5224926c2c07b87e02d483ca3873c4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 38560, "upload_time": "2013-05-22T13:06:46", "url": "https://files.pythonhosted.org/packages/db/bc/3e49457c9ac36e650c7e93d12ee2b0ae0cfda2069780dcde304715d3a832/infrae.wsgi-2.2.tar.gz" } ], "2.2.1": [ { "comment_text": "", "digests": { "md5": "0ff89f7fec1c4aad4fad67f6fcbbcca9", "sha256": "f4429497afa00db8819bc2c96e1d29cc635a11e85b65afb140369e085d99c6e6" }, "downloads": -1, "filename": "infrae.wsgi-2.2.1.tar.gz", "has_sig": false, "md5_digest": "0ff89f7fec1c4aad4fad67f6fcbbcca9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 38694, "upload_time": "2013-10-08T13:23:57", "url": "https://files.pythonhosted.org/packages/eb/41/7bfc9920dfab506900655016ceec8328ecfd8d53f5624fc9a9e63d00069d/infrae.wsgi-2.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0ff89f7fec1c4aad4fad67f6fcbbcca9", "sha256": "f4429497afa00db8819bc2c96e1d29cc635a11e85b65afb140369e085d99c6e6" }, "downloads": -1, "filename": "infrae.wsgi-2.2.1.tar.gz", "has_sig": false, "md5_digest": "0ff89f7fec1c4aad4fad67f6fcbbcca9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 38694, "upload_time": "2013-10-08T13:23:57", "url": "https://files.pythonhosted.org/packages/eb/41/7bfc9920dfab506900655016ceec8328ecfd8d53f5624fc9a9e63d00069d/infrae.wsgi-2.2.1.tar.gz" } ] }