def _to_python(self, value_dict, state): sl = syslanguage active_cultures = sl.active_record_cultures() if self.record_cultures else sl.active_cultures() culture_fields = set(x.replace('-', '_') for x in active_cultures) existing_fields = set(self.fields.keys()) for field in existing_fields - culture_fields: if field not in culture_fields: del self.fields[field] for field in culture_fields - existing_fields: self.fields[field] = self.validator retval = Schema._to_python(self, value_dict, state) if self.delete_empty: retval = DeleteKeyIfEmpty().to_python(retval, state) return retval
def _to_python(self, value_dict, state): sl = syslanguage active_cultures = (sl.active_record_cultures() if self.record_cultures else sl.active_cultures()) culture_fields = {x.replace("-", "_") for x in active_cultures} existing_fields = set(self.fields.keys()) for field in existing_fields - culture_fields: if field not in culture_fields: del self.fields[field] for field in culture_fields - existing_fields: self.fields[field] = self.validator retval = Schema._to_python(self, value_dict, state) if self.delete_empty: retval = DeleteKeyIfEmpty().to_python(retval, state) return retval
def _to_python(self, value_dict, state): return Schema._to_python(self, value_dict, getattr(self, 'dao', state))