Esempio n. 1
0
File: view.py Progetto: Giotoc/ACR
def parsePosts(nodes):
    if not nodes:
        return (None, None)
    ret = {}
    postCount = 0
    for i in nodes:
        attrs = i[1]
        typ = typesMap.get(attrs.get("type", "default").lower())()
        if attrs.has_key("default"):
            typ.setDefault(makeTree(attrs["default"]))
        else:
            postCount += 1
        ret[attrs["name"]] = typ
    return (ret, postCount)
Esempio n. 2
0
File: view.py Progetto: Giotoc/ACR
def parseInputs(nodes):
    if not nodes:
        return None
    ret = []
    postCount = 0
    for i in nodes:
        attrs = i[1]
        try:
            typ = typesMap.get(attrs.get("type", "default").lower())()
        except TypeError:
            raise Error("WrongInputTypeName", "Input type '%s' is not supported." % attrs.get("type", "default"))
        if attrs.has_key("default"):
            typ.setDefault(makeTree(attrs["default"]))
        ret.append({"name": attrs["name"], "type": typ})
    return ret