Пример #1
0
 def onMessage(self, message):
     if (message.body is None):
         return
     sender = xmppim.JID(message.getAttribute("from"))
     req    = parser.parse_sql_(unicode(message.body))
     debug  = {"request": unicode(message.body)}
     resp   = xmppim.Message(recipient = sender).toElement()
     cc     = self.mkcc(resp, debug)
     if (req in [{}, None]):
         logger.debug("message [%s] - 400" % message.body)
         cc(400, {"reason": "parse error"})
     else:
         logger.debug("message [%s] %s - 200" % (message.getAttribute("from"), message.body))
         self.handle_request(req, sender, cc)
Пример #2
0
def test_parse_sql__never_fails():
    eq_({}, parser.parse_sql_("foobar"))
Пример #3
0
def test_parse_sql__never_fails():
    eq_({}, parser.parse_sql_("foobar"))