Exemplo n.º 1
0
    def parse(self, data, variant="icalendar"):

        result = utils.parseTextList(data, always_list=True)
        if len(result) == 1:
            if ParserContext.INVALID_REQUEST_STATUS_VALUE != ParserContext.PARSER_RAISE:
                if ";" in result[0]:
                    code, desc = result[0].split(";", 1)
                else:
                    code = result[0]
                    desc = ""
                rest = None
            else:
                raise ValueError
        elif len(result) == 2:
            code, desc = result
            rest = None
        elif len(result) == 3:
            code, desc, rest = result
        else:
            if ParserContext.INVALID_REQUEST_STATUS_VALUE != ParserContext.PARSER_RAISE:
                code, desc, rest = result[:3]
            else:
                raise ValueError

        if "\\" in code and ParserContext.INVALID_REQUEST_STATUS_VALUE in (ParserContext.PARSER_IGNORE, ParserContext.PARSER_FIX):
            code = code.replace("\\", "")
        elif ParserContext.INVALID_REQUEST_STATUS_VALUE == ParserContext.PARSER_RAISE:
            raise ValueError

        # Decoding required
        self.mValue = [code, desc, rest, ] if rest else [code, desc, ]
Exemplo n.º 2
0
 def parse(self, data, variant="vcard"):
     self.mValue = utils.parseTextList(data, ';')
Exemplo n.º 3
0
 def parse(self, data, variant="vcard"):
     self.mValue = utils.parseTextList(data, ";")