wiki:Mother
Last modified 3 years ago Last modified on 06/19/11 19:55:17

Mother

Introduction

Mother is a web-applications framework. It expose apps. Each *app* is a python module with functions and classes. a function/class/method can be requested by users if only decorated with @callback (or inheriting Callable for classes).

Example

UUID = '7c772000-8f12-4594-9730-9e4de53d55d1'

from mother          import routing
from mother.callable import callback, Callable
from mother.template import Static, Template

@callback(url=routing.ROOT)
def root(**kwargs):
        return """
                <html>
                        <head>
                                <title>Welcome to Mother Sample Application</title>
                        </head>
                        <body>
                                This is the homepage of <b>Mother Sample Application</b>.<br/>
                                <br>
                                <em>You are welcome to watch my source code to see how to build your first
                                <strong>Mother</strong> application</em>.
                        </body>
                </html>
        """

@callback(url='/foo', content_type='text/plain')
def foo(**kwargs):
        return 'foo:: plain text'


@callback(url='/foo', content_type='application/json')
def foo(**kwargs):
        return ['foo', 'json tree']


@callback(url='/foo', content_type='text/html')
def foo(**kwargs):
        return '<html><body><b>foo</b>:: html content</body></html>'


@callback
def bar(age, **args):
        try:
                age = int(age)
        except:
                return routing.HTTP_404('age MUST be integer')

        return 'the captain is %d years old' % age

Documentation

  • coming soon

TODO

Download

Contact

Mother is written by Guillaume Bour <guillaume@…>

License

Mother is distributed under Affero GPL v3 License.