mirror of https://github.com/python/cpython
* Lib/sgi/flp.py: fix caching bug (always write the whole file to
the cache!)
This commit is contained in:
parent
29e7af07f0
commit
9e1e149a5f
|
@ -23,22 +23,12 @@ error = 'flp.error'
|
|||
#
|
||||
def parse_form(filename, formname):
|
||||
forms = checkcache(filename)
|
||||
if forms != None:
|
||||
if forms.has_key(formname):
|
||||
return forms[formname]
|
||||
else:
|
||||
forms = {}
|
||||
fp = _open_formfile(filename)
|
||||
nforms = _parse_fd_header(fp)
|
||||
for i in range(nforms):
|
||||
form = _parse_fd_form(fp, formname)
|
||||
if form <> None:
|
||||
break
|
||||
if forms is None:
|
||||
forms = parse_forms(filename)
|
||||
if forms.has_key(formname):
|
||||
return forms[formname]
|
||||
else:
|
||||
raise error, 'No such form in fd file'
|
||||
forms[formname] = form
|
||||
writecache(filename, forms)
|
||||
return form
|
||||
|
||||
#
|
||||
# Externally visible function. Load all forms.
|
||||
|
|
|
@ -23,22 +23,12 @@ error = 'flp.error'
|
|||
#
|
||||
def parse_form(filename, formname):
|
||||
forms = checkcache(filename)
|
||||
if forms != None:
|
||||
if forms.has_key(formname):
|
||||
return forms[formname]
|
||||
else:
|
||||
forms = {}
|
||||
fp = _open_formfile(filename)
|
||||
nforms = _parse_fd_header(fp)
|
||||
for i in range(nforms):
|
||||
form = _parse_fd_form(fp, formname)
|
||||
if form <> None:
|
||||
break
|
||||
if forms is None:
|
||||
forms = parse_forms(filename)
|
||||
if forms.has_key(formname):
|
||||
return forms[formname]
|
||||
else:
|
||||
raise error, 'No such form in fd file'
|
||||
forms[formname] = form
|
||||
writecache(filename, forms)
|
||||
return form
|
||||
|
||||
#
|
||||
# Externally visible function. Load all forms.
|
||||
|
|
Loading…
Reference in New Issue