SF.net SVN: fclient:[723] trunk/fclient/src/fclient/lib/fcp2/key.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-25 07:08:46
|
Revision: 723
http://fclient.svn.sourceforge.net/fclient/?rev=723&view=rev
Author: jUrner
Date: 2008-07-25 07:08:54 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
unify errors
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/fcp2/key.py
Modified: trunk/fclient/src/fclient/lib/fcp2/key.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/key.py 2008-07-25 07:08:16 UTC (rev 722)
+++ trunk/fclient/src/fclient/lib/fcp2/key.py 2008-07-25 07:08:54 UTC (rev 723)
@@ -17,6 +17,10 @@
_ReMatchExact = '\A%s\Z'
KeyTypesAll = {}
+
+class ErrorKey(Exception):
+ """fcp key related errors"""
+
#**************************************************************************************
# freenet base64 for keys
#**************************************************************************************
@@ -76,14 +80,14 @@
"""converts a fcp key to a python key
@param string: (str) fcp key
@return: python key object
- @raise ValueError: if the string can not be converted
+ @raise ErrorKey: if the string can not be converted
@note: use this method to convert an arbirary key to the corrosponding python key object
"""
for clssKeyType in KeyTypesAll.values():
result = clssKeyType.fromString(string)
if result is not None:
return result
- raise ValueError('Invalid key: %s' % string)
+ raise ErrorKey('Invalid key: %s' % string)
@classmethod
def pythonToFcp(self, key):
@@ -325,7 +329,7 @@
out = [self.KeyType + self.keyData, ]
if self.docName is not None:
if self.edition is None:
- raise ValueError('no edition number specified')
+ raise ErrorKey('no edition number specified')
out.append(urllib.quote(self.docName))
out.append(urllib.quote(str(self.edition)))
if self.tail is not None:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|