1

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.

Patrick Downey
  • 965
  • 8
  • 13
  • 1
    The second line in yout zcml-additional is wrong. I guess it should be `db="http://namespaces.zope.org/db"`. Currently you define `xmlns` twice. This is what the error indicates. – Mathias Nov 17 '14 at 14:29

1 Answers1

3

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"
           >
Ulrich Schwarz
  • 7,598
  • 1
  • 36
  • 48
  • Thankyou for your quick response and correcting my configure tag. I simply forgot to add the :db to where I was getting the namespace for db. – Patrick Downey Nov 17 '14 at 16:40