From 7e9a68bde1bf5f6f59b778463c9f29cd1c4fedb4 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Wed, 27 Aug 2014 10:53:04 +0200 Subject: [PATCH] allow specification of columns for data table in type object --- browser/form.py | 1 + table.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/browser/form.py b/browser/form.py index 04e3ade..e2c7a37 100755 --- a/browser/form.py +++ b/browser/form.py @@ -438,6 +438,7 @@ class CreateConceptForm(CreateObjectForm): return c ad = ti(c) ad.__is_dummy__ = True + ad.__type__ = adapted(self.typeConcept) return ad @Lazy diff --git a/table.py b/table.py index 0ccca60..d381f34 100644 --- a/table.py +++ b/table.py @@ -73,7 +73,10 @@ class DataTable(AdapterBase): _adapterAttributes = AdapterBase._adapterAttributes + ('columns', 'data') def getColumns(self): - return getattr(self.context, '_columns', ['key', 'value']) + cols = getattr(self.context, '_columns', None) + if not cols: + cols = getattr(baseObject(self.type), '_columns', None) + return cols or ['key', 'value'] def setColumns(self, value): self.context._columns = value columns = property(getColumns, setColumns)