fix datatable source list; add generic IOptions adapter
This commit is contained in:
parent
0915d04e30
commit
4a18c42283
3 changed files with 17 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2016 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -18,8 +18,6 @@
|
|||
|
||||
"""
|
||||
Adapters and others classes for analyzing resources.
|
||||
|
||||
$Id$
|
||||
"""
|
||||
|
||||
import os
|
||||
|
@ -33,6 +31,7 @@ from cybertools.meta.config import GlobalOptions as BaseGlobalOptions
|
|||
from cybertools.meta.interfaces import IOptions
|
||||
from cybertools.meta.namespace import Executor, ExecutionError
|
||||
from cybertools.typology.interfaces import IType
|
||||
from loops.common import AdapterBase
|
||||
from loops.interfaces import ILoops, ILoopsObject, ITypeConcept, IPredicate
|
||||
#from loops.query import IQueryConcept
|
||||
from loops.expert.concept import IQueryConcept
|
||||
|
@ -73,7 +72,7 @@ class LoopsOptions(Options):
|
|||
|
||||
def parseContextOptions(self):
|
||||
def result():
|
||||
options = getattr(self.context, 'options', [])
|
||||
options = getattr(self.context, 'options', None) or []
|
||||
for opt in options:
|
||||
parts = opt.split(':', 1)
|
||||
key = parts[0].strip()
|
||||
|
@ -128,6 +127,11 @@ class PredicateOptions(LoopsOptions):
|
|||
adapts(IPredicate)
|
||||
|
||||
|
||||
class ConceptAdapterOptions(LoopsOptions):
|
||||
|
||||
adapts(AdapterBase)
|
||||
|
||||
|
||||
class DummyOptions(Options):
|
||||
|
||||
def __getitem__(self, key):
|
||||
|
|
|
@ -27,6 +27,11 @@
|
|||
<allow interface="cybertools.meta.interfaces.IOptions" />
|
||||
</zope:class>
|
||||
|
||||
<zope:adapter factory="loops.config.base.ConceptAdapterOptions" trusted="True" />
|
||||
<zope:class class="loops.config.base.ConceptAdapterOptions">
|
||||
<allow interface="cybertools.meta.interfaces.IOptions" />
|
||||
</zope:class>
|
||||
|
||||
<!-- backward compatibility -->
|
||||
<zope:adapter factory="loops.config.base.QueryOptions" trusted="True"
|
||||
for="loops.query.IQueryConcept" />
|
||||
|
|
3
table.py
3
table.py
|
@ -142,5 +142,8 @@ class DataTableSourceList(object):
|
|||
for k, v in self.context.data.items()]
|
||||
return iter(sorted(items, key=lambda x: x[1]))
|
||||
|
||||
def __contains__(self, value):
|
||||
return value in self.context.data
|
||||
|
||||
def __len__(self):
|
||||
return len(self.context.data)
|
||||
|
|
Loading…
Add table
Reference in a new issue