work in progress: new data table concept type; a data table associates one or more values with a key
This commit is contained in:
parent
a7330d47bc
commit
90d1c88d2c
1 changed files with 27 additions and 0 deletions
27
README.txt
27
README.txt
|
@ -23,6 +23,11 @@ with lower-level aspects like type or state management.
|
||||||
>>> from zope.publisher.browser import TestRequest
|
>>> from zope.publisher.browser import TestRequest
|
||||||
>>> from zope.traversing.api import getName
|
>>> from zope.traversing.api import getName
|
||||||
|
|
||||||
|
Let's also import some common stuff needed later.
|
||||||
|
|
||||||
|
>>> from loops.common import adapted
|
||||||
|
>>> from loops.setup import addAndConfigureObject
|
||||||
|
|
||||||
|
|
||||||
Concepts and Relations
|
Concepts and Relations
|
||||||
======================
|
======================
|
||||||
|
@ -870,6 +875,28 @@ informations about all parents of an object.
|
||||||
Type 2
|
Type 2
|
||||||
|
|
||||||
|
|
||||||
|
Tables
|
||||||
|
======
|
||||||
|
|
||||||
|
>>> from loops.table import IDataTable, DataTable
|
||||||
|
>>> component.provideAdapter(DataTable)
|
||||||
|
|
||||||
|
Let's create the data table concept type and one example, a table that
|
||||||
|
relates ISO country codes with the full name of the country.
|
||||||
|
|
||||||
|
>>> dtType = addAndConfigureObject(concepts, Concept, 'datatable',
|
||||||
|
... title='Data Table', conceptType=concepts['type'],
|
||||||
|
... typeInterface=IDataTable)
|
||||||
|
>>> countries = adapted(addAndConfigureObject(concepts, Concept, 'countries',
|
||||||
|
... title='Countries', conceptType=concepts['datatable']))
|
||||||
|
|
||||||
|
>>> countries.data['de'] = ['Germany']
|
||||||
|
>>> countries.data['at'] = ['Austria']
|
||||||
|
|
||||||
|
>>> sorted(adapted(concepts['countries']).data.items())
|
||||||
|
[('at', ['Austria']), ('de', ['Germany'])]
|
||||||
|
|
||||||
|
|
||||||
Caching
|
Caching
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue