From b89286679ba48cef0bd3b0dc1111176df7c871b5 Mon Sep 17 00:00:00 2001 From: henryk Date: Fri, 30 Sep 2005 03:03:54 +0000 Subject: lc calculation git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@24 f711b948-2313-0410-aaa9-d29f33439f0b --- utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'utils.py') diff --git a/utils.py b/utils.py index 84f3dfa..98e5823 100644 --- a/utils.py +++ b/utils.py @@ -124,7 +124,6 @@ class APDU(list): if len(self) < 4: self.extend([0] * (4-len(self))) - print self le = None for (kw, arg) in kwargs.items(): if kw == "cla": @@ -146,13 +145,15 @@ class APDU(list): else: raise TypeError, "Got an unexpected keyword argument '%s'" % kw - print self if le is not None: if len(self) > self.OFFSET_CONTENT: raise TypeError, "le can't be set when there is data to send" else: self[self.OFFSET_LE:self.OFFSET_LE+1] = (le,) + if self[self.OFFSET_LC] == None: + self[self.OFFSET_LC] = len(self)-self.OFFSET_CONTENT + for i in range(len(self)): t = type(self[i]) if t == str: @@ -240,6 +241,6 @@ if __name__ == "__main__": #response = sys.stdin.read() #parse_status(_unformat_hexdump(response)[:-2]) - print APDU((1,2,3), lc=42, cla=0x23, le=4) + print APDU((1,2,3), cla=0x23, content="hallo", lc=None) -- cgit v1.2.3