Quick look at Infogami

apostas esportivas - Les meilleurs tournois de poker en ligne avec poker770


There are 2 kinds of types in infogami. Primitive types and Compound Types. Primitive types are for representing integers, strings etc.

Available primitive types are:

type/string - for single line text
type/text - for multiline text

Compound types specify what properties a thing of that type must have.

Available compound types are:

Other primitive and compound type can be added by creating a page in the wiki with type type/type.

Some times you might want to link 2 different types. For example, book type has author property and you want to add a books field to the author, which contains all books where author property of the book is this author. This is achieved by adding a backreference to the author type.


Infogami uses templates to control the look and feel of the site. Custom templates can be provided in the wiki to customize the look and feel.

There are 2 kinds of templates. Regular templates and type-specific templates. Type-specific templates are used to render a wiki page based on its type.

regular templates must be placed at path templates/ and end with .tmpl extension. type-specific templates must be placed at type// and end with .tmpl extension.

There can be 4 type-specific templates for every type.

  1. view.tmpl - Template to specify how to view a page
  2. edit.tmpl - Template to specify how to edit a page
  3. repr.tmpl - Template to specify how objects of this type appear when viewing pages of other types which has a property of this type.
  4. input.tmpl - Template to specify how objects of this type appear when editing pages of other types which has a property of this type.

How repr and input templates are used is explained later in this document.

It is not compulsory to specify all these templates for every type. When a type-specific template is not specified for a type, a default template is used. The following are the default templates:

There are many other interesting regular templates. Some of them are:

There are some global functions, which are accessible by every template. To make a function accessible in templates, that function must be decorated with infogami.utils.view.public decorator. Since templates can be written by untrusted users, utmost care must be taken when exposing a function in templates.

There are some useful function, which are very handy in writing view and edit templates.

thingrepr(value, type): This calls repr template of the specified type with value as argument.

thinginput(type, name, value): This calls input template of the specified type with value, name as arguments.

Lets take an example. Suppose there are many types, which need to display an image. Probably they will do that by defining a type type/image for representing images. Instead of worrying how to display and edit (upload) images, these types can just use thingrepr and thinginput macros and define repr and input templates for type/image. Later in future, if you want to change how to display/upload image, you don't have to change in multiple places.


Macros are like functions in any programming language. Macros look very much like templates, but they can be called from wikipages and other templates and macros.

Macros can be written in the wiki just like templates. Macros must be placed in macros/ path and type must be type/macro. As a convention, they are named in CamelCase.

The syntax to call a macro from a wiki page is:

{{HelloWorld()}} or {{MyMacro("arg1", "arg2")}}

The syntax to call a macro from templates and macros is:

$:macros.HelloWorld() and $:macros.MyMacro("arg1", "arg2")


Functionality of infogami can be extended by adding new plugins to it. Plugin in infogami is a python package with the following directory structure.

see sample_run.py in infogami repository to find out how to add a plugin to infogami.

Special pages and modes

A plugin can add special pages to infogami and add new modes to wiki pages. Special pages are paths which are treated differently than regular wiki pages. login, logout, sitepreferences etc. are some examples of special pages. Modes are actions that be done on a wiki page. View, edit, history, diff etc. are some examples of wiki modes.

infogami.utils.delegate module provides 2 special classes page and mode. Any class that extends from page becomes a special page with path same as the class name and any class that extends from mode becomes a wiki mode with name of the mode same as the class name.

An example:

 # hello/code.py
 class hellopage(delegate.page):
     def GET(self, site): 
         return "hello page!"

 class hello(delegate.mode):
     def GET(self, site, path): 
         return "hello mode for " + path

If this hello plugin is added to infogami, /hellopage page displays hello page! and /foo?m=hello displays hello mode for foo.


A plugin can also add new actions to the system. Action is a utility function, which can be invoked from the command line as shown in the following example.

$ python run.py action_name arg1 arg2

$ python run.py startserver 9000
$ python run.py help
$ python run.py movetemplates

The default action is startserver and that is invoked when no action is specified.

To convert a function in to an action, it must decorated with infogami.action decorator. The following is an example of action. @infogami.action def hello(name="world"): print "hello, " + name + "!"

Once this plugin is added to infogami, this action can be used.

$ python run.py hello
hello, world!
$ python run.py hello infogami
hello, infogami!

The help action prints the list of all available actions.

There are some important actions, that every plugin author must know.

install: The install action runs all the install hooks. Install hook is a function without any arguments decorated by infogami.install_hook. Any plugin can add a new install hook to do some actions to initialize an infogami instance. Some of the actions are install hooks too.

movefiles: The movefiles action moves all the files in $plugin/files/ from every plugin to static/ directory. This is also an install hook. If a plugin needs to access any static resources, they must be put in files/ directory of that plugin. Keeping resources directly in static/ is not a good idea and should be discouraged.

movetemplates: The movetemplates action moves templates from every plugin to wiki. Optional prefix can be specified to limit the templates that are moved into the wiki. This is also an install hook.

Edit History Last Modified October 24, 2009