Ignore:
Timestamp:
Oct 9, 2007, 11:21:39 PM (17 years ago)
Author:
ecprice
Message:

don't display uptime, cputime when machine is off.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/templates/main.py

    r166 r167  
    700700        main_status = dict(name=machine.name,
    701701                           memory=str(machine.memory))
     702        uptime=None
     703        cputime=None
    702704    else:
    703705        main_status = dict(status[1:])
    704     start_time = float(main_status.get('start_time', 0))
    705     uptime = datetime.timedelta(seconds=int(time.time()-start_time))
    706     cpu_time_float = float(main_status.get('cpu_time', 0))
    707     cputime = datetime.timedelta(seconds=int(cpu_time_float))
     706        start_time = float(main_status.get('start_time', 0))
     707        uptime = datetime.timedelta(seconds=int(time.time()-start_time))
     708        cpu_time_float = float(main_status.get('cpu_time', 0))
     709        cputime = datetime.timedelta(seconds=int(cpu_time_float))
    708710    display_fields = """name uptime memory state cpu_weight on_reboot
    709711     on_poweroff on_crash on_xend_start on_xend_stop bootloader""".split()
     
    743745    main_status['memory'] += ' MB'
    744746    for field, disp in display_fields:
    745         if field in ('uptime', 'cputime'):
     747        if field in ('uptime', 'cputime') and locals()[field] is not None:
    746748            fields.append((disp, locals()[field]))
    747749        elif field in machine_info:
Note: See TracChangeset for help on using the changeset viewer.