• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(3838)  |  Call(3789)  |  Derive(0)  |  Import(49)
access(path, mode) -> True if granted, False otherwise

Use the real uid/gid to test for access to a path.  Note that most
operations will use the effective uid/gid, therefore this routine can
be used in a suid/sgid environment to test if the invoking user has the
specified access to the path.  The mode argument can be F_OK to test
existence, or the inclusive-OR of R_OK, W_OK, and X_OK.

src/e/v/evserver-HEAD/evserver/examples/comet.py   evserver(Download)
    def GET(self, filename='index.html'):
        path = resource_filename(__name__, os.path.join('static',filename))
        #path = os.path.join('static',filename)
        if not os.access(path, os.R_OK):
            web.notfound()
            return
        if filename=='index.html':
    def POST(self):
        i = web.input(uid='x')
        uid = i.uid.replace('.','').replace('/','')
        path = os.path.join('/tmp/','fifo-' + uid)
        if not os.access(path, os.W_OK):
            web.notfound()
            return

src/e/c/ecell-HEAD/ecell4/trunk/doc/sample/ga/ga.py   ecell(Download)
				#print getJobDirectory(aJobID)
				aResultFile = "%s%sresult.dat" %(getJobDirectory(aJobID), os.sep)
 
				if os.access(aResultFile,os.R_OK) == False:
					sys.stdout.flush()
					sys.stderr.write("\n%s: could not find %s. \n%s must write %s.\n" \
					                 %(ERROR,
		# -----------------------------------------------
		# check the accessibility of setting file
		# -----------------------------------------------
		if os.access(aSettingFile,os.R_OK) == False:
			aMessage = "Error: can't read %s\n" %aSettingFile
			sys.stderr.write(aMessage)
			sys.exit(SETTINGFILE_EXIT)
				# -----------------------------------------------
				# check the read permission of aFile
				# -----------------------------------------------
				if os.access( aFile, os.R_OK ) == False:
					aMessage = "%s: could not read \"%s\" set in \"%s\". \n" \
			           %(SETUP_ERROR,aFile,aKey)
					sys.stderr.write(aMessage)
		# -----------------------------------------------
		# checks the read permission of aFile
		# -----------------------------------------------
		if os.access( aFile, os.R_OK ) == False:
			aMessage = "%s: \"%s\" is set as \"%s\", but it has no read permission. \n" \
		           %(SETUP_ERROR,aKey,self.__get(aKey))
			sys.stderr.write(aMessage)
		if os.path.isfile(aFile) == False:
 
			aParentDir = os.path.dirname(aFile)
			if os.access( aParentDir, os.R_OK ) == False:
				aMessage = "%s: \"%s\" is set as \"%s\", but it has no write permission of parrent directory. \n" \
		           %(SETUP_ERROR,aKey,aFile)
				sys.stderr.write(aMessage)
				return SET_UP_NG_RETURN
 
		else:
 
			if os.access( aFile, os.R_OK ) == False:
		# -----------------------------------------------
		# checks the read permission of aFile
		# -----------------------------------------------
		if os.access( aFile, aPermission ) == False:
			aMessage = "%s: \"%s\" is set as \"%s\", but it has no %s permission. \n" \
		           %(SETUP_ERROR,aKey,self.__get(aKey),PERMISSION[str(aPermission)] )
			sys.stderr.write(aMessage)
				# -----------------------------------------------
				# checks the permission of directory
				# -----------------------------------------------
				if os.access( aDirList[anIndex], os.R_OK + os.X_OK ) == False:
					aMessage = "%s: \"%s\" is set as \"%s\", but it has no read and execute permission of the directory. \n" \
			   	        %(SETUP_ERROR,
					      aKey,
		# -----------------------------------------------
		# checks the permission of directory
		# -----------------------------------------------
		if os.access( aDir, os.R_OK + os.X_OK ) == False:
			aMessage = "%s: \"%s\" is set as \"%s\", but it has no read and execut permission of parrent directory of it. \n" \
		           %(SETUP_ERROR,aKey,self.__get(aKey) )
			sys.stderr.write(aMessage)
		# -----------------------------------------------
		# checks the read permission of aParentDir
		# -----------------------------------------------
		if os.access( aParentDir, os.R_OK + os.W_OK + os.X_OK ) == False:
			aMessage = "%s: %s is set as \"%s\", but it has no read and write and execut permission of parrent directory of it. \n" \
		           %(SETUP_ERROR,aKey,self.__get(aKey) )
			sys.stderr.write(aMessage)

src/e/c/ecell-HEAD/ecell3/trunk/doc/samples/ga/ga.py   ecell(Download)
                #print getJobDirectory(aJobID)
                aResultFile = "%s%sresult.dat" %(getJobDirectory(aJobID), os.sep)
 
                if os.access(aResultFile,os.R_OK) == False:
                    sys.stdout.flush()
                    sys.stderr.write("\n%s: could not find %s. \n%s must write %s.\n" \
                                     %(ERROR,
        # -----------------------------------------------
        # check the accessibility of setting file
        # -----------------------------------------------
        if os.access(aSettingFile,os.R_OK) == False:
            aMessage = "Error: can't read %s\n" %aSettingFile
            sys.stderr.write(aMessage)
            sys.exit(SETTINGFILE_EXIT)
                # -----------------------------------------------
                # check the read permission of aFile
                # -----------------------------------------------
                if os.access( aFile, os.R_OK ) == False:
                    aMessage = "%s: could not read \"%s\" set in \"%s\". \n" \
                       %(SETUP_ERROR,aFile,aKey)
                    sys.stderr.write(aMessage)
        # -----------------------------------------------
        # checks the read permission of aFile
        # -----------------------------------------------
        if os.access( aFile, os.R_OK ) == False:
            aMessage = "%s: \"%s\" is set as \"%s\", but it has no read permission. \n" \
                   %(SETUP_ERROR,aKey,self.__get(aKey))
            sys.stderr.write(aMessage)
        if os.path.isfile(aFile) == False:
 
            aParentDir = os.path.dirname(aFile)
            if os.access( aParentDir, os.R_OK ) == False:
                aMessage = "%s: \"%s\" is set as \"%s\", but it has no write permission of parrent directory. \n" \
                   %(SETUP_ERROR,aKey,aFile)
                sys.stderr.write(aMessage)
                return SET_UP_NG_RETURN
 
        else:
 
            if os.access( aFile, os.R_OK ) == False:
        # -----------------------------------------------
        # checks the read permission of aFile
        # -----------------------------------------------
        if os.access( aFile, aPermission ) == False:
            aMessage = "%s: \"%s\" is set as \"%s\", but it has no %s permission. \n" \
                   %(SETUP_ERROR,aKey,self.__get(aKey),PERMISSION[str(aPermission)] )
            sys.stderr.write(aMessage)
                # -----------------------------------------------
                # checks the permission of directory
                # -----------------------------------------------
                if os.access( aDirList[anIndex], os.R_OK + os.X_OK ) == False:
                    aMessage = "%s: \"%s\" is set as \"%s\", but it has no read and execute permission of the directory. \n" \
                           %(SETUP_ERROR,
                          aKey,
        # -----------------------------------------------
        # checks the permission of directory
        # -----------------------------------------------
        if os.access( aDir, os.R_OK + os.X_OK ) == False:
            aMessage = "%s: \"%s\" is set as \"%s\", but it has no read and execut permission of parrent directory of it. \n" \
                   %(SETUP_ERROR,aKey,self.__get(aKey) )
            sys.stderr.write(aMessage)
        # -----------------------------------------------
        # checks the read permission of aParentDir
        # -----------------------------------------------
        if os.access( aParentDir, os.R_OK + os.W_OK + os.X_OK ) == False:
            aMessage = "%s: %s is set as \"%s\", but it has no read and write and execut permission of parrent directory of it. \n" \
                   %(SETUP_ERROR,aKey,self.__get(aKey) )
            sys.stderr.write(aMessage)

src/f/u/fuse-python-0.2/example/xmp.py   fuse-python(Download)
    def access(self, path, mode):
        if not os.access("." + path, mode):
            return -EACCES
 
#    This is how we could add stub extended attribute handlers...
#    (We can't have ones which aptly delegate requests to the underlying fs
#    because Python lacks a standard xattr interface.)

src/d/u/dutils-0.0.10/dutils/sample/path.py   dutils(Download)
        def access(self, mode):
            """ Return true if current user has access to this path.
 
            mode - One of the constants os.F_OK, os.R_OK, os.W_OK, os.X_OK
            """
            return os.access(self, mode)
 

src/b/o/boxc-HEAD/trunk/web/in/examples/create_example.py   boxc(Download)
  title = "Box example: %s" % crumb
 
print "Removing old figure if present..."
if out_eps and os.access(out_eps, os.W_OK):
  try:
    os.remove(out_eps)
  except:
    print "Failed to remove the figure: continuing anyway..."
 
print "Executing the Box program..."
print commands.getoutput("%s %s" % (box, box_source))
 
have_figure = False
if out_eps and os.access(out_eps, os.R_OK):
                           (convert, convert_opts, out_eps, out_png))
 
print out_png
have_figure = os.access(out_png, os.R_OK)
 
if not have_figure:
  raise "The figure '%s' has not been produced: stopping here!" % out_png

src/b/o/boxc-HEAD/web/in/examples/create_example.py   boxc(Download)
  title = "Box example: %s" % crumb
 
print "Removing old figure if present..."
if out_eps and os.access(out_eps, os.W_OK):
  try:
    os.remove(out_eps)
  except:
    print "Failed to remove the figure: continuing anyway..."
 
print "Executing the Box program..."
print commands.getoutput("%s %s" % (box, box_source))
 
have_figure = False
if out_eps and os.access(out_eps, os.R_OK):
                           (convert, convert_opts, out_eps, out_png))
 
print out_png
have_figure = os.access(out_png, os.R_OK)
 
if not have_figure:
  raise "The figure '%s' has not been produced: stopping here!" % out_png

src/b/o/boodler-HEAD/core/branch/rel_2_0_2/src/boodle/sample.py   boodler(Download)
        suffix = sname.suffix
    elif (isinstance(sname, boopak.pinfo.File)):
        filename = sname
        if (not os.access(sname.pathname, os.R_OK)):
            raise SampleError('file not readable: ' + sname.pathname)
        (dummy, suffix) = os.path.splitext(sname.pathname)
    elif (not (type(sname) in [str, unicode])):
        raise SampleError('not a File or filename')
    elif (os.path.isabs(sname)):
        filename = sname
        if (not os.access(filename, os.R_OK)):
    else:
        for dir in sound_dirs:
            filename = os.path.join(dir, sname)
            if (os.access(filename, os.R_OK)):
                (dummy, suffix) = os.path.splitext(filename)
                break
        else:

src/b/o/boodler-HEAD/core/branch/rel_2_0_1/src/boodle/sample.py   boodler(Download)
        suffix = sname.suffix
    elif (isinstance(sname, boopak.pinfo.File)):
        filename = sname
        if (not os.access(sname.pathname, os.R_OK)):
            raise SampleError('file not readable: ' + sname.pathname)
        (dummy, suffix) = os.path.splitext(sname.pathname)
    elif (not (type(sname) in [str, unicode])):
        raise SampleError('not a File or filename')
    elif (os.path.isabs(sname)):
        filename = sname
        if (not os.access(filename, os.R_OK)):
    else:
        for dir in sound_dirs:
            filename = os.path.join(dir, sname)
            if (os.access(filename, os.R_OK)):
                (dummy, suffix) = os.path.splitext(filename)
                break
        else:

src/b/o/boodler-HEAD/core/branch/rel_2_0_0/src/boodle/sample.py   boodler(Download)
        suffix = sname.suffix
    elif (isinstance(sname, boopak.pinfo.File)):
        filename = sname
        if (not os.access(sname.pathname, os.R_OK)):
            raise SampleError('file not readable: ' + sname.pathname)
        (dummy, suffix) = os.path.splitext(sname.pathname)
    elif (not (type(sname) in [str, unicode])):
        raise SampleError('not a File or filename')
    elif (os.path.isabs(sname)):
        filename = sname
        if (not os.access(filename, os.R_OK)):
    else:
        for dir in sound_dirs:
            filename = os.path.join(dir, sname)
            if (os.access(filename, os.R_OK)):
                (dummy, suffix) = os.path.splitext(filename)
                break
        else:

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next