+ else:
+ raise SubstitutionError("Unknown variable or function '%s' while performing substitution on '%s'" % (v, c))
+ if r is None:
+ raise SubstitutionError("Substitution for '%s' is null while performing substitution on '%s'" % (v, c))
+ if not isinstance(r, basestring):
+ raise SubstitutionError("Substitution for '%s' must be a string while performing substitution on '%s'" % (v, c))