Changeset 5125 for main/waeup.sirp/trunk
- Timestamp:
- 5 Apr 2010, 13:10:57 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/browser.txt
r5115 r5125 1 Browsing the access-code related UI components 2 ********************************************** 1 :mod:`waeup.sirp.accesscodes.browser` -- UI components for access-codes 2 *********************************************************************** 3 4 .. module:: waeup.sirp.accesscodes.browser 3 5 4 6 Here we visit the access-code related parts of a WAeUP SIRP site using … … 130 132 >>> browser.getControl('Create batch').click() 131 133 134 And a third one that can be deleted afterwards: 135 136 >>> browser.getLink('Add Scratch Card Batch').click() 137 >>> browser.getControl(name='form.batch_prefix').value = 'BLA' 138 >>> browser.getControl(name='form.entry_num').value = '3' 139 >>> browser.getControl(name='form.cost').value = '19.12' 140 >>> browser.getControl('Create batch').click() 141 142 Creating Archive Files 143 ====================== 144 145 Once a batch is created, we can archive it. To do so we have to tick 146 the respective checkbox and click on 'Archive': 147 148 >>> ctrl = browser.getControl(name='batches') 149 >>> ctrl.getControl(value='APP-2').selected = True 150 >>> browser.getControl(name='archive').click() 151 >>> print browser.contents 152 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 153 ... 154 <li ...>Archived APP-2 (APP-2_archive-...-zope.mgr.csv)</li> 155 ... 156 157 If we do not select a batch and try to archive or delete, the system 158 will complain: 159 160 >>> browser.getControl(name='archive').click() 161 >>> print browser.contents 162 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 163 ... 164 <li ...>No batch selected.</li> 165 ... 166 167 Deleting Batches 168 ================ 169 170 We can delete batches. They are automatically archived when doing so: 171 172 >>> ctrl = browser.getControl(name='batches') 173 >>> ctrl.getControl(value='BLA-1').selected = True 174 >>> browser.getControl('Archive and Delete').click() 175 >>> print browser.contents 176 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 177 ...Archived BLA-1 (BLA-1_archive-...-zope.mgr.csv)... 178 ...Deleted batch BLA-1... 179 ... 180 181 182 Log- and Archive Files 183 ====================== 184 185 We store log- and archive-files inside the storage managed by the 186 local datacenter. Access-code related files are placed inside an 187 ``accesscode`` subdir: 188 189 >>> ac_storage = os.path.join(uploadpath, 'accesscodes') 190 191 Log files for access-code batches 192 --------------------------------- 193 194 Whenever a batch is created, there is also a log file with all entries 195 created: 196 197 >>> sorted(os.listdir(ac_storage)) 198 ['APP-1-...-zope.mgr.csv', 'APP-2-...-zope.mgr.csv', ...] 199 200 Each logfile name contains the prefix, batch number, date of creation 201 and userid of creator. 202 203 >>> logfile1 = os.path.join(ac_storage, 204 ... sorted(os.listdir(ac_storage))[0]) 205 >>> print open(logfile1, 'rb').read() 206 "serial","ac","cost" 207 "APP","1","12.12" 208 "0","APP-1-<10-DIGITS>" 209 "1","APP-1-<10-DIGITS>" 210 "2","APP-1-<10-DIGITS>" 211 "3","APP-1-<10-DIGITS>" 212 "4","APP-1-<10-DIGITS>" 213 214 215 Archive files 216 ------------- 217 218 We created an archive file above. An archive file name consists of the 219 batch prefix, batch number, the string ``_archive``, creation datetime of 220 the archive file and userid of batch creator: 221 222 >>> sorted(os.listdir(ac_storage)) 223 [..., 'BLA-1_archive-...-zope.mgr.csv'] 224 225 Archive files eventually also contain infos about invalidation dates 226 and have a slightly different format therefore. 227 228 >>> archive_file = os.path.join(ac_storage, os.listdir(ac_storage)[-1]) 229 >>> print open(archive_file, 'rb').read() 230 "prefix","serial","ac","student","date" 231 "BLA","19.12","1","3" 232 "BLA","0","BLA-1-<10-DIGITS>","","" 233 "BLA","1","BLA-1-<10-DIGITS>","","" 234 "BLA","2","BLA-1-<10-DIGITS>","","" 235 132 236 Clean up: 133 237
Note: See TracChangeset for help on using the changeset viewer.