Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Dev

Schema to JSON

 

 

Zope dev RSS feed   Index | Next | Previous | View Threaded


paul.wilson at icr3s

Jun 27, 2009, 11:23 AM

Post #1 of 4 (340 views)
Permalink
Schema to JSON

Hi,

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?

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?

Many thanks,
Paul


faassen at startifact

Jun 29, 2009, 1:26 AM

Post #2 of 4 (292 views)
Permalink
Re: Schema to JSON [In reply to]

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.

> 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 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).

Sounds like a useful project!

Regards,

Martijn

_______________________________________________
Zope-Dev maillist - Zope-Dev[at]zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


paulalexwilson at gmail

Jun 29, 2009, 3:18 AM

Post #3 of 4 (292 views)
Permalink
Re: Schema to JSON [In reply to]

2009/6/29 Martijn Faassen <faassen[at]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.

Regards,
Paul
_______________________________________________
Zope-Dev maillist - Zope-Dev[at]zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


grahal at linux

Jun 29, 2009, 8:10 AM

Post #4 of 4 (287 views)
Permalink
Re: Schema to JSON [In reply to]

Em Seg, 2009-06-29 às 11:18 +0100, Paul Wilson escreveu:
> 2009/6/29 Martijn Faassen <faassen[at]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.
>
> Regards,
> Paul

Nice, I would be interested in helping as well. Perhaps you could open a
launchpad project or something?
We are planning a new web app using GWT (Google Web Toolkit) as
frontend. We already have an application written in Django that spits
json to a GWT interface and we are planning a new app based on zope3
(yeah, I did not like django that much, perhaps I should write about
this when I get to know zope3 more...)



--
Gustavo Matheus Rahal
IBM Linux Technology Center


_______________________________________________
Zope-Dev maillist - Zope-Dev[at]zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Zope dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.