List Info

Thread: Schema-by-interface options




Schema-by-interface options
user name
2006-09-20 22:18:23
i had a need for this and a bit more functionality for a
client today and  
whipped up a ContentFlavors product. whats it do .. readme
excerpt..

What are flavors?
-----------------

  are bits of behavior and schema that we can add to content
at runtime.
  we can gain additional access to icons, actions, views,
adapters,
  and at schemas via adding a flavor to a piece of content.

  A flavor is composed of a number of optional parts,
typically an
  archetypes schemas to compose, marker interfaces to apply,
some ui
  metadata and an icon. see the readme, zcml section, for
complete  
definition.

http://sv
n.objectrealms.net/view/public/Products.ContentFlavors/trunk
/readme.txt?rev=1670&view=auto

repo url

https://svn.objectrealms.net/svn/public/Pr
oducts.ContentFlavors/trunk/

cheers,

kapil

On Wed, 20 Sep 2006 11:15:51 -0700, Martin Aspeli
<optiludegmx.net> wrote:

> Daniel Nouri wrote:
>> George Lee wrote:
>>> Daniel Nouri <daniel.nouri...>
writes:
>>>
>>>> Let's wait two more days to see if someone
else comes up with good
>>>> arguments against this.  Otherwise I'd say
it goes in.
>>> Hi -- so is this going in? =)
>>
>> Sure
>
> I've got a first pass at it, which mostly works. I'm
having trouble with
> getting the tests to play nice (AT tests aren't very
CA-aware, and I'm
> doing something wrong with tear-down, I think), but
whit already did
> most of the heavy lifting (and me the rampant copying),
so hopefully I
> just need to revisit after some sleep.
>
> My time's been cut short this week, but I'll try to
pick it up again at
> the weekend. I'll check in what I have now, with
failing tests.
>
> Martin
>
>
>
------------------------------------------------------------
-------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get
the chance to share  
> your
> opinions on IT & business topics through brief
surveys -- and earn cash
> http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Archetypes-devel mailing list
> Archetypes-devellists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/archet
ypes-devel



------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief surveys
-- and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Archetypes-devel mailing list
Archetypes-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/archet
ypes-devel
Schema-by-interface options
user name
2006-09-20 22:46:40
Kapil Thangavelu wrote:
> i had a need for this and a bit more functionality for
a client today 
> and whipped up a ContentFlavors product. whats it do ..
readme excerpt..
> 
> What are flavors?
> -----------------
> 
>  are bits of behavior and schema that we can add to
content at runtime.
>  we can gain additional access to icons, actions,
views, adapters,
>  and at schemas via adding a flavor to a piece of
content.
> 
>  A flavor is composed of a number of optional parts,
typically an
>  archetypes schemas to compose, marker interfaces to
apply, some ui
>  metadata and an icon. see the readme, zcml section,
for complete 
> definition.

This is quite interesting - need to look into it a bit more,
but sounds 
like a good match for what we're trying to do here. Having
a more 
fully-featured solution that can be an optional dependency
for things 
that need it is quite attractive.

A couple of random concerns/questions:

  - Does this have any mechanism for adding things to
schemas more 
globally, i.e. install a 'tag' field on all ITaggable or
an 
'annoyingCorporateContentIdNumber' on all AT objects?

  - Do you support extended schemas per-class or
per-instance?

  - Is it possible for a particular flavor to be installed
in one Plone 
site but not in another (in the same Zope instance)

  - Do you cache schemas in a _v_ attribute only? This may
have a 
performance impact; the approach on my branch and in b-org
uses a cache 
(keyed by __class__) that needs to be explicitly invalidated
(via an 
event). Maybe I'm missing something though.

  - Why is the FlavorUtility not registered as a utility?

  - What is the minimal extension to AT you could imagine
that would 
allow Flavors to work without requiring a mix-in (thus being
general and 
backwards applicable), but without making AT depend on
ContentFlavors?

    For example, I could imagine that we could go back to
Whit's 
original schema-by-iface implementation which only adapts
self to 
ISchema (I have some issues with his implementation, though
I think it 
can be made nicer with a custom adapter factory method), and
then let 
ContentFlavors handle the actual use cases for extension.

   The main problem is that, as you've discovered, you need
to 
re-generate methods ClassGen style when things change (and
at least 
once) at run-time, since ClassGen is only run once and is
only aware of 
the 'schema' class-attribute. This has performance
implications, if 
nothing else. I'd rather that functionality was in AT.

   You probably have a better idea than me about exactly how
that'd 
work, though.

  - s/Flavors/Flavours/g (may not win that one...)

Cheers,
Martin

------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief surveys
-- and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Archetypes-devel mailing list
Archetypes-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/archet
ypes-devel
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )