]> khamidou — GitHub mirrors - liszt.git/commitdiff
some fixes to utils.py
authorkhamidou <khamidou@gmail.com>
Wed, 24 Feb 2010 20:33:46 +0000 (21:33 +0100)
committerkhamidou <khamidou@gmail.com>
Wed, 24 Feb 2010 20:33:46 +0000 (21:33 +0100)
libliszt/utils.py
liszt
liszt-daemon

index c9603d2314041f579d9c8161e3cad7a2b1a71917..c4889eaaf60847c1d3f9ed5f7b34ad95472ea53e 100644 (file)
@@ -180,9 +180,9 @@ class LisztSession:
                 continue
 
     def create_list(self, listname):
-        listname = listname.encode("utf8")
+        listname = unicode(listname)
         try:
-            urllib2.urlopen(base + "/create/" + quote(listname) + "/")
+            urllib2.urlopen(base + "/create/" + quote(listname.encode("utf8")) + "/")
         except HTTPError:
             bailout("Unable to create the list " + listname)
 
@@ -204,6 +204,7 @@ class LisztSession:
         return json.load(req)
 
     def get_list(self, listname):
+        listname = listname.encode("utf8")
         req = None
 
         try:
@@ -215,6 +216,8 @@ class LisztSession:
         return json.load(req)
 
     def get_entry(self, listname, index):
+        listname = listname.encode("utf8")
+
         try:
             req = urllib2.urlopen(base + "/get/" + quote(listname) + "/" + str(index) + "/")
         except HTTPError:
@@ -224,18 +227,23 @@ class LisztSession:
         return json.load(req)
 
     def remove_list(self, listname):
+        listname = listname.encode("utf8")
+
         try:
             urllib2.urlopen(base + "/remove/" + quote(listname) + "/")
         except HTTPError:
             bailout("Unable to remove the list " + listname)
 
     def remove_list_entry(self, listname, index):
+        listname = listname.encode("utf8")
+
         try:
             urllib2.urlopen(base + "/remove/" + quote(listname) + "/" + quote(index) + "/")
         except HTTPError:
             bailout("Unable to remove the entry " + index + "from list " + listname)
 
     def update_list_entry(self, listname, index, contents):
+        listname = listname.encode("utf8")
         ec = urllib.urlencode(contents)
         try:
             urllib2.urlopen(base + "/update/" + listname + "/" + str(index) + "/", ec)
diff --git a/liszt b/liszt
index 8cc66d1dfa9b4d7b0b07f7e1a6f980abeab3547c..0af50c76a08a157019302d9dfb82a3ff6c9d32da 100755 (executable)
--- a/liszt
+++ b/liszt
@@ -281,9 +281,8 @@ class CommandParser(object):
         # Delete the list and recreate the entries.
         dict = {"request" : "delete-list", "listname" : listname,}
         create_spool_file(dict)
-        time.sleep(0.2) # Make sure that the list is removed before doing anything
+
         # Recreate it
-        # Delete the list and recreate the entries.
         dict = {"request" : "create-list", "listname" : listname,}
         create_spool_file(dict)
 
index 349902097abea45b60c0b5e5c8da57915593ee57..778adc425eca5232e22fc6d366e6b85fa5e98105 100755 (executable)
@@ -44,11 +44,12 @@ def process_json_delayed_file(path, session):
         return
 
     data = json.load(fd)
-
+    print data
     if "request" not in data or "listname" not in data:
         return # Discard incorrect files
 
     if data["request"] == "create-list":
+        print "let there be a list"
         session.create_list(data["listname"])
     elif data["request"] == "create-entry":
         try:
@@ -57,6 +58,7 @@ def process_json_delayed_file(path, session):
             return
 
     elif data["request"] == "delete-list":
+        print "let there be no list"
         session.remove_list(data["listname"])
     elif data["request"] == "delete-entry":
         try:
@@ -113,7 +115,6 @@ def sync_cached_list(listname):
     cached_list = CachedList(listname)
     server_list = session.get_list(listname)
 
-    print server_list
     for entry in server_list:
 
         if isinstance(entry, list): # Discard lists for the moment