def load(self, value): self._profile = db_api.get_profile_by_id(value) host_mappings = self._profile.get('host_mappings', []) for mapping in host_mappings.splitlines(): regexp, ip = self.MAPPING_SPLIT.split(mapping, maxsplit=1) self._host_mappings.append((regexp, ip)) return self._profile
def get(self, profile_id): profile = db_api.get_profile_by_id(profile_id) self.write(profile)