Resume after exception
peterbe at gmail.com
peterbe at gmail.com
Tue Jun 14 08:01:07 EDT 2005
Why does the first function return True? Shouldn't it return the file
content? That's at least what the function name implies.
You call the second function open_command() which returns a boolean.
Feels wrong.
Where you have written "How?" I suggest that you replace that by:
return open_file("foo.bar", 1)
and change open_file() to look something like this:
def open_file(file_name, ignore_lock=False):
f = file(file_name, 'r')
{read first line for file lock info}
if first_line == "FILE LOCKED" and not ignore_lock:
raise FileLockedException(lock_user, lock_timestamp)
{read remainder of file}
return True
More information about the Python-list
mailing list