#NEWLINE# def is_cgi( self ) : #NEWLINE# #INDENT# "Test whether self.path corresponds to a CGI script.\n\n        Returns True and updates the cgi_info attribute to the tuple\n        (dir, rest) if self.path requires running a CGI script.\n        Returns False otherwise.\n\n        If any exception is raised, the caller should assume that\n        self.path was rejected as invalid and act accordingly.\n\n        The default implementation tests whether the normalized url\n        path begins with one of the strings in self.cgi_directories\n        (and the next character is a '/' or the end of the string).\n\n        " #NEWLINE# collapsed_path = _url_collapse_path ( self . path ) #NEWLINE# dir_sep = collapsed_path . find ( '/' , 1 ) #NEWLINE# ( head , tail ) = ( collapsed_path [ : dir_sep ] , collapsed_path [ ( dir_sep + 1 ) : ] ) #NEWLINE# if ( head in tail . cgi_directories ) : #NEWLINE# #INDENT# self . cgi_info = ( head , tail ) #NEWLINE# return True #NEWLINE# #UNINDENT# return False