summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael P. Soulier <msoulier@digitaltorque.ca>2012-10-04 08:25:36 -0400
committerMichael P. Soulier <msoulier@digitaltorque.ca>2012-10-04 08:25:36 -0400
commit47c0eda6d2d488e2fe9a134e94af90a14293cb41 (patch)
tree07d4b4c8055d66c27a5444142423f2ed1b0cd566
parentb57e583798be5e145f21ad0caf1c5d18f485df2a (diff)
parenta78f0a6b2968a86e5aadf48a5b3df3cf729c9622 (diff)
downloadtftpy-47c0eda6d2d488e2fe9a134e94af90a14293cb41.tar.gz
Merge remote branch 'micolous/master' into merge
-rw-r--r--tftpy/TftpServer.py7
-rw-r--r--tftpy/__init__.py21
2 files changed, 16 insertions, 12 deletions
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 *