diff --git a/glances/compat.py b/glances/compat.py index 7d2c4764..1ec05d1a 100644 --- a/glances/compat.py +++ b/glances/compat.py @@ -294,12 +294,13 @@ def key_exist_value_not_none(k, d): return k in d and d[k] is not None -def key_exist_value_not_none_not_v(k, d, v=''): +def key_exist_value_not_none_not_v(k, d, value='', lengh=None): # Return True if: # - key k exists # - d[k] is not None - # - d[k] != v - return k in d and d[k] is not None and d[k] != v + # - d[k] != value + # - if lengh is not None and len(d[k]) >= lengh + return k in d and d[k] is not None and d[k] != value and (lengh is None or len(d[k]) >= lengh) def disable(class_name, var): diff --git a/glances/plugins/glances_processlist.py b/glances/plugins/glances_processlist.py index 42d655fe..fea8732c 100644 --- a/glances/plugins/glances_processlist.py +++ b/glances/plugins/glances_processlist.py @@ -222,7 +222,7 @@ class Plugin(GlancesPlugin): def _get_process_curses_vms(self, p, selected, args): """Return process VMS curses""" - if key_exist_value_not_none_not_v('memory_info', p, ''): + if key_exist_value_not_none_not_v('memory_info', p, '', 1): msg = self.layout_stat['virt'].format(self.auto_unit(p['memory_info'][1], low_precision=False)) ret = self.curse_add_line(msg, optional=True) else: @@ -232,7 +232,7 @@ class Plugin(GlancesPlugin): def _get_process_curses_rss(self, p, selected, args): """Return process RSS curses""" - if key_exist_value_not_none_not_v('memory_info', p, ''): + if key_exist_value_not_none_not_v('memory_info', p, '', 0): msg = self.layout_stat['res'].format(self.auto_unit(p['memory_info'][0], low_precision=False)) ret = self.curse_add_line(msg, optional=True) else: