Hi,

I am using an Apache webserver with mod_rewrite and the cgi module. Is
there a way to do the following that isn't completely evil?

########
def mod_rewrite_enabled():
    try:
        file = open(os.path.join(os.environ['DOCUMENT_ROOT'],
'.htaccess'))
    except:
        return False
    for line in file:
        if line.startswith('RewriteEngine on'):
            file.close()
            return True
    file.close()
    return False
########

Unfortunately, not using .htaccess isn't an option.

-Samuel
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to