diff --git a/tftpy/TftpServer.py b/tftpy/TftpServer.py index 364227c..0f15fc0 100644 --- a/tftpy/TftpServer.py +++ b/tftpy/TftpServer.py @@ -28,8 +28,11 @@ class TftpServer(TftpSession): # A dict of sessions, where each session is keyed by a string like # ip:tid for the remote end. self.sessions = {} - - if os.path.exists(self.root): + + if self.dyn_file_func: + if not callable(self.dyn_file_func): + raise TftpException, "A dyn_file_func supplied, but it is not callable." + elif os.path.exists(self.root): log.debug("tftproot %s does exist" % self.root) if not os.path.isdir(self.root): raise TftpException, "The tftproot must be a directory." diff --git a/tftpy/__init__.py b/tftpy/__init__.py index e8ef87f..fba9a9f 100644 --- a/tftpy/__init__.py +++ b/tftpy/__init__.py @@ -11,14 +11,15 @@ directly. The TftpClient and TftpServer classes can be reached through it. import sys # Make sure that this is at least Python 2.3 -verlist = sys.version_info -if not verlist[0] >= 2 or not verlist[1] >= 3: - raise AssertionError, "Requires at least Python 2.3" +required_version = (2, 3) +if sys.version_info < required_version: + raise ImportError, "Requires at least Python 2.3" + +from tftpy.TftpShared import * +from tftpy.TftpPacketTypes import * +from tftpy.TftpPacketFactory import * +from tftpy.TftpClient import * +from tftpy.TftpServer import * +from tftpy.TftpContexts import * +from tftpy.TftpStates import * -from TftpShared import * -from TftpPacketTypes import * -from TftpPacketFactory import * -from TftpClient import * -from TftpServer import * -from TftpContexts import * -from TftpStates import *