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

def lib::userdb::UserDatabase::get_profile (   self,
  username,
  profile_location = True,
  ignore_default = False 
)

Look up the profile for a given username.

@username: the user whose profile location should be
returned.
@profile_location: whether the profile location should
be returned
@ignore_default: don't use the default profile if
no profile is explicitly set.

Return value: the location of the profile, which
should be in a suitable form for constructing a
ProfileStorage object, or the profile name if
@profile_location is False.

Definition at line 277 of file userdb.py.

00277                                                                                      :
        """Look up the profile for a given username.

        @username: the user whose profile location should be
        returned.
        @profile_location: whether the profile location should
        be returned
        @ignore_default: don't use the default profile if
        no profile is explicitly set.

        Return value: the location of the profile, which
        should be in a suitable form for constructing a
        ProfileStorage object, or the profile name if
        @profile_location is False.
        """
        user = None
        profile = self.__ldap_query ("profilemap", {"u":username, "h":socket.getfqdn()})
        if not profile:
            try:
                query = "/profiles/user[@name='%s']" % username
                user = self.doc.xpathEval(query)[0]
                profile = user.prop("profile")
            except:
                profile = None
      if not profile and not ignore_default:
          try:
              query = "/profiles/default[1][@profile]"
            user = self.doc.xpathEval(query)[0]
            profile = user.prop("profile")
          except:
              profile = None
        
        if not profile_location:
            return profile
        
        # TODO Check the resulting file path exists
        return self.__profile_name_to_location (profile, user)

    def __save_as(self, filename = None):


Generated by  Doxygen 1.6.0   Back to index