Logo Search packages:      
Sourcecode: jockey version File versions  Download package

def jockey::oslib::OSLib::is_admin (   self  )  [inherited]

Return True if the user is considered an administrator, i. e. should
be able to use --check and can install packages.

The default implementation considers the user an administrator if he
can write check_cache, and create its directory if it does not exist.

Definition at line 266 of file oslib.py.

00266                       :
        '''Return True if the user is considered an administrator, i. e. should
        be able to use --check and can install packages.
        
        The default implementation considers the user an administrator if he
        can write check_cache, and create its directory if it does not exist.
        '''
        if os.path.exists(self.check_cache):
            return os.access(self.check_cache, os.W_OK)

        # try to create the dir if it does not exist
        d = os.path.dirname(self.check_cache)
        try:
            if not os.path.isdir(d):
                os.makedirs(d)
        except (IOError, OSError):
            return False
        return os.access(d, os.W_OK)
        return os.access(d, os.W_OK)


Generated by  Doxygen 1.6.0   Back to index