Changes between Version 3 and Version 4 of DeveloperGuidelines/PrePopulate
- Timestamp:
- 06/06/12 16:18:37 (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelines/PrePopulate
v3 v4 13 13 == Methods == 14 14 === 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/ prepopulatedirectory tree and must include a file called tasks.cfg.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/templates directory tree and must include a file called tasks.cfg. 16 16 17 17 The 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. … … 22 22 deployment_settings.base.prepopulate = ["Standard"] 23 23 }}} 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.24 The 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. 25 25 26 26 Uses 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. … … 56 56 Which 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. 57 57 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/ prepopulatedirectory.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/templates directory. 59 59 60 60 All transform files are stored in the static/formats/s3csv directory tree. … … 64 64 *,gis_set_default_location,defaultlocation.csv 65 65 }}} 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.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/templates/roles directory. 67 67 68 68 === URL Import === … … 87 87 stylesheet="/home/web2py/applications/eden/static/formats/s3csv/eric.xls") 88 88 }}} 89 89 90 Should we have a wrapper function for this which is easily accessed from the CLI? 90 91 91 92 93 Rational: 92 Rationale: 94 93 * 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 ) 95 94 * We should separate csv from xsl (xsl could very easily confuse semi-technical users) 96 95 * CSV templates should be easily downloaded - prepopulate data should not (always) be 97 96 * 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. 99 98 100 99 ----