[Nym3-commit] r61 - trunk

nym3-devel@lists.noreply.org nym3-devel@lists.noreply.org
Mon, 02 Aug 2004 23:12:52 +0200


Author: laurent
Date: 2004-08-02 23:12:51 +0200 (Mon, 02 Aug 2004)
New Revision: 61

Modified:
   trunk/User.py
Log:
Fix clean_surbs.


Modified: trunk/User.py
===================================================================
--- trunk/User.py	2004-08-02 20:14:23 UTC (rev 60)
+++ trunk/User.py	2004-08-02 21:12:51 UTC (rev 61)
@@ -37,12 +37,15 @@
     def encKey(self):
         return self.data['encKey']
 
-    def getSynList(self, l):
+    def getSyn(self, mid):
 	"""Retrieve a blurb consisting of the synopsis of the
 	   requested synopsis mid. May contain unwanted synopsis
 	   too."""
-	index = Config.path + os.sep + self.data['username'] + '.idx'
-
+	self.load_synbox()
+	for midlist, status, synblob in self.syn:
+	    if mid in midlist: return (midlist, status, synblob)
+	raise "Not Found"
+	
     
     def save_data(self):
 	f = open(self.datafile, 'w') # TODO : Locks?
@@ -86,7 +89,7 @@
 	    os.unlink(fname)
 	    if ec == 0: goods.append(surb)
 	self.data['nSurbs'] = 0
-	f = open(self.surbfile())
+	f = open(self.surbfile(), "w")
 	for surb in goods:
 	    f.write(surb)
 	    self.data['nSurbs'] = self.data['nSurbs'] + 1
@@ -162,7 +165,7 @@
 
 	# store the synopsis
 	self.load_synbox()
-	self.syn.append([[mid], 'clear', syn])
+	self.syn.append(([mid], 'clear', syn))
 	self.save_synbox()
 
 	# create an index entry for the synopsis