wiki:DeveloperGuidelines/WebSetup

Version 3 (modified by Fran Boon, 13 years ago) ( diff )

typo

WEB SETUP IMPLEMENTATION (Detail)

MODELS

default.py

  • session.SelectorCheck :It is a boolean value that checks if an eden instance is selected or not .It helps the controllers to decide whether to show the selector screen or not.
  • dict of libraries :These contain the information about lxml,reportlabs,xlwt,shapely and geos libraries . It helps to test the presence of these libraries and also give links to where they could be downloaded .
    libraries = {
        'lxml':
            {
                'name': 'lxml',
                'description': 'To import and export XML, you need to install lxml',
                'link': 'http://codespeak.net/lxml/installation.html'
            },
    }
    

parsed_config.py

It actually consists of s3cfg.py and 000_config.py written one after the other . When this code is allowed to run we get the dict of all the deployment settings can easily be obtained .
The s3cfg.py contains docstring in each get function . These doctstring contain the information like:-

  • type : which type of the input field is required in the forms
  • category : which category to the setting belong.
  • name : The name of the setting
  • options :The list of values shown in the dropdown

The 000_config also has disabled module dictionary . This is really important for the cases when an module was initially deactivated and later activated.

As the values are taken from the current 000_config and s3cfg.py and then used thus there is no problem even if an old instance is used in websetup to change the settings. These values in the forms reflect the current values of 000_config.py

CONTROLLERS

default.py

Def selector():

If the session variable of the path is not set then I redirect the user from the index function to this function of the controller.

  • I create a the list of paths of all the eden applications( Identified by license file in the folder )
  • And then there is a drop down menu to select the path ( the user will select the name, I retrieve the path using the request.post_vars in the form.accepts and then set the path accordingly).We create forms using SELECT() function for the dropdown and FIELDSET() for creating a filed in the form

Def index():

If the session variable is set then this part is executed. The main purpose of this is to create forms according to the needs and the docstrings written in the s3cfg.py . This part parses those data to retrieve the input fields ,name and category of settings .

As for modules all the module mentioned in the docstring of the get_module() function is used.

This part also checks for the:-

  • Module dependecies
    :I have mentioned all the dependencies in the docstring of the get_module()function. These are parsed and checked in this part.If any module is activated that needs other modules those other modules will be activated by themselves .
  • Core modules
    :I have removed the status option for the 4 core modules. Thus these modules cannot be deactivatted.

The Form is generated by followinf the following scheme :-

Form (Entire collection)
|
Fieldset (Categorizes Settings, modules or create new eden block)
|
Fieldset (Groups of settings)
|
Table (Optional) (Not everything uses a table this is just for organization)
|
Input/Element (Individual setting)

  • Module Forms:


  • There will be similar forms for the settings. However I would like to have separate forms for different categories of settings. Like thsese:-


Other Functions made to help index()

  • def create_new_eden():

This function is used to create new eden . It copies the content from the current instance into a new folder with the given name. It also uses bzr if present to update the code bu downloading the revisions .

  • def get_input_type():

This function is used to create a dropdown menu or checkboxes for the given field. It also access the options to be made

Def write_out():

This writes data to 000_config
For this they would need to open the config using os.path.join and write data to the config in the correct format.
This function extensively uses the modify() function to convert the dict of the deployment settings and and modules to convert into a python sytax which can be written to the 000_config.

VIEWS

Though we have not talked about this part directly, however in the last section of index(): function we have talked about the forms that I would like to create. Most part of this code can be reused from the previous application.

This part extensively uses jquery to create tabs and and also the css to create a good color scheme. Thus the form is generated only once and all the other navigaion is done through jquery thus making it much faster and convenient to use.

Workflow And Summary

Acivate the WebSetup :

  • Going to the web setup co-application and select an Eden Instance .

s3cfg and 000_config copied

  • These are stored in the models of the co-application thus they will run as the selector screen is submitted.

The forms for each setting is displayed

  • these forms are generated using index
  • there results are postulated using request.post_vars

The dict extracted from 000_config is writen to 000_config with the correct values

  • This process is done in write_out ()

In the process I am also generating a method for creating new Eden without Network Access

Note: See TracWiki for help on using the wiki.