Author: eallen
Date: 2008-08-05 16:52:35 -0400 (Tue, 05 Aug 2008)
New Revision: 2251
Modified:
mgmt/trunk/cumin/python/cumin/util.py
Log:
Added is_active utility function for determining active exchanges to be listed on the
binding forms.
Modified: mgmt/trunk/cumin/python/cumin/util.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/util.py 2008-08-05 20:51:01 UTC (rev 2250)
+++ mgmt/trunk/cumin/python/cumin/util.py 2008-08-05 20:52:35 UTC (rev 2251)
@@ -1,8 +1,9 @@
-import sys
-from time import mktime
from ConfigParser import SafeConfigParser
+from datetime import *
from logging import getLogger
from random import randint
+from time import mktime
+import sys
def short_id():
return "%08x" % randint(0, sys.maxint)
@@ -39,6 +40,15 @@
return host, port
+def is_active(obj):
+ delTime = obj._get_deletionTime()
+ if not delTime:
+ recTime = obj.statsCurr.recTime
+ delta = timedelta(minutes=10)
+ # mirroring logic in widgets/PhaseSwitch.get_sql_constraint
+ if not recTime or (recTime > datetime.now() - delta):
+ return True
+
class Identifiable(object):
def __init__(self, id=None):
self.id = id
Show replies by date