From c941743c9a1310c1b5ef942fa6e6d1ed31a7faa7 Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Fri, 5 Jun 2015 12:30:12 +0100 Subject: bitbake: toaster: ToasterTables add computational fields This patch adds the ability to pass a function to be computed for generating a field value in setting up a column in ToasterTables. Also adding "displayable" property that can be turned False for columns that are present in JSON data but are not part of the UI. Add the "id" column by default for all rows. (Bitbake rev: fb683135348b074412da154585c75865aad1eab0) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/views.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bitbake/lib/toaster/toastergui/views.py') diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 280159ad2c..c25c512a84 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -112,6 +112,9 @@ def objtojson(obj): elif isinstance(d[di], int) and hasattr(obj, "get_%s_display" % di): nd[di] = getattr(obj, "get_%s_display" % di)() return nd + elif isinstance( obj, type(lambda x:x)): + import inspect + return inspect.getsourcelines(obj)[0] else: raise TypeError("Unserializable object %s (%s) of type %s" % ( obj, dir(obj), type(obj))) -- cgit v1.2.3-54-g00ecf