Re: Schema provider/CA lookup status

whit <[email protected]> Tue, 11 Jul 2006 01:12:57 -0400
Newsgroups gmane.comp.web.zope.plone.archetypes.devel
Message-ID <[email protected]>
dear optilutefisk,

please refer to thread

http://article.gmane.org/gmane.comp.web.zope.plone.archetypes.devel/5947/match=whitmo+schema+by+iface

> Hi guys,
> 
> I know Whit worked on this a while ago, but I'm unsure what state the 
> code is in. Basically, I have a use case now where I want to be able to 
> supply (most of) the schema to a content object with a (local) utility 
> so that third party products can plug in a schema without having to 
> re-invent the rest of my infrastructure.
> 

trac indicates branch has not changed for 3 month(time of last posting)


> How far away a goal is this? 

you have to write an adapter. side-effects are not fully explored.

With the current adapter all the AT tests pass iirc(at least no failures 
related to the changes to my knowledge). the schema by interface goal is 
relatively done(trivial). so iirc is schemata return(giving a point for 
inject behavior into the composition of a schema subset).

hypothetically, any factory returning a schema properly wrapped should 
work.  The current implementation is an extreme example(I hot swap the 
classes and wrap the result).  A cleaner way would be using the 
zope.interface.implementer and zope.component.adapter decorators and 
making the factory a function that retrieves, wraps and returns a schema.

As I recall, Whit made AT always use the
> Schema() method to access the schema, which means that I could override 
> that and make it do the utility lookup.

this is the default behavior of the AT API.

I'm simply making BaseObject.Schema() use ISchema to return a schema:

http://dev.plone.org/archetypes/browser/Archetypes/branches/whitmo-schema-by-iface/Schema

now you would just register a new factory with ISchema that returns a 
schema from the utility. or the module. or wherever. read link. read 
code. should be clear in the relatively few lines of python.


> However, I don't understand whether the changes he made were 
> fundamental, or basically just bugfixes (isn't Schema() the 
> recommended/proper way always anyway?). I need to be able to use this 
> with Plone 2.5, and I'm willing to help test and fix this, if I know 
> which direction to go in.

get some sleep then read up.

If you want to discuss further development, I'm willing to talk about 
anything that builds on the previous thread here. If you have questions 
about the previous thread, email me directly or find me on irc.

-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