[kupfer] objects: Raise InvalidLeafError on None FileLeaf path



commit d6f88d9ca4870aec59fa91b64da549f98826dcd5
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Tue Nov 3 18:18:40 2009 +0100

    objects: Raise InvalidLeafError on None FileLeaf path

 kupfer/objects.py |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/kupfer/objects.py b/kupfer/objects.py
index edcfeb6..d42aa04 100644
--- a/kupfer/objects.py
+++ b/kupfer/objects.py
@@ -192,15 +192,16 @@ class FileLeaf (Leaf):
 	__slots__ = ("name", "object")
 
 	def __init__(self, obj, name=None):
-		"""
-		Construct a FileLeaf
+		"""Construct a FileLeaf
+
+		The display name of the file is normally derived from the full path,
+		and @name should normally be left unspecified.
 
-		The display name of the file is normally
-		derived from the full path, and @name
-		should normally be left unspecified.
 		@obj: byte string (file system encoding)
 		@name: unicode name or None for using basename
 		"""
+		if obj is None:
+			raise InvalidLeafError("File path for %s may not be None" % name)
 		# Use glib filename reading to make display name out of filenames
 		# this function returns a `unicode` object
 		if not name:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]