Changeset 6552 for main/waeup.sirp/trunk/src
- Timestamp:
- 24 Jul 2011, 02:41:42 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/browser.txt
r6470 r6552 255 255 ... 256 256 257 Searching Access Codes 258 ====================== 259 260 We can search for access codes already created. 261 262 First we pick some really existing access codes to look for: 263 264 >>> codes = getRootFolder()['myuniversity']['accesscodes'] 265 >>> app_1_codes = codes[u'APP-1'] 266 >>> app_2_codes = codes[u'APP-2'] 267 >>> bla_1_codes = codes[u'BLA-1'] 268 269 >>> browser.open('http://localhost/myuniversity/accesscodes/search') 270 >>> ctrl = browser.getControl(name='searchtype') 271 >>> ctrl.getControl(value='code').selected = True 272 >>> browser.getControl(name='searchterm').value = app_1_codes.keys()[0] 273 >>> browser.getControl('Search').click() 274 275 The first access code in the ``APP-1`` batch is displayed: 276 277 >>> print browser.contents 278 <!DOCTYPE html ... 279 ... 280 value="APP-1..." /></td> 281 <td>...</td> 282 <td>APP-1-...</td> 283 <td>initialized</td> 284 <td>... - AC initialized by zope.mgr</td> 285 ... 286 287 We can also search for batch serials (the number of an access code 288 inside its batch). Looking for number ``1`` will display first access 289 code of each batch ('APP-1', 'APP-2', and 'BLA-1') 290 291 >>> browser.open('http://localhost/myuniversity/accesscodes/search') 292 >>> ctrl = browser.getControl(name='searchtype') 293 >>> ctrl.getControl(value='batch_serial').selected = True 294 >>> browser.getControl(name='searchterm').value = '1' 295 >>> browser.getControl('Search').click() 296 >>> print browser.contents 297 <!DOCTYPE html ... 298 ... 299 value="APP-1..." /></td> 300 <td>1</td> 301 <td>APP-1-...</td> 302 <td>initialized</td> 303 <td>... - AC initialized by zope.mgr</td> 304 ... 305 306 And we can search for text in history messages of access 307 codes. Looking for the string ``AC initialized`` we get nearly all 308 entries: 309 310 >>> browser.open('http://localhost/myuniversity/accesscodes/search') 311 >>> ctrl = browser.getControl(name='searchtype') 312 >>> ctrl.getControl(value='history').selected = True 313 >>> browser.getControl(name='searchterm').value = 'AC initialized' 314 >>> browser.getControl('Search').click() 315 >>> print browser.contents 316 <!DOCTYPE html ... 317 ... 318 value="APP-1-<10-DIGITS>" /></td> 319 <td>1</td> 320 <td>APP-1-<10-DIGITS></td> 321 <td>initialized</td> 322 <td>... - AC initialized by zope.mgr</td> 323 ... 324 325 Enabling and Disabling Found Access Codes 326 ----------------------------------------- 327 328 If a search is successfull, we can enable or disable the found access 329 codes: 330 331 >>> browser.open('http://localhost/myuniversity/accesscodes/search') 332 >>> ctrl = browser.getControl(name='searchtype') 333 >>> ctrl.getControl(value='history').selected = True 334 >>> browser.getControl(name='searchterm').value = 'AC initialized' 335 >>> browser.getControl('Search').click() 336 337 This lists all access codes. We now tick one to disable it and click 338 on the appropriate button: 339 340 >>> entries = browser.getControl(name='entries') 341 >>> entries.controls[0].selected = True 342 >>> browser.getControl('Disable ACs').click() 343 >>> print browser.contents 344 <!DOCTYPE html ... 345 <li class="message">APP-1-<10-DIGITS> disabled.</li> 346 ... 347 348 We cannot disable the same entry again: 349 350 >>> entries = browser.getControl(name='entries') 351 >>> entries.controls[0].selected = True 352 >>> browser.getControl('Disable ACs').click() 353 >>> print browser.contents 354 <!DOCTYPE html ... 355 <li ...>APP-1-<10-DIGITS>: Disable transition not allowed.</li> 356 ... 357 358 But we can reenable the same entry: 359 360 >>> entries = browser.getControl(name='entries') 361 >>> entries.controls[0].selected = True 362 >>> browser.getControl('Enable ACs').click() 363 >>> print browser.contents 364 <!DOCTYPE html ... 365 <li class="message">APP-1-<10-DIGITS> (re-)enabled.</li> 366 ... 367 368 Enabling already enabled items gives a warning: 369 370 >>> entries = browser.getControl(name='entries') 371 >>> entries.controls[0].selected = True 372 >>> browser.getControl('Enable ACs').click() 373 >>> print browser.contents 374 <!DOCTYPE html ... 375 <li ...>APP-1-<10-DIGITS>: Re-enable transition not allowed.</li> 376 ... 257 377 258 378 Log- and Archive Files
Note: See TracChangeset for help on using the changeset viewer.