Пример #1
0
    def getTasks(self, user, mode=IA.All):
        # update last active clients
        self.last_clients[user] = time()

        # filter current mode
        tasks = [t for t in self.tasks.itervalues() if mode == IA.All or bits_set(t.type, mode)]
        # filter correct user / or shared
        tasks = [t for t in tasks if user is None or user == t.owner or t.shared]

        return tasks
Пример #2
0
    def getTasks(self, user, mode=IA.All):
        # update last active clients
        self.last_clients[user] = time()

        # filter current mode
        tasks = [
            t for t in self.tasks.itervalues()
            if mode == IA.All or bits_set(t.type, mode)
        ]
        # filter correct user / or shared
        tasks = [
            t for t in tasks if user is None or user == t.owner or t.shared
        ]

        return tasks
Пример #3
0
 def updateClient(self, mode):
     t = time()
     for output in self.last_clients:
         if bits_set(output, mode):
             self.last_clients[output] = t
Пример #4
0
    def getTask(self, mode=Output.All):
        self.updateClient(mode)

        for task in self.tasks.itervalues():
            if mode == Output.All or bits_set(task.output, mode):
                return task
Пример #5
0
    def hasPermission(self, perms):
        """  Accepts permission bit or name  """
        if isinstance(perms, basestring) and hasattr(Permission, perms):
            perms = getattr(Permission, perms)

        return bits_set(perms, self.permission)
Пример #6
0
 def updateClient(self, mode):
     t = time()
     for output in self.last_clients:
         if bits_set(output, mode):
             self.last_clients[output] = t
Пример #7
0
    def getTask(self, mode=Output.All):
        self.updateClient(mode)

        for task in self.tasks.itervalues():
            if mode == Output.All or bits_set(task.output, mode):
                return task
Пример #8
0
    def hasPermission(self, perms):
        """  Accepts permission bit or name  """
        if isinstance(perms, basestring) and hasattr(Permission, perms):
            perms = getattr(Permission, perms)

        return bits_set(perms, self.permission)