diff --git a/glances/amps/glances_amp.py b/glances/amps/glances_amp.py index 3d5e16a3..60d2cbec 100644 --- a/glances/amps/glances_amp.py +++ b/glances/amps/glances_amp.py @@ -130,6 +130,14 @@ class GlancesAmp(object): """Return refresh time in seconds for the current application monitoring process.""" return self.get('refresh') + def one_line(self): + """Return True|False if the AMP shoukd be displayed in oneline (one_lineline=true|false).""" + ret = self.get('one_line') + if ret is None: + return False + else: + return ret.lower().startswith('true') + def time_until_refresh(self): """Return time in seconds until refresh.""" return self.timer.get() diff --git a/glances/amps/glances_nginx.py b/glances/amps/glances_nginx.py index c9cdcdc0..86f02c75 100644 --- a/glances/amps/glances_nginx.py +++ b/glances/amps/glances_nginx.py @@ -81,7 +81,7 @@ class Amp(GlancesAmp): req = requests.get(self.get('status_url')) if req.ok: # u'Active connections: 1 \nserver accepts handled requests\n 1 1 1 \nReading: 0 Writing: 1 Waiting: 0 \n' - if self.get('one_line') is not None and self.get('one_line').lower() == 'true': + if self.one_line(): self.set_result(req.text.replace('\n', '')) else: self.set_result(req.text)