On Wed, Oct 21, 2009 at 6:18 PM, Marcus Herou <[email protected]> wrote: > > Thanks! > > Some quick questions since I am nowhere as good in python as in other > languages especially not in binding it to the web. > > Quick glance at the code make me think it does this: > > First some client code sends the subscription request > > @handler.get('^/callback(.*?)$', produces=tubes.TEXT) > def confirm_subscription(request, info): > GET: You receive challenge request from HUB and echoes the challenge > back (is that valid ?) > > @handler.post('^/callback(.*?)$', produces=tubes.HTML) > def receive_notification(request, info): > POST: You parse the atom and push the parsed feed to a memory Q for > consumption. > > @handler.get('^/new-notices/?$', produces=tubes.HTML) > def get_new_notices(request): > Consumes the parsed items and creates a nifty html page > > Was that about right ?
yep :) another way of describing it (if someone else is reading) if someone makes a get on an url that matches the '^/callback(.*?)$' regular expression (I used it when subscribing) call the confirm_subscription method that receives a request object with request information and the value inside parenthesis in the regular expression as the second parameter. This method produces plain text (produces=tubes.TEXT) and just returns the hub.chalenge field if it exists. the same applies for the other ones, you have to look for the HTTP method on handler.*, see which url matches, and which content type it produces, the first argument is an object that contains information about the request, the others are the request payload if exists and the matched values in the regular expression (the ones in parenthesis), the value returned is marshalled according to the content type (in case of json for example)
