refs: http://zhuoqiang.me/a/restful-pyramid
    Custom predict checking if the the file extension
    of the request URI is in the allowed set.

def allowed_extension(*allowed):
    '''
    refs: http://zhuoqiang.me/a/restful-pyramid
    Custom predict checking if the the file extension
    of the request URI is in the allowed set.
    '''
    def predicate(info, request):
        log.debug(request.path)
        ext = os.path.splitext(request.path)[1]
        request.environ['path_extenstion'] = ext
        log.debug(ext)
        return ext in allowed

    return predicate