← Back to team overview

nova team mailing list archive

Re: Require Pylons, or copy-and-paste its code?


Hi Todd,

On Thu, Aug 12, 2010 at 2:04 PM, Todd Willey <todd@xxxxxxxxxxxx> wrote:

> That link wasn't all that helpful.  It looks like there is still a
> routing and dispatch layer needed as well?  Are there any examples of

how to write a controller?

Yes, this depends on RoutesMiddleware being above it in the WSGI stack --
which nova.wsgi.Router provides.  WSGIMiddleware provides the dispatch --
when you call it, it looks at the data from RoutesMiddleware in environ and
calls the proper action method on self.

A controller would follow the standard REST syntax that map.resource()
expects, e.g.

class ServerController(WSGIController):
  def index(self):
    # return a list of servers
  def show(self, id):
    # return server <id>
  def delete(self, id):
    # delete server <id>
  # etc

I expect I'll make cerberus's rackspace.controllers.BaseController inherit
from WSGIController to provide helper methods, e.g. to format RS API Faults.


Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace.
Any dissemination, distribution or copying of the enclosed material is prohibited.
If you receive this transmission in error, please notify us immediately by e-mail
at abuse@xxxxxxxxxxxxx, and delete the original message.
Your cooperation is appreciated.