| 56 | ==== Session variable : session.path_to_config ==== |
| 57 | This will initialize a session variable that will help us get the status of the selector. If the session variable is “none” we can initialize it to “”, and later in the controller it can be set to the path of 000_config of that particular eden they want the to the web-setup to run on. |
| 58 | This session variable will help us to get the path of the 000_config from the controllers. |
| 59 | |
| 60 | ==== Parsing 000_config.py ==== |
| 61 | |
| 62 | Once we get the path of 000_config we need to copy that file in the websetup models by the the name of modified_config.py so that it shall run after this file closes. Now open modified_config using os.path.join in the “w” mode and 000_config in the “r” mode. We need to read 000_config and |
| 63 | This would result in the creation of 2 dicts one is deployment_settings and the other one is for the modules deployment_settings.modules .Now 6th and 7th steps will help us to maintain the dicts for modules that were turned off by commenting them. |
| 64 | {{{ |
| 65 | #!html |
| 66 | <p class=MsoListParagraphCxSpMiddle style='margin-left:0cm'>---------------------------------------------------------------------------------------------------------------------------------------------------------</p> |
| 67 | <p style='color:#595959'>1.Remove the line containing <b>“s3base.s3config(” </b>from |
| 68 | the starting of the file</p> |
| 69 | |
| 70 | <p class=MsoListParagraphCxSpMiddle style='margin-left:0cm'><span |
| 71 | style='color:#595959'> </span></p> |
| 72 | |
| 73 | <p class=MsoListParagraphCxSpMiddle style='margin-left:0cm'><span |
| 74 | style='color:#595959'>2. Insert </span></p> |
| 75 | |
| 76 | <p class=MsoListParagraphCxSpMiddle style='margin-left:0cm'><b><span |
| 77 | style='color:#595959'>“ from gluon.storage import Storage</span></b></p> |
| 78 | |
| 79 | <p class=MsoListParagraphCxSpMiddle style='margin-left:0cm'><b><span |
| 80 | style='color:#595959'>from gluon.contrib.simplejson.ordered_dict import |
| 81 | OrderedDict</span></b></p> |
| 82 | |
| 83 | <p class=MsoListParagraphCxSpMiddle style='margin-left:0cm'><b><span |
| 84 | style='color:#595959'>deployment_settings = Storage( “</span></b><span |
| 85 | style='color:#595959'> </span></p> |
| 86 | |
| 87 | <p class=MsoListParagraphCxSpLast style='margin-left:0cm'><span |
| 88 | style='color:#595959'>before the first line where they find “deployment_settings.” |
| 89 | Without a “<b>#</b>” in the 000_config.py </span></p> |
| 90 | |
| 91 | <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span |
| 92 | style='color:#595959'>3. And add <b>“ ) ”</b> Immediately before the import of |
| 93 | storage and remove the import of storage from there </span></p> |
| 94 | |
| 95 | <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span |
| 96 | style='color:#595959'> </span></p> |
| 97 | |
| 98 | <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span |
| 99 | style='color:#595959'>4. Add 4 spaces to each line between “<b>Storage(</b>“ |
| 100 | and “<b>)</b>” even the commented ones </span></p> |
| 101 | |
| 102 | <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span |
| 103 | style='color:#595959'> </span></p> |
| 104 | |
| 105 | <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span |
| 106 | style='color:#595959'>5<b>.</b> Make the following to the lines except the ones |
| 107 | containing “#” before the use of “<b>deployment_settings.</b>” </span></p> |
| 108 | |
| 109 | <p class=MsoListParagraphCxSpFirst style='margin-bottom:0cm;margin-bottom:.0001pt; |
| 110 | text-indent:-18.0pt'><span style='font-family:Wingdings;color:#595959'>v<span |
| 111 | style='font:7.0pt "Times New Roman"'> </span></span><span |
| 112 | style='color:#595959'>Wrap each word containing “<b>deployment_settings.</b>” |
| 113 | with “” </span></p> |
| 114 | |
| 115 | <p class=MsoListParagraphCxSpLast style='margin-bottom:0cm;margin-bottom:.0001pt; |
| 116 | text-indent:-18.0pt'><span style='font-family:Wingdings;color:#595959'>v<span |
| 117 | style='font:7.0pt "Times New Roman"'> </span></span><span |
| 118 | style='color:#595959'>Add a <b>“,”(coma)</b> after the line </span></p> |
| 119 | |
| 120 | <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span |
| 121 | style='color:#595959'> </span></p> |
| 122 | |
| 123 | <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span |
| 124 | style='color:#595959'>6. Check if the </span></p> |
| 125 | |
| 126 | <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><b><span |
| 127 | style='color:#595959'>“<?module_name?> = Storage( \n” </span></b><span |
| 128 | style='color:#595959'>has a “#” in the same line then turn </span></p> |
| 129 | |
| 130 | <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span |
| 131 | style='color:#595959'>module[module_name] ( variable in layout.py in modules |
| 132 | ) off .</span></p> |
| 133 | |
| 134 | <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span |
| 135 | style='color:#595959'> </span></p> |
| 136 | |
| 137 | <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span |
| 138 | style='color:#595959'>7<b>.</b>Remove “#” from there till the line you get <b>“#),” |
| 139 | </b></span></p> |
| 140 | |
| 141 | <p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'>----------------------------------------------------------------------------------------------------------------------------------------------------------</p> |
| 142 | |
| 143 | }}} |
| 144 | Handling database conflicts |
| 145 | There should be a list that will keep a list of databse_name and database_types of 2 eden application cannot be same at same time therefore a list of database types and databse names needs to be made |
| 146 | |
| 147 | For this we will first have to generate a list paths .We can search for “Copyright: 2010 (c) Sahana Software Foundation” in all the LICENSE files of applications. |
| 148 | |
| 149 | Then we will have to search in the list of paths for specific keywords like “deployment_setting.database.database” This can be done using regex command in grep |
| 150 | |
| 151 | If path(variable) is in the list of paths containing: |
| 152 | Command_line = “grep ” + “deployment_setting.database.database” + “path” |
| 153 | Line = subprocess.Popen(command_line); |
| 154 | |
| 155 | Now search the file for deployment_settings.database.db_type .These list will help in validating for the database values. |
| 156 | |
| 157 | |
| 158 | |