class Dal(object):
def select(self):
print("call daladapter")
class IStorage(Interface):
def select():
"""call storage"""
class StorageFoo(object):
implements(IStorage)
def select(self):
print("call storage foo")
class StorageBaz(object):
implements(IStorage)
def select(self):
print("call storage baz")
class Database(dict):
def __init__(self):
pass
def __getattr__(self, key):
return self[key]
def __setattr__(self, key, value):
if key[:1] !='_' and key in self:
raise SyntaxError('Object %s exists and cannot be redefined' % key)
dict.__setitem__(self, key, value)
request.registry.registerAdapter([Dal], IStorage, "foo", StorageFoo())
request.registry.registerAdapter([Dal], IStorage, "baz", StorageBaz())