5.5 Rules

An Aspen rule is a callable that takes a filesystem path and a predicate string, and returns True or False. Rules are part of Aspen's handler infrastructure; see the documentation for handlers.conf for how to use them.

catch_all( path, predicate)
Always return True.

fnmatch( path, predicate)
Match if path matches the pattern predicate per the standard library's fnmatch.fnmatchcase.

hashbang( path, predicate)
Match if the file at path starts with '#!'.

isdir( path, predicate)
Match if path points to a directory.

isfile( path, predicate)
Match if path points to a file.

isexecutable( path, predicate)
Match if the file at path is executable.

mimetype( path, predicate)
Match if the mimetype of the file at path is predicate.

rematch( path, predicate)
Match if path matches the regular expression predicate.
Aspen is copyright © 2006-2007 by Chad Whitacre and contributors, and is offered under the MIT license.