def ConvertToList(data, raiseExcp=False):
    """
    converts a string to list.
    the list items can be seperated by "," or "
"
    """
    try:
        if not data:
            return []
        if isinstance(data, (list, tuple)):
            return data
        data = data.strip()
        if not len(data):
            return []
        if data[0] in ('[', '('):
            data = data[1:-1]
        sep = ','
        if data.find('\n') != -1:
            sep = '\n'
        result = []
        l = data.split(sep)
        for value in l:
            value = value.strip()
            if not len(value):
                continue
            if value[0] in ("'", '"'):
                value = value[1:-1]
            result.append(value)
        return result
    except:
        if raiseExcp:
            raise
        return []
