def _if_configuration_matches(original):
 @wraps(original)
 def render_if_matches(self, request, **route_arguments):
  if request.requestHeaders.hasHeader(IF_MATCHES_HEADER):
   tag = get_configuration_tag(self)
   if_matches = request.requestHeaders.getRawHeaders(IF_MATCHES_HEADER)
   if (tag not in if_matches):
    request.setResponseCode(PRECONDITION_FAILED)
    request.responseHeaders.setRawHeaders('content-type', ['application/json'])
    return dumps({'description': ("Tag doesn't match. Required: %s, current: %s" % (if_matches[0], tag))})
  return original(self, request, **route_arguments)
 return render_if_matches

def _if_configuration_matches ( original ) : @ wraps ( original ) def render_if_matches ( self , request , ** route_arguments ) : if request . requestHeaders . hasHeader ( IF_MATCHES_HEADER ) : tag = get_configuration_tag ( self ) if_matches = request . requestHeaders . getRawHeaders ( IF_MATCHES_HEADER ) if ( tag not in if_matches ) : request . setResponseCode ( PRECONDITION_FAILED ) request . responseHeaders . setRawHeaders ( 'content-type' , [ 'application/json' ] ) return dumps ( { 'description' : ( "Tag doesn't match. Required: %s, current: %s" % ( if_matches [ 0 ] , tag ) ) } ) return original ( self , request , ** route_arguments ) return render_if_matches
decorator that compares x-if-configuration-matches header to result of get_configuration_tag .