[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Fix portability bug with 2.0



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv28714/lib/mixminion

Modified Files:
	ClientDirectory.py 
Log Message:
Fix portability bug with 2.0

Index: ClientDirectory.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientDirectory.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ClientDirectory.py	13 Oct 2003 17:30:24 -0000	1.5
+++ ClientDirectory.py	17 Oct 2003 17:23:24 -0000	1.6
@@ -980,6 +980,7 @@
 class RandomServersPathElement(PathElement):
     def __init__(self, n=None, approx=None):
         assert not (n and approx)
+        assert n is None or approx is None
         self.n=n
         self.approx=approx
     def validate(self, directory, start, end):
@@ -987,14 +988,17 @@
     def getFixedServer(self, directory, start, end):
         return None
     def getServerNames(self):
-        if self.n:
+        if self.n is not None:
             n = self.n
         else:
             prng = mixminion.Crypto.getCommonPRNG()
             n = int(prng.getNormal(self.approx,1.5)+0.5)
         return [ None ] * n
     def getMinLength(self):
-        return max(self.n,self.approx)
+        if self.n is not None: 
+            return self.n
+        else:
+            return self.approx
     def __repr__(self):
         if self.n:
             assert not self.approx