Hi,
cf: http://code.google.com/p/kamaelia/source/browse/trunk/Sketches/MPS/Europython09/BulletinBoard.py This isn't finished yet, but is *enough* for the sake of an example. I've written a much larger/more substantial example in the form of a simple bulletin board using Kamaelia. (It's an old school bulletin board, meaning it runs, listens on a port, and the user telnets to it and uses it rather than using a browser :-) At present it just allows this user flow: * A user to login * A stub for reading their state from disk * They can read messages * It flips between main login menu & a messages reading menu. * A stub for writing their state from disk The top level part of the code (at the bottom of the file) is this: def MyProtocol(*args, **argd): ConnectionInfo = {} ConnectionInfo.update(argd) return Pipeline( LineOrientedInputBuffer(), Seq( Authenticator(State = ConnectionInfo), UserRetriever(State = ConnectionInfo), MessageBoardUI(State = ConnectionInfo), StateSaverLogout(State = ConnectionInfo), ) ) def readUsers(): f = open("users.passwd") users = f.read() f.close() users = cjson.decode(users) return users users = readUsers() ServerCore(protocol = MyProtocol, socketOptions=(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1), port = 1600).run() I'd appreciate any comments on this - my plan is to use this as an example at Europython, and I have to get the notes in tomorrow :) Regards, Michael. -- http://yeoldeclue.com/blog http://twitter.com/kamaelian http://www.kamaelia.org/Home --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "kamaelia" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/kamaelia?hl=en -~----------~----~----~----~------~----~------~--~---
