home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Python 1.3 / source code / Demo / sgi / flp / tcache.py < prev    next >
Encoding:
Text File  |  1995-12-17  |  487 b   |  33 lines  |  [TEXT/R*ch]

  1. # Test bug in caching of forms
  2.  
  3. import sys
  4. import os
  5. import flp
  6.  
  7. filename = 'tcache.fd'
  8. cachename = filename + 's'
  9.  
  10. def first():
  11.     try:
  12.         os.unlink(cachename)
  13.     except os.error:
  14.         pass
  15.     first = flp.parse_form(filename, 'first')
  16.  
  17. def second():
  18.     forms = flp.parse_forms(filename)
  19.     k = forms.keys()
  20.     if 'first' in k and 'second' in k:
  21.         print 'OK'
  22.     else:
  23.         print 'BAD!', k
  24.  
  25. def main():
  26.     if sys.argv[1:]:
  27.         second()
  28.     else:
  29.         first()
  30.         print 'Now run the script again with an argument'
  31.  
  32. main()
  33.