def __init__(self): self.title = u"" self.firstname = u"Name" self.lastname = u"Lastname" self.photo = QUESTION_MARK() self.email = u"email" # dictionary of file. {att_name : att_value} self.custom_attributes = {} AbstractPersonalData.__init__(self)
def set_title(self, title): if AbstractPersonalData.set_title(self, title) is False: return False self.title = title return self.title
def set_pseudo(self, pseudo): if AbstractPersonalData.set_pseudo(self, pseudo) is False: return False self.pseudo = pseudo return self.pseudo
def remove_custom_attributes(self, value): """sets new value for custom_attributes""" AbstractPersonalData.remove_custom_attributes(self, value) if self.config.has_option(SECTION_CUSTOM, value): self.config.remove_option(SECTION_CUSTOM, value)
def set_pseudo(self, pseudo): AbstractPersonalData.set_pseudo(self, pseudo) self.config.set(SECTION_PERSONAL, "pseudo", pseudo.encode(self.encoding)) return pseudo.encode(self.encoding)
def remove_custom_attributes(self, key): AbstractPersonalData.remove_custom_attributes(self, key) if self.config.has_option(SECTION_CUSTOM, key): self.config.remove_option(SECTION_CUSTOM, key)
def set_email(self, value): AbstractPersonalData.set_email(self, value) self.config.set(SECTION_PERSONAL, "email", value.encode(self.encoding)) return value.encode(self.encoding)
def set_photo(self, path): if AbstractPersonalData.set_photo(self, path) is False: return False self.photo = path return self.photo
def set_title(self, value): """sets new value for title""" if AbstractPersonalData.set_title(self, value) is False: return False self.title = value return self.title
def add_custom_attributes(self, pair): """sets new value for custom_attributes""" AbstractPersonalData.add_custom_attributes(self, pair) key, value = pair self.custom_attributes[key] = value
def remove_custom_attributes(self, value): """sets new value for custom_attributes""" AbstractPersonalData.remove_custom_attributes(self, value) if self.custom_attributes.has_key(value): del self.custom_attributes[value]
def set_photo(self, value): """sets new value for photo""" AbstractPersonalData.set_photo(self, value) self.config.set(SECTION_PERSONAL, "photo", value.encode(self.encoding)) return value.encode(self.encoding)
def set_firstname(self, value): """sets new value for firstname""" AbstractPersonalData.set_firstname(self, value) self.config.set(SECTION_PERSONAL, "firstname", value.encode(self.encoding)) return value.encode(self.encoding)
def __init__(self, pseudo): self.config.add_section(SECTION_PERSONAL) self.config.set(SECTION_PERSONAL, "pseudo", pseudo.encode(self.encoding)) self.config.add_section(SECTION_CUSTOM) AbstractPersonalData.__init__(self)
def set_firstname(self, firstname): """sets new value for firstname""" if AbstractPersonalData.set_firstname(self, firstname) is False: return False self.firstname = firstname return self.firstname
def set_lastname(self, value): """sets new value for lastname""" if AbstractPersonalData.set_lastname(self, value) is False: return False self.lastname = value return self.lastname
def set_lastname(self, lastname): if AbstractPersonalData.set_lastname(self, lastname) is False: return False self.lastname = lastname return self.lastname
def set_photo(self, value): """sets new value for photo""" if AbstractPersonalData.set_photo(self, value) is False: return False self.photo = value return self.photo
def set_email(self, email): if AbstractPersonalData.set_email(self, email) is False: return False self.email = email return self.email
def set_email(self, value): """sets new value for email""" if AbstractPersonalData.set_email(self, value) is False: return False self.email = value return self.email
def add_custom_attributes(self, key, value): AbstractPersonalData.add_custom_attributes(self, key, value) self.config.set(SECTION_CUSTOM, key, value.encode(self.encoding))
def add_custom_attributes(self, key, value): AbstractPersonalData.add_custom_attributes(self, key, value) self.custom_attributes[key] = value
def __init__(self): self.config.add_section(SECTION_PERSONAL) self.config.add_section(SECTION_CUSTOM) AbstractPersonalData.__init__(self)
def remove_custom_attributes(self, key): AbstractPersonalData.remove_custom_attributes(self, key) if self.custom_attributes.has_key(key): del self.custom_attributes[key]
def set_lastname(self, value): AbstractPersonalData.set_lastname(self, value) self.config.set(SECTION_PERSONAL, "lastname", value.encode(self.encoding)) return value.encode(self.encoding)
def add_custom_attributes(self, pair): """sets new value for custom_attributes""" AbstractPersonalData.add_custom_attributes(self, pair) key, value = pair self.config.set(SECTION_CUSTOM, key, value.encode(self.encoding))