Anonymous avatar Anonymous committed d0c4521

Up to date!

Comments (0)

Files changed (1)

WhatsNewIn32.wiki

 [[PageOutline]]
 
-[This document is up-to-date as of [2678].
-
 = What's new in CherryPy 3.2 =
 
 This document only describes new features in CherryPy 3.2. A detailed "How To Upgrade" document is at [wiki:UpgradeTo32 UpgradeTo32].
 
 The biggest change required for Python 3 is the switch from bytes to unicode. CherryPy 3.1 only ran on Python 2, which favored byte strings over unicode strings. But in Python 3, unicode strings are preferred. Most Request attributes are now unicode strings in Python 3.
 
+== logging.statistics ==
+
+CherryPy is now monitorable! There is a new `lib/cpstats.py` module that provides "tools.cpstats". Import the module and turn it on in config to start collecting statistical information about your CherryPy application. There's also a `StatsPage` class you can drop into your app to show the results. There's ''also'' new stats code in `wsgiserver`: turn it on by setting `cherrypy.server.httpserver.stats['Enabled']` to `True`. Then the statistics it gathers will automatically show up in the output of the `StatsPage` class!
+
+In fact, you (or any other library or app) can participate in the gathering and reporting of statistics quite easily. See the [source:trunk/py2/cherrypy/lib/cpstats.py cpstats docstring] for the complete spec.
+
 == Sphinx Documentation ==
 
 There is a brand-new doc effort underway in the repo itself. You can read it online at http://docs.cherrypy.org/dev/index.html, or check out the source code and help us improve it!
 
 == Deployment ==
 
-=== FastCGI/SCGI ===
+=== FastCGI/SCGI/CGI ===
 
-The FastCGI support in `cherryd` is much improved and tested, including socket file support; also, autoreload and the conflicting signal handlers are now off by default. SCGI support is also included via the `-s` option to `cherryd` (thanks georgem).
+The FastCGI support in `cherryd` is much improved and tested, including socket file support; also, autoreload and the conflicting signal handlers are now off by default. SCGI support is also included via the `-s` option to `cherryd` (thanks georgem), and there's a new adapter for flup's CGI server (also available via the '-x' command-line arg to cherryd).
 
 === cherryd and sys.path ===
 
 
 === Dynamic Dispatch by Controllers ===
 
-To find a handler for the current request, !CherryPy's default dispatcher traverses a tree of objects and methods. Beginning in CherryPy 3.2, when a controller possesses a `_cp_dispatch(vpath)` method, !CherryPy's default dispatcher will now use its return value as the 'next hop' in the object traversal. Returning `None` effectively stops traversal; !CherryPy will then work backward looking for a default handler as normal. In addition, the `_cp_dispatch` method is a list of remaining path segments, and the method is allowed to mutate it. For example, to handle the URI `/users/123/profile`, a `Users._cp_dispatch` method would receive a `vpath` argument of `['123', 'profile']`, at which point it could write:
+To find a handler for the current request, !CherryPy's default dispatcher traverses a tree of objects and methods. Beginning in CherryPy 3.2, when a controller possesses a `_cp_dispatch(vpath)` method, !CherryPy's default dispatcher will now use its return value as the 'next hop' in the object traversal (Quixote refugees rejoice!). Returning `None` effectively stops traversal; !CherryPy will then work backward looking for a default handler as normal. In addition, the `_cp_dispatch` method is a list of remaining path segments, and the method is allowed to mutate it. For example, to handle the URI `/users/123/profile`, a `Users._cp_dispatch` method would receive a `vpath` argument of `['123', 'profile']`, at which point it could write:
 
 {{{
 #!python
         return getattr(self, vpath[0], None)
 }}}
 
+=== cherrypy.popargs ===
+
+There's a new `cherrypy.popargs` function which can be used to pop path segments off into cherrypy.request.params during dispatch. This decorator may be used in one of two ways. First, as a class decorator:
+
+{{{
+    @cherrypy.popargs('year', 'month', 'day')
+    class Blog:
+        def index(self, year=None, month=None, day=None):
+            #Process the parameters here; any url like
+            #/, /2009, /2009/12, or /2009/12/31
+            #will fill in the appropriate parameters.
+            
+        def create(self):
+            #This link will still be available at /create.  Defined functions
+            #take precedence over arguments.
+}}}
+
+...or as a member of a class:
+
+{{{
+    class Blog:
+        _cp_dispatch = cherrypy.popargs('year', 'month', 'day')
+        #...
+}}}
+
 === Mismatched Request Params ===
 
 In previous versions, unexpected URI path segments, or unexpected parameters in the query string or request body, would generally return somewhat unhelpful "500 Server Error" responses. Starting in CherryPy 3.2, when query parameters passed to a handler are incorrect, or when path segments are incorrectly passed to a handler, "404 Not Found" is returned instead. When body params are incorrectly passed to a handler, "400 Bad Request" is returned.
 
 == WSGI ==
 
+CherryPy 3.2 is fully compliant with the new WSGI 1.0.1. See [http://www.python.org/dev/peps/pep-3333/ PEP 3333] for complete spec details.
+
 There's a new REQUEST_URI environ entry, which equals the [http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2 Request-URI] in the HTTP spec. Also, the SERVER_NAME entry is no longer settable by the client.
 
 The wsgiserver is no longer hard-coded to emit WSGI 1.0; instead, it has its own internal format (which is much closer to HTTP than CGI). Just before the server calls its WSGI application, it uses a Gateway to convert its internal formats to WSGI. This means that wsgiserver can now support ''any'' version of WSGI, blessed by a given standards body or not. There's even a new 'native' gateway which doesn't use WSGI at all! CherryPy 3.2 ships with gateways for WSGI 1.0 (the long-time standard), which now includes support for WSGI 1.0.1 (see PEP 3333), and an experimental version we're calling `('u', 0)`, which uses full unicode strings for most environ keys and values.
 === trailing_slash ===
 
 The `trailing_slash` tool has a new `status` argument, to allow XmlHttpRequest's to receive 307 redirects. Defaults to 301.
+
+=== gzip ===
+
+The gzip tool now allows for simple pattern matching such as `text/*` or `application/*+xml` in its `mime_types` parameter.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.