Did I find the right examples for you? yes no

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
Parse HTTP_IF header into a dictionary and lists, and cache the result.

@see http://www.webdav.org/specs/rfc4918.html#HEADER_If

        def parseIfHeaderDict(environ):
    """Parse HTTP_IF header into a dictionary and lists, and cache the result.
    
    @see http://www.webdav.org/specs/rfc4918.html#HEADER_If
    """
    if "wsgidav.conditions.if" in environ:
        return

    if not "HTTP_IF" in environ:
        environ["wsgidav.conditions.if"] = None
        environ["wsgidav.ifLockTokenList"] = []
        return
    
    iftext = environ["HTTP_IF"].strip()
    if not iftext.startswith("<"):
        iftext = "<*>" + iftext   

    ifDict = dict([])
    ifLockList = []
    
    resource1 = "*"
    for (tmpURLVar, URLVar, _tmpContentVar, contentVar) in reIfSeparator.findall(iftext):
        if tmpURLVar != "":
            resource1 = URLVar         
        else:
            listTagContents = []
            testflag = True
            for listitem in reIfTagListContents.findall(contentVar):            
                if listitem.upper() != "NOT":
                    if listitem.startswith("["):
                        listTagContents.append((testflag,"entity",listitem.strip('\"[]')))   
                    else:
                        listTagContents.append((testflag,"locktoken",listitem.strip("<>")))            
                        ifLockList.append(listitem.strip("<>"))
                testflag = listitem.upper() != "NOT"

            if resource1 in ifDict:
                listTag = ifDict[resource1]
            else:
                listTag = []
                ifDict[resource1] = listTag
            listTag.append(listTagContents)

    environ["wsgidav.conditions.if"] = ifDict
    environ["wsgidav.ifLockTokenList"] = ifLockList
    debug("parseIfHeaderDict", var=ifDict, module="if")
    return
        


src/w/s/WsgiDAV-1.1.0/wsgidav/request_server.py   WsgiDAV(Download)
 
        if "wsgidav.conditions.if" not in environ:
            util.parseIfHeaderDict(environ)
 
        # raise HTTP_LOCKED if conflict exists
        # Add parsed If header to environ
        if "wsgidav.conditions.if" not in environ:
            util.parseIfHeaderDict(environ)
 
        # Bail out, if res does not exist

src/w/s/wsgidav-HEAD/wsgidav/request_server.py   wsgidav(Download)
 
        if "wsgidav.conditions.if" not in environ:
            util.parseIfHeaderDict(environ)
 
        # raise HTTP_LOCKED if conflict exists
        # Add parsed If header to environ
        if "wsgidav.conditions.if" not in environ:
            util.parseIfHeaderDict(environ)
 
        # Bail out, if res does not exist