2009/6/29 Martijn Faassen <faas...@startifact.com>
> Hi there,
> Paul Wilson wrote:
> > I'm about to embark on a module to serialize Zope schemas into the JSON
> > format for my application, taking inspiration from z3c.schema2xml. I've
> > had a look around SVN to see if this functionality has already been
> > implemented but can't find anything - does anybody know whether this has
> > already been done somewhere?
> I imagine lazr.restful hides functionality for this somewhere in its
> codebase. Perhaps one way forward would be to extract it? Maybe not, but
> it bears some investigation.
Thanks for the hint. I'll take a look.
> > Also, it makes sense in my mind for a schema2xml and schema2json to
> > implement the same interface. How does Zope handle this case? With a
> > format agnostic interface module or something?
> I am not sure I understand the proposal. Which interface would be the
> same and why would that be useful?
I don't want my application to have knowledge of the format that the
object tree will be serialized into - I want that to be a
configuration detail. So, a simple format independent interface (with
serialize and deserialize) would hide this. I was considering
implementing some of the TODOs in the schema2xml package for my json
version, but this would diverge their behaviour enough to spoil my
hopes of switching freely between the two formats. Perhaps I'm looking
at this the wrong way?
> I think you should just think in terms of what the API should be like
> before you worry about interfaces. (though interfaces are also used to
> look up adapters here).
I've structured it internally in a very similar way to your schema2xml
package, and shamelessly copied your test cases! :-)
> Sounds like a useful project!
It's in my sandbox at the moment - all tests pass as it stands but it
needs more attention I think.
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -