diff options
author | Sol Jerome <solj@ices.utexas.edu> | 2009-11-12 18:01:50 +0000 |
---|---|---|
committer | Sol Jerome <solj@ices.utexas.edu> | 2009-11-12 18:01:50 +0000 |
commit | 6028fc0ee909c781633cef620d475ffedb482aca (patch) | |
tree | d17f0c1dc025b0195acbc90be38d7ecf70d8934c /src/lib/Server/Reports | |
parent | 5a895a834abda530ce98620c0cb7e152f2b5781d (diff) | |
download | bcfg2-6028fc0ee909c781633cef620d475ffedb482aca.tar.gz bcfg2-6028fc0ee909c781633cef620d475ffedb482aca.tar.bz2 bcfg2-6028fc0ee909c781633cef620d475ffedb482aca.zip |
Reports: Fix traceback in Summary/System views (ticket #793 Reported by Thorsten Lockert)
This commit actually fixes two issues:
* Check for unicode strings
* We were trying to modify an immutable tuple
Signed-off-by: Sol Jerome <solj@ices.utexas.edu>
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5577 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Reports')
-rw-r--r-- | src/lib/Server/Reports/reports/views.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/Server/Reports/reports/views.py b/src/lib/Server/Reports/reports/views.py index 03a97e523..b9fa371ef 100644 --- a/src/lib/Server/Reports/reports/views.py +++ b/src/lib/Server/Reports/reports/views.py @@ -303,9 +303,11 @@ def prepare_client_lists(request, timestamp = 'now'): cursor.execute("select client_id, MAX(timestamp) as timestamp from reports_interaction GROUP BY client_id") results = cursor.fetchall() for x in results: - if type(x[1]) == type(""): - x[1] = util.typecast_timestamp(x[1]) - stale_all_client_list = Client.objects.active(timestamp).filter(id__in=[x[0] for x in results if datetime.now() - x[1] > timedelta(days=1)]) + if type(x[1]) == type("") or type(x[1]) == type(u""): + ts = util.typecast_timestamp(x[1]) + else: + ts = x[1] + stale_all_client_list = Client.objects.active(timestamp).filter(id__in=[x[0] for x in results if datetime.now() - ts > timedelta(days=1)]) else: cursor.execute("select client_id, timestamp, MAX(timestamp) as timestamp from reports_interaction "+ "WHERE timestamp < %s GROUP BY client_id", [timestamp]) |