-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kevin could provide an opinion / help ?

David Bernard a écrit :
> Context (Proof of Concept):
> ---------------------------
> 
>  * I try to write widgets (simple and composite) without Kid (use
> formencode.htmlgen)
>  * I try to use TurboHtmlPy as Template Engine to render widget
> 
> I create a test controllers available at
> http://dwayneb.free.fr/turbohtmlpy/controllers.py
> 
> (I also rewrite turbogears/widgets/base.py,results available soon, but
> it's not need for the test)
> 
> Results:
> --------
> in the table, poc is used when widget are wrote with formencode.htmlgen
> 
> PageRenderer  Form def        other widgets def       display
> kid           kid             kid                     OK
> kid           kid             poc                     OK
> kid           poc             poc                     OK
> kid           poc             kid                     FAILED
> htmlpy                kid             kid                     FAILED
> htmlpy                kid             poc                     FAILED
> htmlpy                poc             poc                     OK
> html          poc             kid                     FAILED
> 
> urls:
> 1: http://localhost:8080/?engine=kid&form=full_kid .... OK
> 2: http://localhost:8080/?engine=kid&form=form_kid .... OK
> 3: http://localhost:8080/?engine=kid&form=full_poc .... OK
> 4: http://localhost:8080/?engine=kid&form=form_poc .... FAILED
> 5: http://localhost:8080/?engine=htmlpy&form=full_kid . FAILED
> 6: http://localhost:8080/?engine=htmlpy&form=form_poc . FAILED
> 7: http://localhost:8080/?engine=htmlpy&form=form_kid . FAILED
> 8: http://localhost:8080/?engine=htmlpy&form=full_poc . OK
> 
> When failed Widgets are displayed as string :
>   <generator object at 0xb75e214c>
> 
> Cause:
> ------
> Lake of specification for Widgets.insert() method (and same for
> TemplatePlugin.transform()).
> "...the output is ElementTree Elements..."
> 
> So my implementation, I translate this into :
> * a ElementTree.Element
> * or a list/tuple of ElementTree.Element
> 
> But for kid return a "generator" (or stream into kid'api)
> 
> Suggestions:
> ------------
> * details the api and be provide tools for simple integration with
> TemplatePlugin implementation
> * the return of methods, is a ElementTree.Element or a list/tuple of
> ElementTree.Element, then I suggest to patch TurboKid (see below for a
> basic patch, maybe optimisation are possible when widget and page use
> the same template engine). This solution remove from each engine to have
> special traitement for kid.
> 
> For information :
> -----------------
> * generator/stream are iterator, that produce Element without children
> * to translate a generator/stream into an ElementTree.Element, the
> following code seems to work :
> 
>             from kid.pull import ElementStream
>             el = ElementStream(stream).expand()
> 
> --
> --------------------------------------------------------------
> David "Dwayne" Bernard            Freelance Developer
>                                   mailto:[EMAIL PROTECTED]
>       \|/                         http://dwayne.java-fan.com
> --o0O @.@ O0o-------------------------------------------------

- --
- --------------------------------------------------------------
David "Dwayne" Bernard            Freelance Developer (Java)
                                  mailto:[EMAIL PROTECTED]
     \|/                          http://dwayne.java-fan.com
- --o0O @.@ O0o-------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDy8ZDN11itWi/tc4RAlacAKCIkwUU848S2wSZd4XH9O0nsmJTTQCeKg8M
ELeSbiWdm5StDAxwX2xtMIg=
=j7NU
-----END PGP SIGNATURE-----

Reply via email to