Fredrik Håård's Blaag

I'm a programmer, consultant, developer, occasional teacher and speaker. Among my least disliked programming languages are Python, and a majority of these posts are related to Python in one way or another.
RSS Feed

pyRest part 4: Separating the parts

(part 1, part 2, part 3)

I've now split the code into separate parts - now only has generic functionality for hooking and routing, along with a bunch of helpers to create responses with HTTP response types. In fact, it's only 35 lines of code, and that's the entire 'core' of pyRest so far.

The CherryPy integration has moved to the pyrest.integration package as - it's still pretty clumsy to use (python -m pyrest.integration.cherry can _only_ hook up the hgapi example code), and the hgapi implementation has been moved into the pyrest.examples.hg package. The CherryPy parts have not changed much beyond always expecting a Response tuple and using it to set response status and content, but the hgapi integration now sports a post function, allowing me to commit the code just written using itself! also uses the new Response helpers to create the return values.

The code was committed using a POST request to /api/changeset?message=Comitting via pyrest. Next, I'm planning to make the Mercurial integration useful, and/or the CherryPy integration a bit more robust.

Code is as always available at Bitbucket.

Blaag created 121220 11:44
blog comments powered by Disqus