def view(self, *args, **kwargs): ''' get system log detail format: ['2013-02-07T16:04:24.352987+08:00 localhost rsyslogd: [origin software="rsyslogd" swVersion="7.2.4" x-pid="1857" x-info="http://www.rsyslog.com"] start\n', "2013-02-07T16:04:24.352351+08:00 localhost rsyslogd-2184: action '*' treated as ':omusrmsg:*' - please change syntax, '*' will not be supported in the future [try http://www.rsyslog.com/e/2184 ]\n", '2013-02-07T16:04:24.355371+08:00 localhost kernel: [ 0.000000] Initializing cgroup subsys cpuset\n', ...] ''' import libs.login if False == libs.login.cklogin(): raise _.HTTPRedirect('/') import ml_w_view as wvi import json import libs.tools if "logtype" in kwargs: res = wvi.refresh(user = self.getUser(), logtype = kwargs["logtype"]) _.response.headers["Content-Type"] = "application/json" return json.dumps(res) else: res = (False, ["System Error"]) return json.dumps(res)
def test_view_g01(self): """ view_g01 """ e = ml_w_view.refresh(None, threading.RLock()) self.assertTrue(e[0], e[1])