This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Mother is a framework written in python and based on twisted. It is designed to make developpement of web applications easy and fast.

It provides following functionalities among others:
  • simple url mapping to code,
  • handle multi content-types (html, JSON, …),
  • integration with Tentacles ORM,
  • allow use of templating tools (currently, only Mako is supported)


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

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

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

@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>'

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

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

class Captain(Callable):
       def __init__(self, **kwargs):
               super(Captain, self).__init__(**kwargs)
               self._age = 54

       # special methods GET, POST, PUT, DELETE are directly mapped to '/sample/captain' url
       def GET(self, **kwargs):
               return 'Captain::GET'

       # You can also expose non-special class/instance methods with the callback modified
       # Here we learn a new @callback option, named 'method'
       def age(self, **kwargs):
               return self._age

       # Here we discover a new @callback argument, named 'method'
       # taking either a string among 'GET', 'POST','PUT','DELETE' or a list of these
       # This argument set HTTP method(s) callback is accessible through (default is GET)
       @callback(url='/setage', method='POST')
       def age_post(self, age, **kwargs):
                       self._age = int(age)
                       return routing.HTTP_404('age MUST be integer')

               return routing.HTTP_200('')

def hello(**kwargs):
       return 'hello'

URLS = {
       # expose function
       '/hel-lo'                                                       : hello,
       # expose static content (directory)
       '/static'             : Static('static-content/'),
       # expose template file
       # NOTES
       #   . template files MUST be stored in a templates/ sub-directory
       #   . Mako is the only available template engine at present
       '/template'                                             : Template('sample.html', title='template sample title',
                                      content="""You\'re viewing a template sample page, rendered with <em>Mako</em>""")
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
mother-webapps-framework-0.1.0.tar.gz (42.4 kB) Copy SHA256 Checksum SHA256 Source Jun 20, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting