Esempio n. 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)
Esempio n. 2
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)
Esempio n. 3
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
Esempio n. 4
0
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
Esempio n. 5
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
Esempio n. 6
0
File: db.py Progetto: 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