Re: Re: What does Five and Z3 mean for Archetypes?
Sidnei da Silva <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.archetypes.devel |
|---|---|
| Message-ID | <20051121183012.GA3534@cotia> |
On Mon, Nov 21, 2005 at 06:59:28PM +0100, Martijn Faassen wrote: | >Thats great. I'm very interested in hearing what you have to say about | >it. | | Well, I gave a summary just now. :) Are your usecases for marshalling | broader than just export/import? Basically as soon as an 'export' to a | potentially untrusted system happens, that should not have all the | information in the system, you need to start worrying about which | version of which objects you export. How do you solve that problem in Silva? | [making widgets that work both in AT as well as in Z3] | >| Hm, making widgets that work for both sounds like a challenge to me. The | >| alternative route would be to try to keep AT as it is intact, but allow | >| it to search Zope 3-style widgets and work with them too. Not sure | >| whether that's any easier a route to follow, but it would keep the new | >| widget clean of code necessary to work with Archetypes in particular. | > | >It's actually not that hard, but the z3 widgets would have to 'adapt' | >the AT fields to the the interface for a z3 field. | | If I understand you correctly, that would be the other way around; using | AT widgets within Zope 3. Nope, its exactly as I said. Unless you are thinking about using z3 *schemas* with AT there's no way to use Z3 widgets with AT fields unless we adapt the AT fields to Z3 field interface (IField?). | That's not my preferred path -- it'd prefer | extending the library of Zope 3 widgets directly, and allowing AT to use | those. I understand that one of the problems with AT widgets is that | they're rather complicated, and hopefully by this process we can | "refine" them. They are not 'complicated', just 'too flexible' :) The gross of it is in Archetypes/skins/archetypes/widgets/field.pt That file has 3 macros that wrap all the other widget macros. The other nasty part is the 'generator' (generator product), which basically resolves a path to a macro and injects some local variables into the page template namespace. This is more or less what happens: - Get a AT field - Get the field's Widget - Get the widget 'macro' attribute and find a page template by simple traversal - Find a macro matching the 'mode' parameter - Inject 'field', 'widget', 'accessor', 'instance', 'mode' and 'field_name' in the page template local namespace (equivalent to a tal:define) - Return the macro Then basically the forms do a metal:use-macro with what was returned. *I* think this last part should be changed to a simple call, eg: tal:replace="widget", then we can return a Z3 widget and have it be rendered just as easily. | >Should be trivial. Archetypes doesn't expect much from a widget other | >than providing a macro and a method to extract it's own value from the | >request. | | This is good. Of course Zope 3 doesn't have a macro per widget. :) That's why I made the suggestion just above. | >| b) port over Archetypes widgets to Zope 3 style | >| | >| then that would hopefully eventually benefit both Archetypes and Zope 3 | >| equally. I don't know how hard a) is though, and I don't know whether | >| Zope 3 is still missing facilities to accomplish b)... I also imagine | >| that right now many widgets in Archetypes rely on various facilities | >| that are not there or are called differently in Zope 3. | > | >I'm +10 on this. | | Good! I think the next step here would be for someone to try porting an | interesting AT widget to Zope 3. From the problems this person will have | we will learn what changes, if any, Zope 3 needs, and we can recommend a | path to take for the next widget. I think I can contribute to this | process, even though the AT side of things will have to come from | someone else, so I cannot do it alone. What would be a intersting AT widget? I think the 'RichWidget' is a good candidate. It embeds kupu and a upload input box in the same widget. | On another track we could try adjusting Archetypes so it can work with | Zope 3 widgets. This needs an AT expert, and that isn't me. The path of least resistance is removing the requirement that the widget returns a macro imho. -- Sidnei da Silva Enfold Systems, LLC. http://enfoldsystems.com ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit: http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click