diff options
author | Kenny Millington <kenny@helios.(none)> | 2010-10-18 11:50:07 +0100 |
---|---|---|
committer | Michael P. Soulier <msoulier@digitaltorque.ca> | 2010-10-22 20:33:05 -0400 |
commit | 71d827dd89b78424f5d89e712e0a189ca2fcc71d (patch) | |
tree | d502fbf03ea5bf350c35a59d7d05d28a7d85df19 | |
parent | 4396124b8d45d2222a936b551e983d35f003577c (diff) | |
download | tftpy-71d827dd89b78424f5d89e712e0a189ca2fcc71d.tar.gz |
Allow dyn_file_func to trigger a FileNotFound error.
Signed-off-by: Michael P. Soulier <msoulier@digitaltorque.ca>
-rw-r--r-- | tftpy/TftpStates.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tftpy/TftpStates.py b/tftpy/TftpStates.py index fdc4566..c521e51 100644 --- a/tftpy/TftpStates.py +++ b/tftpy/TftpStates.py @@ -593,6 +593,12 @@ class TftpStateServerRecvRRQ(TftpState): log.debug("No such file %s but using dyn_file_func" % path) self.context.fileobj = \ self.context.dyn_file_func(self.context.file_to_transfer) + + if self.context.fileobj is None: + log.debug("dyn_file_func returned 'None', treating as " + "FileNotFound") + self.sendError(TftpErrors.FileNotFound) + raise TftpException, "File not found: %s" % path else: self.sendError(TftpErrors.FileNotFound) raise TftpException, "File not found: %s" % path |