Ticket #2034: null-namespace.patch

File null-namespace.patch, 958 bytes (added by rfmohr@…, 10 years ago)

Fix for null namespace property handling.

  • twisted/web2/dav/xattrprops.py

     
    6565        # attribute name (radar://4202440). We'll quote the strings to get rid
    6666        # of "/" characters for now.
    6767        #
    68         result = list("{%s}%s" % name)
     68        (ns, attr) = name
     69        if (ns is None):
     70            ns = ""
     71        qname = (ns, attr)
     72        result = list("{%s}%s" % qname)
    6973        for i in range(len(result)):
    7074            c = result[i]
    7175            if c in "%/": result[i] = "%%%02X" % (ord(c),)
     
    7983   
    8084        if (index is -1 or not len(name) > index or not name[0] == "{"):
    8185            raise ValueError("Invalid encoded name: %r" % (name,))
    82    
    83         return (name[1:index], name[index+1:])
    8486
     87        ns = name[1:index]
     88        attr = name[index+1:]
     89        if (not ns):
     90            ns = None
     91
     92        return (ns, attr)
     93
    8594    _encode = classmethod(_encode)
    8695    _decode = classmethod(_decode)
    8796