wiki:BluePrint/WebSetup

Version 5 (modified by anubhavagg929, 10 years ago) ( diff )

--

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:-


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.

Like modules needs to be done in this format:-

“deployment_settings.modules = Storge(\n” +
 
#For for all keys
“    “ + <?module.key?> "= Storage(\n” +
   
#For all keys in module.keys
“    “  + “    ” + <?keys of module.keys?> + “=” + <?values of their respective fields?> + “,\n” +
 
"    " + “),\n”              #after module.key
 
+ “)”                   #for the main

Writing settings will be much more easier, as they are not stored in dict, somewhat like:-

For all keys of settings
<?Keys of the settings ?> + “=” + <?values of the respective keys?> “\n” 

I would write default values if any request.post_var returns an invalid value according to the validation.

 

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.

Creating a license page :

This will be created only if “FINISHED_EDITING_CONFIG_FILE” is false in the modified_config.py

Sending Post Method To Get The Arguments To Controllers :

These Will Contain A Static Folder Containing The Css And The ExtJS:

This part of the code is almost reusable.

WEB SETUP NEW ARCHITECTURE

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 Netowrk Access

WEB SETUP OLD ARCHITECTURE

http://www.picamatic.com/show/2011/04/08/04/42/7470363_1818x880.png

Note: See TracWiki for help on using the wiki.