Пример #1
0
    def _load(self, data):
        data = list(data)
        if data[4] is not None:
            data[4] = json_decode(data[4])
        if data[12] is not None:
            data[12] = json_decode(data[12])

        return Task(*data)
Пример #2
0
    def process_task_args(self, action, data, status):
        if not re.match(r"[A-Za-z0-9_.]{4,100}", action):
            raise TypeError("action:%s invalid, must be [A-Za-z0-9_.]{4,100}" % (action))
        try:
            data = json_decode(data)
        except:
            raise TypeError("invalid json data")

        if status not in TASK_STATUSES:
            raise TypeError("invalid status")

        status = TASK_STATUSES[status]
        return action, data, status