示例#1
0
文件: FSSTool.py 项目: dtgit/ecec
    def getStorageStrategy(self):
        """Returns the storage strategy"""

        global _strategy_map
        portal = getToolByName(self, "portal_url").getPortalObject()
        portal_path = "/".join(portal.getPhysicalPath())
        strategy_class = _strategy_map[ZCONFIG.storageStrategyForSite(portal_path)]
        return strategy_class(ZCONFIG.storagePathForSite(portal_path), ZCONFIG.backupPathForSite(portal_path))
示例#2
0
文件: FSSTool.py 项目: dtgit/ecec
    def globalConfigInfo(self):
        """A TALES friendly configuration info mapping for global configuration"""

        return {
            "config_file": CONFIG_FILE,
            "strategy": ZCONFIG.storageStrategyForSite("/"),
            "storage_path": ZCONFIG.storagePathForSite("/"),
            "backup_path": ZCONFIG.backupPathForSite("/"),
        }
示例#3
0
    def testDefaultConfig(self):
        from Products.FileSystemStorage.config import ZCONFIG

        self.assertEqual(ZCONFIG.storagePathForSite('/any/site'),
                         os.path.normpath(os.path.expandvars('$INSTANCE_HOME/var/fss_storage')))
        self.assertEqual(ZCONFIG.backupPathForSite('/any/site'),
                         os.path.normpath(os.path.expandvars('$INSTANCE_HOME/var/fss_backup')))
        self.assertEqual(ZCONFIG.storageStrategyForSite('/any/site'), 'flat')
        self.assertEqual(len(ZCONFIG.sites), 0)
        return
示例#4
0
文件: FSSTool.py 项目: dtgit/ecec
    def siteConfigInfo(self):
        """A TALES friendly configuration info mapping for this Plone site"""

        portal = getToolByName(self, "portal_url").getPortalObject()
        portal_path = "/".join(portal.getPhysicalPath())
        return {
            "config_file": CONFIG_FILE,
            "strategy": ZCONFIG.storageStrategyForSite(portal_path),
            "storage_path": ZCONFIG.storagePathForSite(portal_path),
            "backup_path": ZCONFIG.backupPathForSite(portal_path),
        }