From 5da83f6f6d6f598a4e55eda33f40445995f49b83 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 23 May 2015 15:11:18 +0530 Subject: [PATCH] don't return empty string for undefined values, handle in context browser --- pandora/item/views.py | 4 ++-- static/js/browser.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pandora/item/views.py b/pandora/item/views.py index 6e2dece2..62d33d22 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -234,7 +234,7 @@ def find(request, data): elif p == 'timesaccessed': r[p] = m.sort.timesaccessed else: - r[p] = m.json.get(p, '') + r[p] = m.json.get(p) if 'clip_qs' in query: r['clips'] = get_clips(query['clip_qs'].filter(item=m)) return r @@ -243,7 +243,7 @@ def find(request, data): if m: m = json.loads(m, object_hook=ox.django.fields.from_json) for p in _p: - r[p] = m.get(p, '') + r[p] = m.get(p) if 'clip_qs' in query: r['clips'] = get_clips(query['clip_qs'].filter(item__public_id=m['id'])) return r diff --git a/static/js/browser.js b/static/js/browser.js index 9a29c90a..f36fed67 100644 --- a/static/js/browser.js +++ b/static/js/browser.js @@ -88,7 +88,9 @@ pandora.ui.browser = function() { } else { // fixme: this is duplicated many times format = pandora.getSortKeyData(sortKey).format; - if (format) { + if (Ox.isUndefined(data[sortKey]) || Ox.isNull(data[sortKey])) { + info = ''; + } else if (format) { info = ( /^color/.test(format.type.toLowerCase()) ? Ox.Theme : Ox )['format' + Ox.toTitleCase(format.type)].apply(