def async_readline(self, line):
     method, result = prompt.python_prompt(line, self.python_prompt_env)
     if method == 'excp':
         self.loginfo_traceback(result)
     elif result != None:
         if __debug__:
             self.async_stderr('%r\n' % (result, ))
         else:
             self.select_trigger(
                 (loginfo.log, ('%r' % (result, ), self.loginfo_info)))
     if self.async_loop_catch != None:
         self.thread_loop_queue((self.sync_stdin, ()))
	def async_readline (self, line):
		method, result = prompt.python_prompt (
			line, self.python_prompt_env
			)
		if method == 'excp':
			self.loginfo_traceback (result)
		elif result != None:
                        if __debug__:
			        self.async_stderr ('%r\n' % (result,))
                        else:
                                self.select_trigger ((loginfo.log, (
                                        '%r' % (result, ), self.loginfo_info
                                        )))
                if self.async_loop_catch != None: 
		        self.thread_loop_queue ((self.sync_stdin, ()))
Beispiel #3
0
def json_inspect(control, http, about, json):
    method, o = prompt.python_prompt(json.setdefault(u"object", u"control"), {
        'control': control,
        'http': http,
        'about': about,
        'json': json
    })
    if (method == 'excp'):
        json[method] = presto.json_encode(o)
    else:
        if type(o) in presto.JSON_TYPES:
            json[method] = presto.json_safe(o, set())
        elif o != __builtins__ and hasattr(o, '__dict__'):
            json[u"properties"] = presto.json_safe(o.__dict__, set())
        json[u"names"] = dir(o)
    return 200
Beispiel #4
0
def json_inspect (control, http, about, json):
        method, o = prompt.python_prompt (json.setdefault(
                u"object", u"control"
                ), {
                        'control': control, 
                        'http': http,
                        'about': about,
                        'json': json
                        })
        if (method == 'excp'):
                json[method] = presto.json_encode (o)
        else:
                if type (o) in presto.JSON_TYPES:
                        json[method] = presto.json_safe (o, set())
                elif o != __builtins__ and hasattr(o, '__dict__'):
                        json[u"properties"] = presto.json_safe (
                                o.__dict__, set()
                                )
                json[u"names"] = dir (o)
        return 200