Limitations in the use of schemaextender

3 messages Options
Embed this post
Permalink
Giovanni Toffoli () Limitations in the use of schemaextender
Reply Threaded More More options
Print post
Permalink
Hi all,

recently I started using schemaextender in developing product B, which tries
to reuse as much as possible of product A.
It seems to work well to a certain extent.
More precisely, the instances of the extended classes seems to be ok.

But, in product A, I had developed some generic functions for automatically
generating search forms for each content type, and also for sets of content
types derived from the same (possibly abstract) class.
Now, it seems that said search-related functions aren't extended as
(naively) I had expected.
In fact, the generic search-related functions don't use the instance methods
to enumerate the schema fields and extract their attributes; rather, since
no instance is available, they get the schema from a class variable whose
value doesn't seem to have been extended.

I arrived to the following conclusions
- it was a design choice of schemaextender not to alter the original schema
in the class variable
- it is for a similar problem that search macros (like view and edit macros)
never haven't been systematically developed in Archetypes
- probably newer frameworks, such as Dexterity, are the real solution
- for now, I have to stick to subclassing, and give schemaextender up.
Are these conclusions correct ?

Thank you in very much advance, Giovanni



_______________________________________________
Product-Developers mailing list
[hidden email]
http://lists.plone.org/mailman/listinfo/product-developers
Martin Aspeli () Re: Limitations in the use of schemaextender
Reply Threaded More More options
Print post
Permalink
Giovanni Toffoli wrote:

> I arrived to the following conclusions
> - it was a design choice of schemaextender not to alter the original schema
> in the class variable

Indeed. Doing that would be very bad.

> - it is for a similar problem that search macros (like view and edit macros)
> never haven't been systematically developed in Archetypes

That's probably true. I don't think they're used by many people,
unfortunately.

> - probably newer frameworks, such as Dexterity, are the real solution

Perhaps. :) I'm not quite sure I understand what you're trying to achieve.

Martin

--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book


_______________________________________________
Product-Developers mailing list
[hidden email]
http://lists.plone.org/mailman/listinfo/product-developers
Giovanni Toffoli () Re: Re: Limitations in the use of schemaextender
Reply Threaded More More options
Print post
Permalink
Thank you Martin!

I think that the keyword is introspection.

> Perhaps. :) I'm not quite sure I understand what you're trying to achieve.


Well, I need to recap my experience.
Starting with UML and AGX, I've developed a complex data model, which is
implemented with Archetypes.
It is a tree of classes and subclasses; the leaves of the tree correspond to
content types (portal types).
The rationale of this is to share many fields and methods among subsets of
types.
Among other things, I've developed a generic search functionality able to
generate dynamically search forms and results reports for each content type,
and also for the subset of content types belonging to each subtree in the
model.
Each search form includes a search widget for each indexed field.
I've developed this and other generic functions using a kind of
introspection; that is
- analyzing programmatically the class hierarchy
- analyzing the ftis in portal_types
- trying to find relationships among classes and portal types
- identifying the fields that can be used in the search criteria.
It seems that Archetypes doesn't provide interfaces supporting such an
endeavour. However, in some way I managed to fulfil my goal.

When, in a new project, I tried to extend some schemas using schemaextender,
instead of using further subclassing, I better realized the limitation of my
approach.
I would say that the limitation is in the framework, Archetypes, that
supports introspection at the instance level but not at the type level, if I
am true.
I also wander if new frameworks for data modeling in Zope/Plone, such as
Dexterity, overcome said limitation.

Best regards, Giovanni


----- Original Message -----
From: "Martin Aspeli" <[hidden email]>
To: <[hidden email]>
Sent: Saturday, September 12, 2009 6:07 PM
Subject: [Product-Developers] Re: Limitations in the use of schemaextender

(...)



_______________________________________________
Product-Developers mailing list
[hidden email]
http://lists.plone.org/mailman/listinfo/product-developers