git » pyweave » commit ef26a24

Add sort parameter to the delete command

author Alberto Bertogli
2009-09-28 23:04:48 UTC
committer Alberto Bertogli
2009-09-28 23:04:48 UTC
parent 1e423a28014082d5845ab1de4226d711e76a82ea

Add sort parameter to the delete command

The sort is useful when combined with limit and offset, to remove, for
example, the last 100 entries.

Thanks to Toby Elliott for the clarification.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

pyweave.cgi +5 -6

diff --git a/pyweave.cgi b/pyweave.cgi
index daa3d1a..eb021aa 100755
--- a/pyweave.cgi
+++ b/pyweave.cgi
@@ -262,13 +262,11 @@ class Collection (object):
 
 		return ws
 
-	def delete_wbos(self, ids, parent_id, older, newer, limit, offset):
-		# XXX: the spec says there's a sort parameter, but that makes
-		# no sense since we're going to delete them. Maybe there's
-		# something else going on.
+	def delete_wbos(self, ids, parent_id, older, newer, limit, offset,
+			sort):
 		wids = self.list_wbos(ids, parent_id = parent_id,
 				older = older, newer = newer, limit = limit,
-				offset = offset)
+				offset = offset, sort = sort)
 		for wid in wids:
 			w = self.wbos[wid]
 			ppath = self.basepath + '/' + payload_path(wid)
@@ -490,9 +488,10 @@ def handle_cgi():
 			newer = fromform(form, "newer", float)
 			limit = fromform(form, "limit", int)
 			offset = fromform(form, "offset", int)
+			sort = fromform(form, "sort")
 
 			wl = c.delete_wbos(ids, parentid, older, newer, limit,
-					offset)
+					offset, sort)
 			output(time.time())