Wiki

Clone wiki

CherryPy / UpgradeTo20

Differences between CP1 and CP2 and how to upgrade

Overall

  • No compilation is needed like in cherrypy1
  • The entire webserver, and all userpages and logic are purely python
  • No more masks, views and functions. Everything is based on objects and methods now
  • No 'builtin' templating engine, use CherryPyFilters or CherryTemplate for templating.
  • More generic: you can insert objects and methods '''on the fly''' to change behaviour of your site
  • More control...

More Specific

  • + CherryPyFilters (and therefore better hooks support)
  • + Not every CP1 CherryClass is a global anymore!
  • - Builtin templating (it's separate now, use CherryTemplate or another templating [wiki:CherryPyFilters filter])
  • + As compilation is no longer needed, the server can be used with AutoReload and serveral other nice features to enable '''faster development'''
  • O Aspects are still available, though in a seperate library which you can inherit from

Upgrading

Mind the following when wanting to migrate:

  • CSAuthenticate (for session authentication) bytes generator based templating filters, like XyaptuFilter
  • You'll have to use templating for all your CP1 Views
  • Expose all functions you want to be available through the web
  • xml-rpc is available using XmlRpcFilter
  • Move all your globals elsewhere

Updated

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.