I'm working on upgrading the site of one of our customers; currently, we are using an old pattern consisting on 3 different packages: buildout, policy and theme. this pattern has proven complex and hard to maintain for obvious reasons and we want to migrate it to a single package including the whole code.
let's summarize that as follows:
- current:
example.buildout
,example.policy
andexample.theme
- new:
example.portal
the problem I'm facing right now is that I just realized, after having moved almost all code to this unified new package, that I will have a huge issue regarding the policy and theme package being installed; let me explain better:
my original idea was just to copy the ZODB and blob storage, and drop them in the location of my new unified package; obviously I will have to deal with persistent objects pointing to the old code so I was planning to do that adding something like this to my __init__.py
module:
import sys
sys.modules['example.policy'] = sys.modules['example.theme'] = sys.modules[__name__]
note that all previous code will be available in the same locations so, if I was previously importing something from example.policy.caching
, it will be available now from example.portal.caching
; similarly, if I was previously importing something from example.theme.browser
, it will be available now from example.portal.browser
.
so far, so good; but then comes the hardest problem: if I just move this way, I will be left with 2 packages marked as installed and they will be no longer there; also, my new package will not be marked as installed and I will be left with some issues as I don't want to reinstall it because all the stuff being in the default profile is already persisting in the ZODB.
I was digging the code of the QuickInstallerTool trying to figure out if it is possible just to delete the pid
form it or not:
seems something doable, are there any risks?
what about marking a package as installed without actually installing it? is that possible? the code there is out of my comprehension.
should I just remove all the XML files out of the default profile, install the package and move on?