def getDBInstance(cls): """ Returns the instance of SyncManager currently in the DB """ storage = getPluginType().getStorage() if 'agent_manager' in storage: return storage['agent_manager'] else: root = DBMgr.getInstance().getDBConnection() updateDBStructures(root)
def getDBInstance(cls): """ Returns the instance of SyncManager currently in the DB """ storage = getPluginType().getStorage() if 'agent_manager' in storage: return storage['agent_manager'] else: root = DBMgr.getInstance().getDBConnection() updateDBStructures(root)
def objectExcluded(self, obj): """ Decides whether a particular object should be ignored or not """ excluded = getPluginType().getOption('excludedCategories').getValue() if isinstance(obj, conference.Category): return obj.getId() in excluded elif isinstance(obj, conference.Conference): owner = obj.getOwner() if owner: return owner.getId() in excluded elif obj.getParent(): conf = obj.getConference() if conf: owner = conf.getOwner() if owner: return owner.getId() in excluded return False
def updateDBStructures(root, granularity=MPT_GRANULARITY): """ Updates the DB for use with livesync """ from indico.ext.livesync.util import getPluginType from indico.ext.livesync.agent import SyncManager # get our storage ptype = getPluginType() storage = ptype.getStorage() # check if it is empty if 'agent_manager' in storage: raise Exception("This DB seems to already have livesync installed") else: # nice, let's fill it storage['agent_manager'] = SyncManager(granularity=granularity) return True
def objectExcluded(self, obj): """ Decides whether a particular object should be ignored or not """ excluded = getPluginType().getOption('excludedCategories').getValue() if isinstance(obj, conference.Category): return obj.getId() in excluded elif isinstance(obj, conference.Conference): owner = obj.getOwner() if owner: return owner.getId() in excluded elif obj.getParent(): conf = obj.getConference() if conf: owner = conf.getOwner() if owner: return owner.getId() in excluded return False
def updateDBStructures(root, granularity=MPT_GRANULARITY): """ Updates the DB for use with livesync """ from indico.ext.livesync.util import getPluginType from indico.ext.livesync.agent import SyncManager # get our storage ptype = getPluginType() storage = ptype.getStorage() # check if it is empty if "agent_manager" in storage: raise Exception("This DB seems to already have livesync installed") else: # nice, let's fill it storage["agent_manager"] = SyncManager(granularity=granularity) return True