|
|
|
08/19/2005
I added a demo package to illustrate the zope3 / xml schema integration.
You can grab de code over there : http://svn.nuxeo.org/trac/pub/browser/z3lab/zope/xmlschema/trunk/demo/ The goal of the demo is to get a new content object registred within Zope3 with an "add "and "edit" form driven by an XML Schema definition. This example is pretty simple but illustrate perfectly the goal of the XML integration and the power of Zope3 ;) Let's take a look at the xsd we will use in this demo : <?xml version="1.0" encoding="UTF-8"?>(demo.foo.xs) It defines a schema having 2 attributs : title and description. title is required and is a normalizedString data type description is required as well and is a string data type. Let's define an interface IFoo and set the "foo" schema above. Note I'm using directly an id in here for the schema (i.e : foo). This is because at this stage the schema will be registred within Zope3 under this name. We will see how just after. import zope.interface(demo.interfaces.py) Then define the Foo content object implementing IFoo. It inherits from presistent so that the content object will be persistent but it's not compulsory. import persistent(demo.foo.py) Now the zcml configuration (the glue) (see demo.configure.zcml) to tell Zope what to do whith the definitions above. Let's take a look at the configure.zcml file for the package as explained below : <xmlschemaThis directive registers the xsd foo.xs under the name of 'foo' Then the one below defines the new content object (notice the set_schema directive.) You can forget about the Zope permission stuffs if you're not familiar with Zope3 <content class=".foo.Foo"> Then, we specify the add and edit form for the Foo content object. <browser:addform Then we need to tell Zope to add an entry in ZMI (Zope Management Interface) menu for us to be able to create a Foo content object through the ZMI. <browser:addMenuItem Now start Zope3 go in the ZMI and click the Add menu entry and ask for the creation of a Foo content object. You will get the form below :
Then you can try to submit with empty values and since we specified required values on the xml schema the submission is not possible :
Here it is for today. The 'magic' for the rendering against the schema is done by Zope3 itself. It's not the job of the zope.xmlschema component. Again, the next step will be to have the rendering done with XForms :) Currently, looking at it. I played today with the mozilla xforms plugin. I'll dig into this whike coming back from holidays at the beginning of September. Time to sleep...
08/18/2005
Some news about the xmlschema component.
First, you may want to check the doctest over there : http://svn.nuxeo.org/trac/pub/file/z3lab/zope/xmlschema/trunk/README.txt I did some changes so that it's possible now to register the XML Schema document via ZCML such as this : <configure xmlns="http://namespaces.zope.org/zope"> Then the directive register a named utility within the global utility registy of Zope3 that will be used by the dedicated XSD handler. Now, to use it from you class def you just need to give the id (name) of the registred schema such as : >>> import zope.interface A new feature as well the validation : the handler perform an XML Schema validation against the XMLSchema.xsd from the w3c. If you want to test this package (or help right :)) be sure to check the deps. (especially, the CVS HEAD of libxml2 is required for the XML Schema validation) You will find the dependencies over there : https://svn.nuxeo.org/trac/pub/file/z3lab/zope/xmlschema/trunk/DEPENDENCIES.txt Now time to print the XML Schema specifications and code field mappers for the zope interface. Thanks to Kasimier Buchcik for the pointer on the libxml2 CVS for the XML Schema validation. Time to sleep now :)
08/12/2005
I started yesterday an XML Schema support for the ZopeInterface. I
would like to be able to define my schema with XML Schemas definitions
instead of having to define them in Python. (which is boring and
Python specific...)
The code is within the z3ecm repository: http://svn.nuxeo.org/trac/pub/browser/z3lab/zope/xmlschema/trunk/ See an example : filepath is a path to an XML Schema definition as defined below : You can see that once the schema is set on the interface the interface behaves like if it had been defined in Python. Now let's dig into the XML Schema specification and implements at least all the zope.schema features so that zope.schema and zope.xmlschema will provide the same delcaratives possibililty. Notice, this component uses lxml as core XML parser. It's the first step toward XForms support on z3ecm :)
08/08/2005
Guido wrote a blog entry about interfaces versus ABC in Python.
http://www.artima.com/weblogs/viewpost.jsp?thread=92662 Nice to see the discussion about this point occuring. Note he's taking into account the fact that Zope3 and Twisted do have an actual interface implementation (which is the ZopeInterface BTW) As a Zope3 developer I just hope he will go for core Python interfaces ;)
08/04/2005
I just drop a mail on the z3lab mailing list about the Z3/ECM status and
future as Zope3.1 has been released this week as an RC.
You may find the mail over there : http://lists.nuxeo.com/pipermail/z3lab/2005-August/000625.html Waiting for your comments.
08/03/2005
Here it is ! The first rc of Zope-3.1 is out.
After the bug day last week, which was really productive, the first rc of Zope-3.1 is now available. Stephan built the tarball today. You can grab a tarball from there : http://www.zope.org/Products/Zope3/3.1.0c1/Zope310c1Released If you wanna try out this release and help releasing the final you may fill up bugs over there : http://www.zope.org/Collectors/Zope3-dev/ Now the trunk is dedicated to the 3.2 release for 3 months before the next feature freeze that should occur in October as Zope is moving to a time based release cycle. (december / june) Now back the Z3/ECM seriously (see my next posts)
Posted by Julien Anguenot @ 08/03/2005 02:14 AM.
-
Categories:
zope3
-
0 comments
Last modified:
12/21/2005 01:11 AM
|
Nuxeo Bloggers: Log in! Search Nuxeo Blogs
About this blog
Julien Anguenot ja [at] nuxeo [dot] com Nuxeo Bloggers
Photos and Pictures
|
|
Nuxeo -
Indesko -
Nuxeo 5 Project
All content is copyrighted by their author. CPSSkins is Copyright © 2003-2006 by Jean-Marc Orliaguet. | CPS is Copyright © 2002-2006 by Nuxeo SAS. |