deliverance.stringmatch – matcher for strings

Represents the string and header matching that is used to determine page classes.

Module Contents

deliverance.stringmatch.compile_matcher(s, default=None)

Compiles the match string to a match object.

Match objects are callable objects that return a boolean.

deliverance.stringmatch.compile_header_matcher(s, default='exact')

Compiles the match header string to a match object.

Unlike simple match objects, these match against a dictionary of headers.

This also applies the the environ dictionary. Case-sensitivity is handled by the dictionary, not the matcher.

exception deliverance.stringmatch.MatchSyntaxError
Raised if you have an invalid expression in a matcher

Internal Classes

class deliverance.stringmatch.Matcher(pattern)
class deliverance.stringmatch.WildcardMatcher(pattern)
Matches a value against a pattern that may contain * wildcards.
class deliverance.stringmatch.WildcardInsensitiveMatcher(pattern)
Matches a value, ignoring case, against a pattern with wildcards.
class deliverance.stringmatch.RegexMatcher(pattern)
Matches a value against a regular expression.
class deliverance.stringmatch.PathMatcher(pattern)
Matches a value against a path. This checks prefixes, but also only matches /-delimited segments.
class deliverance.stringmatch.ExactMatcher(pattern)
Matches a string exactly.
class deliverance.stringmatch.ExactInsensitiveMatcher(pattern)
Matches a string exactly, but ignoring case.
class deliverance.stringmatch.ContainsMatcher(pattern)
Matches if the value contains the pattern.
class deliverance.stringmatch.ContainsInsensitiveMatcher(pattern)
Matches if the value contains the pattern, ignoring case.
class deliverance.stringmatch.BooleanMatcher(pattern)
Matches according to a boolean true/falseness of a value
class deliverance.stringmatch.HeaderMatcher(header, pattern)
Matches simple “Header: pattern”. Does not match wildcard headers.
class deliverance.stringmatch.HeaderWildcardMatcher(header, pattern)
Matches “Header*: pattern”, where the header contains a wildcard.