Commits

Simon Cross committed 430c0ea

Add bucket.disable_search() and fix imports.

Comments (0)

Files changed (1)

 
 """
 
-import random
-import base64
 import urllib
-import re
 import json
-import codecs
 from twisted.internet import defer
-from twisted.internet import reactor
-from zope.interface import implements
-from twisted.web import client
-from twisted.web.http import PotentialDataLoss
-from twisted.web.http_headers import Headers
-from twisted.web.iweb import IBodyProducer
-from twisted.internet.protocol import Protocol
-from twisted.web._newclient import ResponseDone
-from StringIO import StringIO
 
-import riak_object, util
+from txriak import riak_object, util
+
 
 class RiakBucket(object):
     """
         defer.returnValue(True)
 
     @defer.inlineCallbacks
+    def disable_search(self):
+        precommit_hooks = yield self.get_property("precommit") or []
+
+        if self.SEARCH_PRECOMMIT_HOOK in precommit_hooks:
+            precommit_hooks.remove(self.SEARCH_PRECOMMIT_HOOK)
+            self.set_properties({"precommit": precommit_hooks})
+
+        defer.returnValue(True)
+
+    @defer.inlineCallbacks
     def set_properties(self, props):
         """
         Set multiple bucket properties in one call. This should only be
         for key in keys:
             obj = yield self.get(key)
             yield obj.delete()
-
-        return