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

def lib::userdb::UserDatabase::set_profile (   self,
  username,
  profile 
)

Set the profile for a given username.

@username: the user whose profile location should be
set.
@profile: the location of the profile.

Definition at line 388 of file userdb.py.

00388                                              :
        """Set the profile for a given username.

        @username: the user whose profile location should be
        set.
        @profile: the location of the profile.
        """
        if profile is None:
            profile = ""
      self.modified = 0
      try:
          query = "/profiles/user[@name='%s']" % username
          user = self.doc.xpathEval(query)[0]
          oldprofile = user.prop("profile")
          if oldprofile != profile:
              user.setProp("profile", profile)
            self.modified = 1
      except:
          try:
            profiles = self.doc.xpathEval("/profiles")[0]
          except:
            raise UserDatabaseException(
                    _("File %s is not a profile configuration") %
                                           (self.file))
          try:
            user = profiles.newChild(None, "user", None)
            user.setProp("name", username)
            user.setProp("profile", profile)
          except:
            raise UserDatabaseException(
                    _("Failed to add user %s to profile configuration") %
                                           (username))
          self.modified = 1
      if self.modified == 1:
          self.__save_as()
      
    def get_profiles (self):


Generated by  Doxygen 1.6.0   Back to index