def handle_get(self, api, command): key = command.get("key") if key is None: return self.reply(command, success=False) conversation = self.app_worker.conversation_for_api(api) value = jsbox_config_value(conversation.config, key) return self.reply(command, value=value, success=True)
def get_jsbox_js_config(self, conv): try: return jsbox_js_config(conv.config) except Exception: log.err("Bad jsbox js config: %s" % (jsbox_config_value(conv.config, 'config'), )) return
def get_jsbox_js_config(self, conv): try: return jsbox_js_config(conv.config) except Exception: log.err( "Bad jsbox js config: %s" % (jsbox_config_value(conv.config, 'config'),)) return
def test_jsbox_config_value(self): config = { 'jsbox_app_config': { 'foo': { 'key': 'foo', 'value': 'bar' } } } self.assertEqual(utils.jsbox_config_value(config, 'foo'), 'bar')
def test_jsbox_config_value(self): config = {'jsbox_app_config': {'foo': {'key': 'foo', 'value': 'bar'}}} self.assertEqual(utils.jsbox_config_value(config, 'foo'), 'bar')
def test_jsbox_config_value_no_config(self): self.assertEqual(utils.jsbox_config_value({}, 'foo'), None)
def test_jsbox_config_value_no_value(self): config = {'jsbox_app_config': {}} self.assertEqual(utils.jsbox_config_value(config, 'foo'), None)
def test_jsbox_config_value_no_value(self): config = { 'jsbox_app_config': {} } self.assertEqual(utils.jsbox_config_value(config, 'foo'), None)