Wobpy takes form
Home Home Contact us Contact
home News Projects Tests Files Follow manatlan on Twitter Sign in
back 2009/02/14 10:23

Wobpy takes form

Sure, wobpy's going in the right way now. Til I decided to make it a wsgi utility, the APIs are going simpler. And it will be easier to setup it in any wsgi compliant frameworks. It's now more natural to declare a wobpy object. Here is a simple example in a full wsgi stack :

from wobpy import *

class WTest(Wobpy):
    def init(self):
        b=Button("OK")
        b.connect("onclick",self.onClick)
        self.add(b)

        self.t=TextBox()
        self.add(self.t)

    def onClick(self):
        self.t.set_value( self.t.get_value() + "!" )

def simple_app(environ, start_response):
    start_response('200 OK', [('Content-type','text/html')])
    yield """<script type="text/javascript"
    src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>"""
    yield str( WTest() )

if __name__ == "__main__":
    from wsgiref.simple_server import make_server
    make_server('localhost', 8011, WobpyMiddleware(simple_app)).serve_forever()

simple_app is the most simple wsgi app, which send back the include script for jquery, and the html's form of the wobpy object WTest. All the backend (the ajax communication between the page and the server) is done via the middleware, badly nammed WobpyMiddleware.

It's a lot better than before. I have no dates for a public release yet. I'm working on a way to open modal dialog, and I need to fix apis. But for sure, it's really amazing to do. And it works very well.

Another amazing thing, it should work "as is" with ironpython., at least 95% of the code base.

Tags: wobpy
RSS Python Powered Get Ubuntu
©opyleft 2008-2019 - manatlan