[Zope-CVS] CVS: Products/AdaptableStorage/mapper_std - PathKeychainGenerator.py:1.3

Shane Hathaway shane@zope.com
Tue, 14 Jan 2003 12:46:20 -0500


Update of /cvs-repository/Products/AdaptableStorage/mapper_std
In directory cvs.zope.org:/tmp/cvs-serv7661/mapper_std

Modified Files:
	PathKeychainGenerator.py 
Log Message:
Made path keychains raise a better exception when they get invalid input.


=== Products/AdaptableStorage/mapper_std/PathKeychainGenerator.py 1.2 => 1.3 ===
--- Products/AdaptableStorage/mapper_std/PathKeychainGenerator.py:1.2	Mon Jan  6 18:17:48 2003
+++ Products/AdaptableStorage/mapper_std/PathKeychainGenerator.py	Tue Jan 14 12:46:18 2003
@@ -16,7 +16,7 @@
 $Id$
 """
 
-from mapper_public import IKeychainGenerator
+from mapper_public import IKeychainGenerator, MappingError
 
 class PathKeychainGenerator:
     """Path-based keychain generator
@@ -24,7 +24,9 @@
     __implements__ = IKeychainGenerator
 
     def makeKeychain(self, event, name, stored):
-        if name.startswith('.') or '/' in name:
+        if name is None:
+            raise MappingError('Path keychains require a name')
+        if '/' in name:
             raise ValueError, '%s is not a legal name' % name
         parent_keychain = event.getKeychain()
         k = parent_keychain[-1]