示例#1
0
 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)
示例#2
0
    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
示例#3
0
文件: db.py 项目: jt1/indico
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