Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Ann: CherryPy-2.0-beta released

Reply
Thread Tools

Ann: CherryPy-2.0-beta released

 
 
remi@cherrypy.org
Guest
Posts: n/a
 
      01-03-2005
Hello everyone,

I am happy to announce the release of CherryPy-2.0-beta.

CherryPy-2 is a pythonic, object-oriented web development framework.

CherryPy-2 is a redesign of CherryPy-1 (the unpythonic features have
been removed): no more compilation step, pure python source code (no
more "CherryClass")

Here is a sample Hello, World in CherryPy-2:

# from cherrypy import cpg
# class HelloWorld:
# @cpg.expose
# def index(self):
# return "Hello world!"
# cpg.root = HelloWorld()
# cpg.server.start()

Main properties:
- this code starts a multi-threaded HTTP server that dispatches
requests to methods
- requests like "http://domain/dir/page?arg1=val1&arg2=val2" are
mapped to "dir.page(arg1='val1', arg2='val2')"
- requests are mapped to an object tree that is "mounted" on cpg.root
(for instance: "cpg.root.user", "cpg.root.user.remi", ...)
- method must be explicitely exposed with a decorator "@cpg.expose"
(or "index.exposed = True" for Python-2.3)
- methods can return a generator instead of a string (useful when
generating big pages)

Here is a non-exhaustive list of CherryPy-2 features:
multi-threaded HTTP server, XML-RPC server, sessions, form handling,
authentication, unicode support, gzip-compression, virtual hosting,
WSGI adapter (experimental)

The design of CherryPy-2 allows to easily write/use pluggable "filters"
or "modules":
- filters perform operations on the request/response such as
gzip-compression or string encoding
- modules are web applications (like a blog or a web forum) than can
be easily "mounted" anywhere you want in your website

CherryPy-2 is already used in production by several sites and is
supported by an active community.


Remi.

http://www.cherrypy.org

 
Reply With Quote
 
 
 
 
andybak@gmail.com
Guest
Posts: n/a
 
      01-03-2005
I'm a great believer that avoiding query strings in URL's is good
practise ( http://www.holloway.co.nz/book/9 for good arguments why).

How tricky is it to remap URL's to query strings in cherryPy? Also how
much does it complicate matters to run cherryPy under an existing
webserver? Is any functionality lost?

 
Reply With Quote
 
 
 
 
remi@cherrypy.org
Guest
Posts: n/a
 
      01-03-2005
> I'm a great believer that avoiding query strings in URL's is good
> practise ( http://www.holloway.co.nz/book/9 for good arguments why).


CherryPy also supports that out of the box:

class Book:
def default(self, categoryName, bookId):
....
cpg.root.book = Book()

If you go to "http://domain/book/science/9", CherryPy will call
book.default('science', '9')

> Also how
> much does it complicate matters to run cherryPy under an existing
> webserver? Is any functionality lost?


Well, you can easily run CherryPy behind Apache (see
http://trac.cherrypy.org/cgi-bin/tra.../BehindApache).
Since CherryPy provides a WSGI interface (although it's still
experimental), you can also run your CherryPy app with any
WSGI-compatible HTTP server (although I don't really see any advantage
to doing this).

Remi

 
Reply With Quote
 
Ian Bicking
Guest
Posts: n/a
 
      01-03-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Well, you can easily run CherryPy behind Apache (see
> http://trac.cherrypy.org/cgi-bin/tra.../BehindApache).
> Since CherryPy provides a WSGI interface (although it's still
> experimental), you can also run your CherryPy app with any
> WSGI-compatible HTTP server (although I don't really see any advantage
> to doing this).


In the future when more WSGI environments are deployed, I think the
benefits will be nice. For instance, under WSGIKit
(http://svn.colorstudy.com/trunk/WSGIKit) you should be able to create a
file:

# cherry_app.py:

from cherrypy import cpg, wsgiapp
from my_cherry_app import root_instance
cpg.root = root_instance
wsgiapp.init()
# This variable name is automatically picked up:
application = wsgiapp.wsgiApp

Then your application would be available under cherry_app/ (wherever you
happened to put that file in the URL space). Note that WSGIKit isn't a
server itself, just a set of middleware that delegates to different
applications.

It occurs to me that it would be considerably cleaner if it looked more
like this:

from cherrypy import wsgiapp
from my_cherry_app import root_instance
application = wsgiapp.Application(my_cheery_app)

Otherwise you can only run one CherryPy application in a process...?
That would be very limiting.

Anyway, the idea is you can deploy a CherryPy-based application fairly
easily alongside other WSGI Python web applications. The particulars
still need some work -- I don't like the little Python file used to put
the pieces together -- but I think it's a good direction.

--
Ian Bicking / (E-Mail Removed) / http://blog.ianbicking.org
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Win XP wireless network adapter gets released and then connects ba =?Utf-8?B?cGkyMmJ5Nw==?= Wireless Networking 1 08-01-2008 08:33 PM
Battlefield 2 New Patch Released (yet Again...) Silverstrand Front Page News 4 07-20-2005 04:33 PM
*Mozilla Firefox 1.0.4 Released* Roland Firefox 4 05-13-2005 03:05 PM
Firefox 1.0.1 released Z Firefox 2 02-26-2005 04:11 AM
ANN: Anyplace Control 2.6 released Yura Goncharuk Wireless Networking 0 09-28-2004 10:13 AM



Advertisments