Skip to content
allan-simon edited this page Nov 19, 2012 · 8 revisions

Format use by config.py

This file is used to generate the first code of your website, and will also format the templates for the code you'll add after using the others tools

The file is organized as 2 python dict:

  • ARCHITECTURE
  • REPLACEMENTS

Architecture

The architecture dict will precise which controllers/models, and the associated views/contents to generate, and also which models use each controllers

the 3 main sections of the dict are the following (each sections will be detailled one by one after)

ARCHITECTURE = {
   'controllers' : {  },
   'models' : { } .
   'models_controllers' :  [ ]
}

for each sections you can consult their usage here ###controllers

Each key of the dict "controllers" will be the name of one controller it should be in Pascal case for example

ARCHITECTURE = {
   'controllers' : {
       'Articles' : {},
       'Users' : {}
   },
   'models' : { } .
   'models_controllers' :  [ ]
}

Will generate two empty controllers, Users and Articles that will be linked to your main application

The value of this controller is an other dictionary, which can have the following keys

  • description
  • methods
  • forms
  • actions_only

####description

The description key is supposed to have a string value, that will be the value of the @brief field of the auto-generated doxygen documentation added to the controller, if not present, the @brief field will be set to "TODO add a description"

example:

   'controllers' : {
       'Articles' : {
            'description' : 'Controllers that will centralize all the actions related to the wiki\\'s articles'     
       },
       'Users' : {},
   },
   #etc.

####methods

The methods is supposed to have a dict value, that will contain the 'normal pages' to generate, as key of this dictionary.

by normal page we mean a page:

  • that will take some (or no) information
  • will display them in a page

nothing more, nothing less

for example to have 2 pages:

  • One to display a given article
  • One to display all the articles

we will do the following

   'controllers' : {
       'Articles' : {
            'description' : 'Controllers that will centralize all the actions related to the wiki\'s articles' ,
            'methods' : {
                'show' : {},
                'show_all' : {}
            }    
       },
       'Users' : {},
   },
   #etc.

the methods must be in underscore_naming

that will automatically generate:

  • a new methods in the controller Articles
  • a content associated to this method
  • a view that will be displayed by this method, using the associated content
  • a link to access to it, using this schema /controllers/action-name (note that for SEO purpose the underscores _ are replaced by hyphens -)

Of course after you'll be free to edit them in order to add more things and/or to edit the HTML page etc.

NOTE : the method name is supposed to have a key which is a dictionary, even if empty, as this dictionary can for the moment accept a key 'description' that will work the same way as the description key of the controller (in order to have a doxygen documentation for this methods)

####forms

####actions_only


###models


###models_controllers

Clone this wiki locally