advice on MountedFileStorage changes.
I've nearly completed the code to make MountedFileStorage able to create new FileStorages on demand, _however_... I'm hitting a bit of a problem with the Product initialisation. Right now I'm just calling OFS.Application.initialize(), which goes through and re-imports all the products, and adds them to the global meta_types list. This is bad - it means it's slow as hell reimporting everything, and everything gets listed twice. It's fine after a restart, but that's not much help. I can't just skip product initialisation, as it's kinda needed to create objects in the sub-zodb. So, approaches I'm considering: passing a flag through initialize() saying 'don't put products in the meta_types' (seems hacky). subclassing OFS.Application.Application, and copying the method except for the last line that alters the meta_types (fragile - have to track changes to the main body of code). trying something else entirely, such as copying the products from the main products folder, and installing them that way... ? Any ideas appreciated. (There's an ongoing issue, too - there will need to be some sort of way to copy any new/changed Products from the main ZODB to the children...) Anthony
Anthony Baxter wrote:
I've nearly completed the code to make MountedFileStorage able to create new FileStorages on demand, _however_...
I'm hitting a bit of a problem with the Product initialisation. Right now I'm just calling OFS.Application.initialize(), which goes through and re-imports all the products, and adds them to the global meta_types list. This is bad - it means it's slow as hell reimporting everything, and everything gets listed twice. It's fine after a restart, but that's not much help.
I can't just skip product initialisation, as it's kinda needed to create objects in the sub-zodb.
I looked some more at ZClasses and such today, hoping to solve the problem with mounted databases. Guess what! It turned out to be a simple matter. The latest addition to Mount.py provides the ability for a MountPoint to get its ZClass definitions from the root database rather than the mounted database. Anthony, I think you'll want to make "classDefsFromRoot" a checkbox available when adding a new mount point. Depending on the application, this can be the more sensible (and more manageable) approach. For example, you may want to have a large collection of little FileStorages, all using the same ZClass definitions. You certainly wouldn't want to make a copy of all ZClasses in each FileStorage. In doing this I realized, and Jim suggested, that there are other situations where you'd really want ZClass definitions to come from the mounted database. This is a larger issue. We will first need to provide a way to manage the databases. Then there will be a need to load/unload products dynamically. I don't think we want to try to finish that for 2.2.0. Shane
participants (2)
-
Anthony Baxter -
Shane Hathaway