don't return empty string for undefined values, handle in context browser

This commit is contained in:
j 2015-05-23 15:11:18 +05:30
parent 0504eaf227
commit 5da83f6f6d
2 changed files with 5 additions and 3 deletions

View file

@ -234,7 +234,7 @@ def find(request, data):
elif p == 'timesaccessed': elif p == 'timesaccessed':
r[p] = m.sort.timesaccessed r[p] = m.sort.timesaccessed
else: else:
r[p] = m.json.get(p, '') r[p] = m.json.get(p)
if 'clip_qs' in query: if 'clip_qs' in query:
r['clips'] = get_clips(query['clip_qs'].filter(item=m)) r['clips'] = get_clips(query['clip_qs'].filter(item=m))
return r return r
@ -243,7 +243,7 @@ def find(request, data):
if m: if m:
m = json.loads(m, object_hook=ox.django.fields.from_json) m = json.loads(m, object_hook=ox.django.fields.from_json)
for p in _p: for p in _p:
r[p] = m.get(p, '') r[p] = m.get(p)
if 'clip_qs' in query: if 'clip_qs' in query:
r['clips'] = get_clips(query['clip_qs'].filter(item__public_id=m['id'])) r['clips'] = get_clips(query['clip_qs'].filter(item__public_id=m['id']))
return r return r

View file

@ -88,7 +88,9 @@ pandora.ui.browser = function() {
} else { } else {
// fixme: this is duplicated many times // fixme: this is duplicated many times
format = pandora.getSortKeyData(sortKey).format; format = pandora.getSortKeyData(sortKey).format;
if (format) { if (Ox.isUndefined(data[sortKey]) || Ox.isNull(data[sortKey])) {
info = '';
} else if (format) {
info = ( info = (
/^color/.test(format.type.toLowerCase()) ? Ox.Theme : Ox /^color/.test(format.type.toLowerCase()) ? Ox.Theme : Ox
)['format' + Ox.toTitleCase(format.type)].apply( )['format' + Ox.toTitleCase(format.type)].apply(