def post(self):
   name = self.request.get("name")
   compressed = not not self.request.get("compressed")
   key = self.request.get("key", None)
   value = self.request.get("value", None)
   if name:
     writer = RecordIOWriter(name)
     if key == None and value == None:
       writer.create(compressed)
     elif value == None:
       writer.remove(key)
       writer.commit_sync()
     else:
       writer.insert(str(key), eval(value))
       writer.commit_sync()
     start = None
     if key:
       start = str(key)
     self.redirect("?name=" + str(urllib.quote(name)) + "&start=" +
                   urllib.quote(start))
   delete = self.request.get("delete")
   if delete:
     writer = RecordIOWriter(delete)
     writer.delete()
     self.redirect("/recordio/")
Beispiel #2
0
 def post(self):
     name = self.request.get("name")
     compressed = not not self.request.get("compressed")
     key = self.request.get("key", None)
     value = self.request.get("value", None)
     if name:
         writer = RecordIOWriter(name)
         if key == None and value == None:
             writer.create(compressed)
         elif value == None:
             writer.remove(key)
             writer.commit_sync()
         else:
             writer.insert(str(key), eval(value))
             writer.commit_sync()
         start = None
         if key:
             start = str(key)
         self.redirect("?name=" + str(urllib.quote(name)) + "&start=" +
                       urllib.quote(start))
     delete = self.request.get("delete")
     if delete:
         writer = RecordIOWriter(delete)
         writer.delete()
         self.redirect("/recordio/")
Beispiel #3
0
 def writeOneShard(self, compressed):
   updater = RecordIOWriter("test")
   updater.create(compressed=compressed)
   updater.insert("1", "foo")
   updater.insert("2", "bar")
   updater.commit_sync()
   updater = RecordIOWriter("test")
   updater.insert("3", "win")
   updater.remove("2")
   updater.commit_sync()
   recordio = RecordIOShard.all().get()
   self.assertEqual(recordio.compressed, compressed)
   self.assertEqual([x for x in recordio], [("1", STRING + "foo"), ("3", STRING + "win")])