Example #1
0
 def execute(self, request):
     '''Execute a new ``request``.
     '''
     handle = None
     if request:
         request[0] = command = force_native_str(request[0]).lower()
         info = COMMANDS_INFO.get(command)
         if info:
             handle = getattr(self.store, info.method_name)
         #
         if self.channels or self.patterns:
             if command not in self.store.SUBSCRIBE_COMMANDS:
                 return self.reply_error(self.store.PUBSUB_ONLY)
         if self.blocked:
             return self.reply_error('Blocked client cannot request')
         if self.transaction is not None and command not in 'exec':
             self.transaction.append((handle, request))
             return self._transport.write(self.store.QUEUED)
     self._execute_command(handle, request)
Example #2
0
 def execute(self, request):
     '''Execute a new ``request``.
     '''
     handle = None
     if request:
         request[0] = command = force_native_str(request[0]).lower()
         info = COMMANDS_INFO.get(command)
         if info:
             handle = getattr(self.store, info.method_name)
         #
         if self.channels or self.patterns:
             if command not in self.store.SUBSCRIBE_COMMANDS:
                 return self.reply_error(self.store.PUBSUB_ONLY)
         if self.blocked:
             return self.reply_error('Blocked client cannot request')
         if self.transaction is not None and command not in 'exec':
             self.transaction.append((handle, request))
             return self._transport.write(self.store.QUEUED)
     self._execute_command(handle, request)
Example #3
0
 def test_force_native_str(self):
     self.assertEqual(force_native_str('ciao'), 'ciao')
     self.assertEqual(force_native_str(b'ciao'), 'ciao')
     self.assertEqual(force_native_str(1), '1')
     self.assertEqual(force_native_str((1, 'b')), str((1, 'b')))
Example #4
0
 def test_force_native_str(self):
     self.assertEqual(force_native_str("ciao"), "ciao")
     self.assertEqual(force_native_str(b"ciao"), "ciao")
     self.assertEqual(force_native_str(1), "1")
     self.assertEqual(force_native_str((1, "b")), str((1, "b")))
Example #5
0
 def test_force_native_str(self):
     self.assertEqual(force_native_str('ciao'), 'ciao')
     self.assertEqual(force_native_str(b'ciao'), 'ciao')
     self.assertEqual(force_native_str(1), '1')
     self.assertEqual(force_native_str((1, 'b')), str((1, 'b')))