using TTW with standard buildout, round-tripping?

26 views
Skip to first unread message

rik

unread,
Aug 17, 2012, 4:16:35 PM8/17/12
to dexterity-...@googlegroups.com
hi all, i'm a Dexterity (D) newby, still weighing AT and dexterity beginning from UML design work. but D's control panel thru-the-web (TTW) facility sure does get content types out quick!

my question is how to take work done TTW and extend it into more full-featured specs as part of a standard buildout product. i'm using Martin's Plone4 description of the latter, and have the exported type profiles and schema models as the results from TTW work. (i've also heard you need to use GenericSetup exporting of some other specs?)

is there a recommended round trip methodology that let's me do what i can TTW, then get full D functionality via additional specs? i'm unclear how/when the two specs get reconciled.

Martin Aspeli

unread,
Aug 17, 2012, 5:27:11 PM8/17/12
to dexterity-...@googlegroups.com
The easiest way to do this, I think, is to write your additional functionality as behaviours (in Python) and then apply those behaviours to your type.

Alternatively, you can dump the XML from the through-the-web type editor out to a file e.g. model.xml and then use this idiom: http://pypi.python.org/pypi/plone.directives.form#schemata-loaded-from-xml

That gives you a "real" Python interface (which you can e.g. register views for, and which you then reference in the 'schema' field of the FTI of your type) with the schema of your type as dumped out in XML.

Martin

rik

unread,
Aug 18, 2012, 12:44:48 AM8/18/12
to dexterity-...@googlegroups.com

thanks Martin.  i'll be parsing this answer for some time...

On Friday, August 17, 2012 2:27:11 PM UTC-7, Martin Aspeli wrote:
The easiest way to do this, I think, is to write your additional functionality as behaviours (in Python) and then apply those behaviours to your type.


might there be an example of this approach you can point at?
 
Alternatively, you can dump the XML from the through-the-web type editor out to a file e.g. model.xml and then use this idiom: http://pypi.python.org/pypi/plone.directives.form#schemata-loaded-from-xml

That gives you a "real" Python interface (which you can e.g. register views for, and which you then reference in the 'schema' field of the FTI of your type) with the schema of your type as dumped out in XML.


the  plone.directives.form doc mentions a tests/schema.txt file with more details;  where/which tree might this live in?

David Glick

unread,
Aug 25, 2012, 7:05:23 PM8/25/12
to dexterity-...@googlegroups.com
On 8/17/12 9:44 PM, rik wrote:

thanks Martin.  i'll be parsing this answer for some time...
On Friday, August 17, 2012 2:27:11 PM UTC-7, Martin Aspeli wrote:
The easiest way to do this, I think, is to write your additional functionality as behaviours (in Python) and then apply those behaviours to your type.


might there be an example of this approach you can point at?
 
Alternatively, you can dump the XML from the through-the-web type editor out to a file e.g. model.xml and then use this idiom: http://pypi.python.org/pypi/plone.directives.form#schemata-loaded-from-xml

That gives you a "real" Python interface (which you can e.g. register views for, and which you then reference in the 'schema' field of the FTI of your type) with the schema of your type as dumped out in XML.

The problem with this idiom is that once you're loading the schema as a concrete Python interface, you can no longer adjust it TTW. I recently came up with the following combination which worked pretty well:
1. Dump the schema XML to a file and configure it as the model_file in the FTI settings.
2. Create you own class (subclassing dexterity's Item or Container base classes) which implements a marker interface, and configure it as the "klass" in the type's FTI settings.
This way the model can still be edited TTW (any updates will get written to model_source, which is stored in the ZODB and takes precedence over model_file), but instances of the type also provide a concrete interface that you can use to register views and such.




the  plone.directives.form doc mentions a tests/schema.txt file with more details;  where/which tree might this live in?


Martin Aspeli

unread,
Aug 26, 2012, 6:02:01 AM8/26/12
to dexterity-...@googlegroups.com
On 26 August 2012 04:35, David Glick <dgl...@gmail.com> wrote:
On 8/17/12 9:44 PM, rik wrote:

thanks Martin.  i'll be parsing this answer for some time...
On Friday, August 17, 2012 2:27:11 PM UTC-7, Martin Aspeli wrote:
The easiest way to do this, I think, is to write your additional functionality as behaviours (in Python) and then apply those behaviours to your type.


might there be an example of this approach you can point at?
 
Alternatively, you can dump the XML from the through-the-web type editor out to a file e.g. model.xml and then use this idiom: http://pypi.python.org/pypi/plone.directives.form#schemata-loaded-from-xml

That gives you a "real" Python interface (which you can e.g. register views for, and which you then reference in the 'schema' field of the FTI of your type) with the schema of your type as dumped out in XML.

The problem with this idiom is that once you're loading the schema as a concrete Python interface, you can no longer adjust it TTW. I recently came up with the following combination which worked pretty well:
1. Dump the schema XML to a file and configure it as the model_file in the FTI settings.
2. Create you own class (subclassing dexterity's Item or Container base classes) which implements a marker interface, and configure it as the "klass" in the type's FTI settings.
This way the model can still be edited TTW (any updates will get written to model_source, which is stored in the ZODB and takes precedence over model_file), but instances of the type also provide a concrete interface that you can use to register views and such.

Another way to achieve #2 would be to create a simple behaviour that applies a marker interface and register views for that.

I wonder if we should enable this type of thing through the editor, e.g. some kind of "download a zip file" option that sets you up for this type of round-tripping.

Martin

David Glick

unread,
Aug 26, 2012, 7:03:33 PM8/26/12
to dexterity-...@googlegroups.com
Good point.



I wonder if we should enable this type of thing through the editor, e.g. some kind of "download a zip file" option that sets you up for this type of round-tripping.

You must not have used the editor lately -- Steve added a feature over a year ago that lets you download either the GS types info or just the model in a zip file. :)  It could use an improved UI though (currently it is just a couple buttons and I think it should be a separate page with some instructions on what to do next and that also lets you just copy the model XML out of the browser if you want). And it might be more useful for folks if it dumped out a full package so they didn't have to mess with zopeskel.
David

Martin Aspeli

unread,
Aug 27, 2012, 3:18:26 AM8/27/12
to dexterity-...@googlegroups.com
On 27 August 2012 04:33, David Glick <dgl...@gmail.com> wrote:

I wonder if we should enable this type of thing through the editor, e.g. some kind of "download a zip file" option that sets you up for this type of round-tripping.

You must not have used the editor lately -- Steve added a feature over a year ago that lets you download either the GS types info or just the model in a zip file. :)

I didin't actually know about that feature, but I was thinking more about something that let you create the full structure (i.e. a package) to install the profile/model.
 
  It could use an improved UI though (currently it is just a couple buttons and I think it should be a separate page with some instructions on what to do next and that also lets you just copy the model XML out of the browser if you want). And it might be more useful for folks if it dumped out a full package so they didn't have to mess with zopeskel.

indeed, 

rik

unread,
Aug 27, 2012, 1:03:07 PM8/27/12
to dexterity-...@googlegroups.com


On Monday, August 27, 2012 12:18:26 AM UTC-7, Martin Aspeli wrote:


On 27 August 2012 04:33, David Glick <dgl...@gmail.com> wrote:

I wonder if we should enable this type of thing through the editor, e.g. some kind of "download a zip file" option that sets you up for this type of round-tripping.

You must not have used the editor lately -- Steve added a feature over a year ago that lets you download either the GS types info or just the model in a zip file. :)

I didin't actually know about that feature, but I was thinking more about something that let you create the full structure (i.e. a package) to install the profile/model.

this is where i'm entering the conversation:  i've used the export feature to produce both PKG.content/PKG/content/profiles/default/types.xml and multiple .../default/types/SCHEMA.xml files, and now am trying to fill out the rest of the package spec.  it's all the PKG.content/PKG/content/SCHEMA.py files that seem as if they could be generated, too?  then, re-import for re-TTW editting would require at least some # <your code here> conventions for added code (eg, form hints) and probably other things i'm not appreciating? 

the TTW feature i'd most appreciate as i'm hand-rolling my SCHEMA.py files is a way to specify intra-package Relation fields.  shouldn't that be possible, too?

  rik
 
Reply all
Reply to author
Forward
0 new messages