Re: Schema provider/CA lookup status
whit <[email protected]> Tue, 11 Jul 2006 17:22:21 -0400
| Newsgroups | gmane.comp.web.zope.plone.archetypes.devel |
|---|---|
| Message-ID | <[email protected]> |
to recap the pattern discussion:
ISchema(context) == an object that is a schema
any type of provision or aggregation would happed below this level like
so. here is an example using a utility to hold the schema::
from zope.interface import implementer
from zope.component import adapter, getUtility
from utils import aqwrapper
from interfaces import ISchemaProvider, ISchemataNames
from archetypes.interfaces import ISchema, IBaseContent
from archetypes.schema import Schema
@implementer(ISchema)
@adapter(IBaseContent)
def compose_schema(context):
schema = Schema()
for name in ISchemataNames(context):
rawschema = getUtility(ISchemaProvider, name=name)
schema.append(rawschema)
return aqwrap(schema, context)
Just an idea. No reason that ISchemaProvider couldn't be it's own
registry, but really, do we need a registry registry? Still thinking
about it.
could use events to hook up some behavior for more dynamic
composition(essentially fire a notify while holding a reference). Then
any registered subscriber could check state information and return
various mutators for the schema composition(ben....I'm misappropriating
this idea from you.....)
simplest case is to just make the adapter do the work. if it gets
complex break it into events and more adapters.
-w
--
| david "whit" morriss
|
| contact :: http://public.xdi.org/=whit
"If you don't know where you are,
you don't know anything at all"
Dr. Edgar Spencer, Ph.D., 1995
"I like to write code like
other ppl like to tune their
cars or 10kW hifi equipment..."
Christian Heimes, 2004
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642