Commits

Reid Draper committed 6139714

remove prints, fix bug where the CLRF was returned to the client

Comments (0)

Files changed (2)

         
     @swirl.asynchronous    
     def _work(self):
-        print 'work, yeah'
         self._waiting = True
         try:
             cmd, callback = self._queue.popleft()
         except IndexError:
-            print 'no more to pop'
             self._waiting = False
             return
             
-        yield lambda cb : self.stream.write(cmd, cb)
-        response = yield lambda cb : self.stream.read_until(self.DELIMITER, cb)
-        print 'the response is %s' % response
+        yield lambda cb: self.stream.write(cmd, cb)
+        response = yield lambda cb: self.stream.read_until(self.DELIMITER, cb)
         
         if response[0] == '$':
-            print 'the response had a $'
             num_bytes = int( response[1:] )
             if num_bytes < 1:
                 callback(None)
                 # ioloop.IOLoop.instance().add_callback(_work)
                 self._work()
                 return
-            print 'the number of bytes was %d' % num_bytes
             response = yield lambda cb : self.stream.read_bytes(num_bytes + self.DELBYTES, cb)
-            print 'the new response is %s' % response
-            callback(response)
+            callback(response[:-2])
             self._waiting = False
             # ioloop.IOLoop.instance().add_callback(_work)
             self._work()
             return
             
         elif response[0] == '+':
-            print 'confirmation'
             callback(True)
             self._waiting = False
             # ioloop.IOLoop.instance().add_callback(_work)
         
     def set(self, key, value, callback = None):
         cmd = '%s %s %s\r\n%s\r\n' % ('SET', key, len(value), value)
-        self._queue.append( (cmd, callback) )
-        print 'added to the queue'
+        self._queue.append((cmd, callback))
         if not self._waiting:
             self._work()
         
     def get(self, key, callback = None):
-        print 'in the redis get method'
         cmd = 'GET %s\r\n' % key
-        self._queue.append( (cmd, callback) )
-        print 'added to the queue'
+        self._queue.append((cmd, callback))
         if not self._waiting:
             self._work()
-        
+        
 class GetHandler(tornado.web.RequestHandler):
     @swirl.asynchronous
     def get(self):
-        print 'just called the GET method'
         value = (yield lambda cb : r.get('foo', cb)) or 'Nope'
         self.write(value)
 
 class SetHandler(tornado.web.RequestHandler):
     @swirl.asynchronous
     def get(self):
-        print 'just called the SET method'
         value = yield lambda cb: r.set('foo', 'bar', cb)
         self.write(str(value))
 
 
 
 if __name__ == "__main__":
-    main()
+    main()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.