When trying to use the
import-site-setup form of collective.themesitesetup manually in a test site, traversal to the import-site-setup form fails with the following code
portal.unrestrictedTraverse(directory_string + "/@@import-site-setup”). Manually navigating to the form page in a robot framework instance of phone seems to work fine. In an attempt to get the functionality working anyway, I copied the code executed to handle the form import into the test setup. However, only top-level content is created, with all content within folders not being created.
Stepping through the calls, it seems as through the adapter query to get the content creation factory in
None and so any child content which needs to be imported isn't created
Any suggestions as to why the themesitesetup behaves so differently when called from
setUpPloneSite within the test site setup compared to a running Plone instance?
Unfortunately, the structure (content) import step is one of the many parts of Plone that have not get the love they would have deserve lately, so anything is possible
So, according to your research, this adapter call only fails during
setUpPloneSite, but succeeds later when the test server is running? That's surprising.
Is this Plone 4 or Plone 5? With both Dexterity and Archetypes or only Dexterity?
I don't remember anymore the details on why I ended up developing custom adapters for structure import, but you could try if including adding
<include package="collective.themesitesetup" file="extras.zcml" /> helps, or even cherry-picking some adapter registration from it: https://github.com/collective/collective.themesitesetup/blob/master/src/collective/themesitesetup/extras.zcml
This is working on a Plone 5.0 site using only Dexterity types.
I'm debugging now, but including the
self.loadZCML(package=collective.themesitesetup, name="extras.zcml") seems to break the test site setup as it cannot install any of the GenericSetup profiles. This is as a result of the following adapter registration:
Thanks for the details.
extras.zcml being broken is expected, because it was originally made for Plone 4.3.
Yet, I from the source I cannot figure out any obvious reason, why it behaves differently in test setup than in running site. I'll see if I can find time to try this out...
@JeffersonBledsoe Hi, we shortly discussed about your use case during the Plone Conference party. If I understood properly, your primarly goals is to populate Plone at CI for better tests and also other options than themesitesetup would work.
import.sh at https://github.com/collective/gatsby-source-plone/blob/master/demo/fixture/
They should provide generic solution for exporting and importing content using Plone REST API, curl and jq for test fixture purposes.