plonezcml

Plone/ZCML: Where is/should zcml-additional be located?


I am trying to set up through the zcml the engine and session for connection to a database with the use of z3c.saconfig. I am using Plone 4.3.2.

I was following along with a book on Plone 4 called Professional Plone Develop book and under [instance] in buildout.cfg it says to place zcml-additional and it sets the engine and session.

Here is what the instance portion of the buildout.cfg looks like:

[instance]
<= instance_base
recipe = plone.recipe.zope2instance
http-address = 8080
zcml-additional = 
    <configure xmlns="http://namespaces.zope.org/zope"
               xmlns="http://namespaces.zope.org/db"
               >

        <include package="z3c.saconfig" file="meta.zcml" />
        <db:engine name="testA" url="mysql://uName:uPass@localhost/GPCL_Asset_Tracker"/>
        <db:session engine="testA" />
    </configure>

Also, I have a package called gpcl.calibration and in the setup.py file I added underneath install_requires 'MySQL-Python' and 'z3c.saconfig', which work and do not cause a problem in the buildout.

Unfortunately I am getting this error:

    ZopeSAXParseException: File "/home/pjdowney/Plone/GPCLAssetTrackerD/parts/instance/etc/package-includes/999-additional-overrides.zcml", line 2.0,  duplicate attribute

Is zcml-additional defined elsewhere not in buildout.cfg? In the book, I did notice it has underneath [instance] the http-address and user, which seem to have been moved to underneath [buildout] instead.


Solution

  • This is a typo: you cannot have two attributes both named xmlns on your configure element. Going by the <db:engine that follows, it probably should read

    <configure xmlns="http://namespaces.zope.org/zope"
               xmlns:db="http://namespaces.zope.org/db"
               >