Created: 2011-07-10 20:22
Updated: 2014-01-18 00:33
License: agpl-3.0


Mother is a web-applications framework. Written in python, it is based on Twisted and Tentacles.


###Installation To install:

easy_install mother


wget [](
tar xvf mother.latest.tar.gz
cd mother-* && ./ install

Introduction - ReSTful API

Mother 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). Default mime-type/data format is JSON.

def helloworld(**kwargs):
	return 'Hello World'

class SuperHeroe(Callable):
	def __init__(self, *args, **kwargs):
		super(SuperHeroe, self).__init__(*args, **kwargs)

		self.superheroes = {}

	def GET(self, name):
			return self.superheroes[name]
		except Exception:
			return routing.HTTP_404

	def PUT(self, name, strength, capacity):
		self.superheroes[name] = {'name': name, 'strength': strength, 'capacity': capacity}

		return routing.HTTP_200

	def count(self):
		return len(self.superheroes)

Mother is designed to be used with an ORM, in particularly Tentacles (though you can use it with any python ORM). In a future release, each Tentacle Object will by automatically exposed through standard ReST methods (GET, PUT, DELETE). But from now, it as to be done manually

class SuperHeroe(Object, Callable):
	name   = String(pk=True)
	gender = String()
	power  = String()

	# let Object standard __init__()

	def GET(self, name)
		"""Name is the key of superheroes
			heroe = filter(lambda h: == name, SuperHeroe)[1]

			return {'name':, 'gender': heroe.gender, 'power': heroe.power}
		except Exception:
			return routing.HTTP_404	
	def PUT(self, name, gender, power):
		"""Add a new superheroe or update existing one

		if len(filter(lambda h: == name, self.__class__)):
			heroe = filter(lambda h: == name, self.__class__)[1]
			heroe = SuperHeroe(name)

		heroe.gender = gender
		heroe.power  = power

		return routing.HTTP_200

	def DELETE(self, name):
			heroe = filter(lambda h: == name, self.__class__)[1]
			return routing.HTTP_404

HTML for humans

While Mother default format is JSON, you can also handle HTML format (in fact you can handle any format you want)

Let's take back our «hello world» example, and return HTML content::

def helloworld(
	return """
				<title>Hello World</title>
				<em>Welcome to *Mother* webapps framework</em>

Callback modifier, one for all

@callback modifier is the master piece of mother:

  • tagging a method as callable
  • set accepted methods
  • change default method url
  • set content_type
  • set modifiers

Examples:: @callback(method=('GET','POST') ...

def foo():

Any query @callback(content_type='image/png') def avatar(name) ...

@callback(modifiers={'text/plain': uppercase})
def poem():
	return "La cigale et la fourmie"

will display: «LA CIGALE ET LA FOURMIE»


Mother is still pretty yound and incomplete, and still in alpha stage. Only a few subset of schedules functionalities are implemented at the moment. Other ones will come progressively.


Mother is licensed under GNU GPL v3. It is written by Guillaume Bour

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more