aboutsummaryrefslogtreecommitdiffstats
path: root/utils.py
diff options
context:
space:
mode:
authorhenryk <henryk@f711b948-2313-0410-aaa9-d29f33439f0b>2005-09-30 04:13:34 +0000
committerhenryk <henryk@f711b948-2313-0410-aaa9-d29f33439f0b>2005-09-30 04:13:34 +0000
commit2d8068b0e34d60c0d5bdfe6e5637d89786cd3ec1 (patch)
tree8c82464b8aebcd3aa81d35f9e9c961889f31449a /utils.py
parent82eab03c687907924e5e4a0188e4c1ff61642a03 (diff)
Use the APDU object throughout (working, but not complete)
git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@26 f711b948-2313-0410-aaa9-d29f33439f0b
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/utils.py b/utils.py
index 08a2031..c7366a7 100644
--- a/utils.py
+++ b/utils.py
@@ -95,6 +95,8 @@ class APDU(list):
OFFSET_LC = 4
OFFSET_LE = 4
OFFSET_CONTENT = 5
+
+ LC_AUTO = None
"""Class for an APDU that mostly behaves like a list."""
def __init__(self, *args, **kwargs):
@@ -124,7 +126,7 @@ class APDU(list):
if len(self) < 4:
self.extend([0] * (4-len(self)))
if len(self) < self.OFFSET_LC+1:
- self[self.OFFSET_LC:self.OFFSET_LC+1] = [None]
+ self[self.OFFSET_LC:self.OFFSET_LC+1] = [self.LC_AUTO]
le = None
for (kw, arg) in kwargs.items():
@@ -153,7 +155,7 @@ class APDU(list):
else:
self[self.OFFSET_LE:self.OFFSET_LE+1] = (le,)
- if self[self.OFFSET_LC] == None:
+ if self[self.OFFSET_LC] == self.LC_AUTO:
if len(self) > self.OFFSET_CONTENT:
self[self.OFFSET_LC] = len(self)-self.OFFSET_CONTENT
else: