From: <lu...@us...> - 2010-06-06 14:18:57
|
Revision: 420 http://pyscard.svn.sourceforge.net/pyscard/?rev=420&view=rev Author: ludov Date: 2010-06-06 14:18:51 +0000 (Sun, 06 Jun 2010) Log Message: ----------- Add smartcard.scard.SCardGetErrorMessage(self.hresult) also for a BaseSCardException representation Modified Paths: -------------- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py Modified: trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py =================================================================== --- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-05-25 09:57:51 UTC (rev 419) +++ trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-06 14:18:51 UTC (rev 420) @@ -40,7 +40,8 @@ def __str__(self): """Returns a string representation of the exception.""" - return "scard exception!" + return repr("scard exception: " + + smartcard.scard.SCardGetErrorMessage(self.hresult)) class EstablishContextException(BaseSCardException): """Raised when scard failed to establish context with PCSC.""" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-06-06 14:20:47
|
Revision: 421 http://pyscard.svn.sourceforge.net/pyscard/?rev=421&view=rev Author: ludov Date: 2010-06-06 14:20:41 +0000 (Sun, 06 Jun 2010) Log Message: ----------- Only catch BaseSCardException exceptions in the sample code Modified Paths: -------------- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py Modified: trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py =================================================================== --- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-06 14:18:51 UTC (rev 420) +++ trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-06 14:20:41 UTC (rev 421) @@ -69,5 +69,5 @@ import sys try: raise EstablishContextException( smartcard.scard.SCARD_E_NO_MEMORY ) - except: - print sys.exc_info()[1] + except BaseSCardException as exc: + print exc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-06-06 15:10:50
|
Revision: 427 http://pyscard.svn.sourceforge.net/pyscard/?rev=427&view=rev Author: ludov Date: 2010-06-06 15:10:44 +0000 (Sun, 06 Jun 2010) Log Message: ----------- make pep8 happy Modified Paths: -------------- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py Modified: trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py =================================================================== --- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-06 15:08:13 UTC (rev 426) +++ trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-06 15:10:44 UTC (rev 427) @@ -27,6 +27,7 @@ # gemalto scard library import smartcard.scard + class BaseSCardException: """Base class for scard (aka PCSC) exceptions. @@ -34,40 +35,52 @@ low-level PCSC access to readers and cards. """ - def __init__( self, hresult ): + + def __init__(self, hresult): """Constructor that stores the pcsc error status.""" - self.hresult=hresult + self.hresult = hresult def __str__(self): """Returns a string representation of the exception.""" - return repr("scard exception: " + + return repr("scard exception: " + smartcard.scard.SCardGetErrorMessage(self.hresult)) + class EstablishContextException(BaseSCardException): """Raised when scard failed to establish context with PCSC.""" def __str__(self): """Returns a string representation of the exception.""" - return repr( 'Failure to establish context: ' + smartcard.scard.SCardGetErrorMessage(self.hresult) ) + return repr('Failure to establish context: ' + + smartcard.scard.SCardGetErrorMessage(self.hresult)) + class ListReadersException(BaseSCardException): """Raised when scard failed to list readers.""" + def __str__(self): - return repr( 'Failure to list readers: ' + smartcard.scard.SCardGetErrorMessage(self.hresult) ) + return repr('Failure to list readers: ' + + smartcard.scard.SCardGetErrorMessage(self.hresult)) + class EstablishContextException(BaseSCardException): """Raised when scard failed to establish a PCSC context.""" + def __str__(self): - return repr( 'Failure to establish context: ' + smartcard.scard.SCardGetErrorMessage(self.hresult) ) + return repr('Failure to establish context: ' + + smartcard.scard.SCardGetErrorMessage(self.hresult)) + class ReleaseContextException(BaseSCardException): """Raised when scard failed to release PCSC context.""" + def __str__(self): - return repr( 'Failure to release context: ' + smartcard.scard.SCardGetErrorMessage(self.hresult) ) + return repr('Failure to release context: ' + + smartcard.scard.SCardGetErrorMessage(self.hresult)) if __name__ == "__main__": import sys try: - raise EstablishContextException( smartcard.scard.SCARD_E_NO_MEMORY ) + raise EstablishContextException(smartcard.scard.SCARD_E_NO_MEMORY) except BaseSCardException as exc: print exc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jda...@us...> - 2010-06-08 16:08:16
|
Revision: 447 http://pyscard.svn.sourceforge.net/pyscard/?rev=447&view=rev Author: jdaussel Date: 2010-06-08 16:08:09 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Make pep8 happy Modified Paths: -------------- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py Modified: trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py =================================================================== --- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-07 17:09:55 UTC (rev 446) +++ trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-08 16:08:09 UTC (rev 447) @@ -55,7 +55,8 @@ self.groupname = groupname def __str__(self): - return repr('Failure to add reader: ' + self.readername + ' to group: ' + self.groupname + ' ' + + return repr('Failure to add reader: ' + self.readername + + ' to group: ' + self.groupname + ' ' + smartcard.scard.SCardGetErrorMessage(self.hresult)) @@ -84,8 +85,8 @@ self.readername = readername def __str__(self): - return repr('Failure to introduce a new reader: ' + self.readername + ' ' + - smartcard.scard.SCardGetErrorMessage(self.hresult)) + return repr('Failure to introduce a new reader: ' + self.readername + + ' ' + smartcard.scard.SCardGetErrorMessage(self.hresult)) class ReleaseContextException(BaseSCardException): @@ -105,7 +106,8 @@ self.groupname = groupname def __str__(self): - return repr('Failure to remove reader: ' + self.readername + ' from group: ' + self.groupname + ' ' + + return repr('Failure to remove reader: ' + self.readername + + ' from group: ' + self.groupname + ' ' + smartcard.scard.SCardGetErrorMessage(self.hresult)) if __name__ == "__main__": This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-06-13 18:33:44
|
Revision: 491 http://pyscard.svn.sourceforge.net/pyscard/?rev=491&view=rev Author: ludov Date: 2010-06-13 18:33:38 +0000 (Sun, 13 Jun 2010) Log Message: ----------- do not import sys anymore Modified Paths: -------------- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py Modified: trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py =================================================================== --- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-12 23:06:52 UTC (rev 490) +++ trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-13 18:33:38 UTC (rev 491) @@ -111,7 +111,6 @@ smartcard.scard.SCardGetErrorMessage(self.hresult)) if __name__ == "__main__": - import sys try: raise EstablishContextException(smartcard.scard.SCARD_E_NO_MEMORY) except BaseSCardException as exc: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jda...@us...> - 2010-06-23 11:00:22
|
Revision: 493 http://pyscard.svn.sourceforge.net/pyscard/?rev=493&view=rev Author: jdaussel Date: 2010-06-23 11:00:16 +0000 (Wed, 23 Jun 2010) Log Message: ----------- Fixed exception handling syntax for python 2.4 Modified Paths: -------------- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py Modified: trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py =================================================================== --- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-13 18:54:29 UTC (rev 492) +++ trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-23 11:00:16 UTC (rev 493) @@ -113,5 +113,5 @@ if __name__ == "__main__": try: raise EstablishContextException(smartcard.scard.SCARD_E_NO_MEMORY) - except BaseSCardException as exc: + except BaseSCardException,exc: print exc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jda...@us...> - 2010-06-23 11:24:28
|
Revision: 495 http://pyscard.svn.sourceforge.net/pyscard/?rev=495&view=rev Author: jdaussel Date: 2010-06-23 11:24:22 +0000 (Wed, 23 Jun 2010) Log Message: ----------- BaseSCardException now derives from Exception to comply with PEP 352 Modified Paths: -------------- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py Modified: trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py =================================================================== --- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-23 11:15:16 UTC (rev 494) +++ trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-23 11:24:22 UTC (rev 495) @@ -28,7 +28,7 @@ import smartcard.scard -class BaseSCardException: +class BaseSCardException(Exception): """Base class for scard (aka PCSC) exceptions. scard exceptions are raised by the scard module, i.e. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2010-06-23 12:27:38
|
Revision: 499 http://pyscard.svn.sourceforge.net/pyscard/?rev=499&view=rev Author: ludov Date: 2010-06-23 12:27:32 +0000 (Wed, 23 Jun 2010) Log Message: ----------- make pep8 happy Modified Paths: -------------- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py Modified: trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py =================================================================== --- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-23 12:26:49 UTC (rev 498) +++ trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-23 12:27:32 UTC (rev 499) @@ -113,5 +113,5 @@ if __name__ == "__main__": try: raise EstablishContextException(smartcard.scard.SCARD_E_NO_MEMORY) - except BaseSCardException,exc: + except BaseSCardException, exc: print exc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |