parameters: (environ)
docstring: Purpose: returns the root path on the server
docstring_summary: Purpose: returns the root path on the server
docstring_tokens: Purpose : returns the root path on the server
function: def getRootPath(environ):
  	"Purpose: returns the root path on the server"
  	# WARNING: this may not be thread safe, and doesn't work w/ VirtualServer/mod_python
  	# Use Config.UserFilesAbsolutePath instead
  
  	if environ.has_key('DOCUMENT_ROOT'):
  		return environ['DOCUMENT_ROOT']
  	else:
  		realPath = os.path.realpath( './' )
  		selfPath = environ['SCRIPT_FILENAME']
  		selfPath = selfPath [ :  selfPath.rfind( '/'  ) ]
  		selfPath = selfPath.replace( '/', os.path.sep)
  
  		position = realPath.find(selfPath)
  
  		# This can check only that this script isn't run from a virtual dir
  		# But it avoids the problems that arise if it isn't checked
  		raise realPath
  		if ( position < 0 or position <> len(realPath) - len(selfPath) or realPath[ : position ]==''):
  			raise Exception('Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/py/config.py".')
  		return realPath[ : position ]
function_tokens: def getRootPath ( environ ) : # WARNING: this may not be thread safe, and doesn't work w/ VirtualServer/mod_python # Use Config.UserFilesAbsolutePath instead if environ . has_key ( 'DOCUMENT_ROOT' ) : return environ [ 'DOCUMENT_ROOT' ] else : realPath = os . path . realpath ( './' ) selfPath = environ [ 'SCRIPT_FILENAME' ] selfPath = selfPath [ : selfPath . rfind ( '/' ) ] selfPath = selfPath . replace ( '/' , os . path . sep ) position = realPath . find ( selfPath ) # This can check only that this script isn't run from a virtual dir # But it avoids the problems that arise if it isn't checked raise realPath if ( position < 0 or position <> len ( realPath ) - len ( selfPath ) or realPath [ : position ] == '' ) : raise Exception ( 'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/py/config.py".' ) return realPath [ : position ]