Changes between Version 3 and Version 4 of DeveloperGuidelines/PrePopulate


Ignore:
Timestamp:
06/06/12 16:18:37 (12 years ago)
Author:
Fran Boon
Comment:

prepopulate folder renamed to templates

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/PrePopulate

    v3 v4  
    1313== Methods ==
    1414=== On First Run ===
    15 In models/000_config.py {{{deployment_settings.base.prepopulate}}} is used to control prepopulate. This is a list of directory names and will import data from a number of CSV files. The directories must be in the private/prepopulate directory tree and must include a file called tasks.cfg.
     15In models/000_config.py {{{deployment_settings.base.prepopulate}}} is used to control prepopulate. This is a list of directory names and will import data from a number of CSV files. The directories must be in the private/templates directory tree and must include a file called tasks.cfg.
    1616
    1717The prepopulate deployment setting can also be a number which will relate to a single directory, the numerical value is still supported because existing instances of Eden and their maintenance scripts use this number. The use of a number is discouraged in favour of the list of names because this new approach is clearer and more flexible.
     
    2222deployment_settings.base.prepopulate = ["Standard"]
    2323}}}
    24 The Standard folder is not in the root directory, which is private/prepopulate, rather it is in demo (private/prepopulate/demo) but this will be found automatically.
     24The Standard folder is not in the root directory, which is private/templates, rather it is in demo (private/templates/demo) but this will be found automatically.
    2525
    2626Uses the roles to import some special roles and then the user directory which is a special directory which is external to the version control and so private data (potentially sensitive data - such as volunteer details) can be held and then imported.
     
    5656Which will use the questionnaire24H.csv file, which in this case will be in the same directory as the tasks.cfg file, to import the data. Using the question_list.xsl transform file which will be the static/formats/s3csv/survey directory. The importer will then use the survey/question_list function to "manage" the import using any '''onvalidate''' or '''onaccept''' callbacks that are set up by this controller.
    5757
    58 The CSV file does not '''need''' to be in the same directory as the tasks.cfg file, if it is held in a different file then the full path needs to be given relative to the private/prepopulate directory.
     58The CSV file does not '''need''' to be in the same directory as the tasks.cfg file, if it is held in a different file then the full path needs to be given relative to the private/templates directory.
    5959
    6060All transform files are stored in the static/formats/s3csv directory tree.
     
    6464*,gis_set_default_location,defaultlocation.csv
    6565}}}
    66 This uses the csv file '''default_location.csv''' and the function '''gis_set_default_location''' to set, in this case, the default location. Another special function is import_role which is used to import user permissions (or roles) examples of the roles and what the csv looks like can be found in the private/prepopulate/roles directory.
     66This uses the csv file '''default_location.csv''' and the function '''gis_set_default_location''' to set, in this case, the default location. Another special function is import_role which is used to import user permissions (or roles) examples of the roles and what the csv looks like can be found in the private/templates/roles directory.
    6767
    6868=== URL Import ===
     
    8787                    stylesheet="/home/web2py/applications/eden/static/formats/s3csv/eric.xls")
    8888}}}
     89
    8990Should we have a wrapper function for this which is easily accessed from the CLI?
    9091
    91 
    92 
    93 Rational:
     92Rationale:
    9493 * People could create their own "Deployment" pre-populate directories with unique (& contextual) data which could be used to easily create simulations. ( And be a great GCI task )
    9594 * We should separate csv from xsl (xsl could very easily confuse semi-technical users)
    9695 * CSV templates should be easily downloaded - prepopulate data should not (always) be
    9796 * All XLS should be in trunk (even if it is for private data) and have a matching CSV Template
    98  * Then a configuration file can be created where you can just list the CSV file names which you want to be imported when Sahana Eden is initialized. Copies of this files could be saved in the private/prepopulate/<deployment>/ directory then a config setting could select which file to use, to make it easy to set up Sahana Eden to have different types of data in it.
     97 * Then a configuration file can be created where you can just list the CSV file names which you want to be imported when Sahana Eden is initialized. Copies of this files could be saved in the private/templates/<deployment>/ directory then a config setting could select which file to use, to make it easy to set up Sahana Eden to have different types of data in it.
    9998
    10099----