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)
return json.load(req)
def get_list(self, listname):
+ listname = listname.encode("utf8")
req = None
try:
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:
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)
# 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)
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:
return
elif data["request"] == "delete-list":
+ print "let there be no list"
session.remove_list(data["listname"])
elif data["request"] == "delete-entry":
try:
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