On 5/25/06, Sean Jamieson <[EMAIL PROTECTED]> wrote:

I was thinking about integrating cElementTree in the future,

I think that is the way to go, it gives everything you need and has been tested a lot.

but to make
a quick proof of concept, I just have my toxml() manually assembling a
string, using generators.

that's ok,  but soon you'll need a nice backend :)

you actually got workign code? if it's possible can I take a look?

currently, XMLValue and it's subclasses are optional, with a 'required'
bool keyword argument to __init__, also an XMLNodeList can have 0 items
(and therefore not appear)

I could add another magic attribute parsed from XMLAttrs, like _tagname,
called _required ...

I think there should be a general way (classes,fields) to tell the engine which fields are optional and which aren't, so the render function can detect a malform object, but this could turn into a huge validation scheme which I'm not sure if you want. Although if you ever generate some xml-based std, there should be a validation

but generally if a tag has child tags, its going to be used.

yes that's the way it should

I've seen hypy before, some months ago, it's yet another template language;
It is an interesting idea though.

I like the indentation thing which is basically what your doing here, what i don't like is the placeholder which you avoid with the class structure.

------

Sean


Jorge Vargas wrote:

> On 4/28/06, *Sean Jamieson* < [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> Sorry for bringing this old topic up, but I was just playing with
> ElementTree yesterday and I made a link to this
> I believe your model can be implemented on top of ElementTree, to give
> it a more friendly interface.
>
>     class RSS2( XMLModel ):
>         class XMLAttrs:
>             _tagname = 'rss'
>             version = '2.0'
>
>         class channel( XMLNode ):
>             title = XMLString()
>             description = XMLString()
>             link = XMLString()
>             lastBuildDate = XMLDate( format = "%a, %d %b %Y %H:%M:%S
>     EST" )
>             generator = XMLString()
>             docs = XMLString()
>
>             class item( XMLNodeList ):
>                 title = XMLString()
>                 link = XMLString()
>                 description = XMLString()
>                 category = XMLList( type = XMLString() )
>                 pubDate = XMLDate( format = "%a, %d %b %Y %H:%M:%S EST" )
>
>
> Based on your example
> all the helper classes extend the Element
> even XMLModel is an extension to the Element.
>
> So all that needs to be done is a render function that will take your
> class and do some calls to SubElement
>
> One question, how will you manage optional elements in the template?
>
> how is that?
>
> on the other hand I remenber looking at
> http://manatlan.online.fr/hypy.php
> < http://manatlan.online.fr/hypy.php> it's something similar but based
> on indentation no classes.






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to