def clear_allow_repeat_items(self): """reset allow repeat itmes to default value""" if (self.get_allow_repeat_items_metadata().is_read_only() or self.get_allow_repeat_items_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['allowRepeatItems'] = \ bool(self._allow_repeat_items_metadata['default_boolean_values'][0])
def clear_choice_ids(self): """stub""" if (self.get_choice_ids_metadata().is_read_only() or self.get_choice_ids_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['choiceIds'] = \ self._choice_ids_metadata['default_object_values'][0]
def set_item_bank_id(self, bank_id): """the assessment bank in which to search for items, such as related to an objective""" if self.get_item_bank_id_metadata().is_read_only(): raise NoAccess() if not self.my_osid_object_form._is_valid_id(bank_id): raise InvalidArgument() self.my_osid_object_form._my_map['itemBankId'] = str(bank_id)
def clear_source(self): """stub""" if (self.get_source_metadata().is_read_only() or self.get_source_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['texts']['source'] = \ self._source_metadata['default_string_values'][0]
def clear_max_attempts(self): """stub""" if (self.get_max_attempts_metadata().is_read_only() or self.get_max_attempts_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['maxAttempts'] = \ list(self._max_attempts_metadata['default_integer_values'])[0]
def clear_published(self): """stub""" if (self.get_published_metadata().is_read_only() or self.get_published_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['published'] = \ self._published_metadata['default_published_values'][0]
def clear_end_timestamp(self): """stub""" if (self.get_end_timestamp_metadata().is_read_only() or self.get_end_timestamp_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['endTimestamp'] = \ self.get_end_timestamp_metadata().get_default_integer_values()
def clear_first_angle_projection(self): """stub""" if (self.get_first_angle_projection_metadata().is_read_only() or self.get_first_angle_projection_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['firstAngle'] = \ self._first_angle_metadata['default_boolean_values'][0]
def clear_max_string_length(self): """stub""" if (self.get_max_string_length_metadata().is_read_only() or self.get_max_string_length_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['maxStringLength'] = \ self.get_max_string_length_metadata().get_default_cardinal_values()[0]
def set_allow_repeat_items(self, allow_repeat_items): """determines if repeat items will be shown, or if the scaffold iteration will simply stop""" if self.get_allow_repeat_items_metadata().is_read_only(): raise NoAccess() if not self.my_osid_object_form._is_valid_boolean(allow_repeat_items): raise InvalidArgument() self.my_osid_object_form._my_map[ 'allowRepeatItems'] = allow_repeat_items
def set_waypoint_quota(self, waypoint_quota): """how many waypoint questions need to be answered correctly""" if self.get_waypoint_quota_metadata().is_read_only(): raise NoAccess() if not self.my_osid_object_form._is_valid_cardinal( waypoint_quota, self.get_waypoint_quota_metadata()): raise InvalidArgument() self.my_osid_object_form._my_map['waypointQuota'] = waypoint_quota
def clear_angle_values(self): """stub""" if (self.get_euler_rotation_values_metadata().is_read_only() or self.get_euler_rotation_values_metadata().is_required()): raise NoAccess() self.clear_integer_value('xAngle') self.clear_integer_value('yAngle') self.clear_integer_value('zAngle')
def clear_face_values(self): """stub""" if (self.get_face_values_metadata().is_read_only() or self.get_face_values_metadata().is_required()): raise NoAccess() self.clear_integer_value('frontFaceValue') self.clear_integer_value('sideFaceValue') self.clear_integer_value('topFaceValue')
def clear_ortho_view_set(self): """stub""" if (self.get_ortho_view_set_metadata().is_read_only() or self.get_ortho_view_set_metadata().is_required()): raise NoAccess() self.clear_file('frontView') self.clear_file('sideView') self.clear_file('topView')
def set_first_angle_projection(self, value=None): """stub""" if value is None: raise NullArgument() if self.get_first_angle_projection_metadata().is_read_only(): raise NoAccess() if not self.my_osid_object_form._is_valid_boolean(value): raise InvalidArgument() self.my_osid_object_form._my_map['firstAngle'] = value
def set_max_waypoint_items(self, max_waypoint_items): """This determines how many waypoint items will be seen for a scaffolded wrong answer""" if self.get_max_waypoint_items_metadata().is_read_only(): raise NoAccess() if not self.my_osid_object_form._is_valid_cardinal( max_waypoint_items, self.get_max_waypoint_items_metadata()): raise InvalidArgument() self.my_osid_object_form._my_map[ 'maxWaypointItems'] = max_waypoint_items
def set_published(self, value=None): """stub""" if value is None: raise NullArgument() if self.get_published_metadata().is_read_only(): raise NoAccess() if not self.my_osid_object_form._is_valid_boolean(value): raise InvalidArgument() self.my_osid_object_form._my_map['published'] = value
def edit_feedback(self, new_feedback): if self.get_feedbacks_metadata().is_read_only(): raise NoAccess() if not isinstance(new_feedback, DisplayText): raise InvalidArgument('new feedback is not a DisplayText object') index = self.get_index_of_language_type('feedbacks', new_feedback.language_type) self.my_osid_object_form._my_map['feedbacks'][ index] = self._dict_display_text(new_feedback)
def clear_choice_ids(self, inline_region): """stub""" if (self.get_choice_ids_metadata().is_read_only() or self.get_choice_ids_metadata().is_required()): raise NoAccess() if inline_region in self.my_osid_object_form._my_map['inlineRegions']: self.my_osid_object_form._my_map['inlineRegions'][inline_region]['choiceIds'] = \ deepcopy(self._choice_ids_metadata['default_object_values'][0]) else: raise IllegalState('that inline region is invalid')
def set_end_timestamp(self, end_timestamp=None): """stub""" if end_timestamp is None: raise NullArgument() if self.get_end_timestamp_metadata().is_read_only(): raise NoAccess() if not self.my_osid_object_form._is_valid_integer( end_timestamp, self.get_end_timestamp_metadata()): raise InvalidArgument() self.my_osid_object_form._my_map['endTimestamp'] = end_timestamp
def set_max_string_length(self, length=None): """stub""" if self.get_max_string_length_metadata().is_read_only(): raise NoAccess() if length is not None and not self.my_osid_object_form._is_valid_cardinal( length, self.get_max_string_length_metadata()): raise InvalidArgument() if self._min_string_length is not None and length < self._min_string_length + 1: raise InvalidArgument() self.my_osid_object_form._my_map['maxStringLength'] = length self._max_string_length = length
def clear_choice_texts(self, choice_id, inline_region): if self.get_choices_metadata().is_read_only(): raise NoAccess() updated_choices = [] for current_choice in self.my_osid_object_form._my_map['choices'][inline_region]: if current_choice['id'] != choice_id: updated_choices.append(current_choice) else: updated_choices.append({ 'id': current_choice['id'], 'texts': [], 'name': current_choice['name'] }) self.my_osid_object_form._my_map['choices'][inline_region] = updated_choices
def remove_choice_language(self, language_type, choice_id): if self.get_choices_metadata().is_read_only(): raise NoAccess() choices = [ c for c in self.my_osid_object_form._my_map['choices'] if c['id'] == choice_id ] if len(choices) == 0: raise InvalidArgument('invalid choice_id') for current_choice in self.my_osid_object_form._my_map['choices']: if choice_id == current_choice['id']: self.remove_field_by_language('texts', language_type, dictionary=current_choice)
def set_item_ids(self, item_ids): '''the target Item This can only be set if there is no learning objective set ''' if self.get_item_ids_metadata().is_read_only(): raise NoAccess() for item_id in item_ids: if not self.my_osid_object_form._is_valid_id(item_id): raise InvalidArgument() if self.my_osid_object_form._my_map['learningObjectiveIds'][0]: raise IllegalState() self.my_osid_object_form._my_map['itemIds'] = [ str(i) for i in item_ids ]
def remove_choice_language(self, language_type, choice_id, inline_region): """stub""" if len(self.my_osid_object_form._my_map['choices'][inline_region]) == 0: raise IllegalState('there are currently no choices defined for this region') if self.get_choices_metadata().is_read_only(): raise NoAccess() choices = [c for c in self.my_osid_object_form._my_map['choices'][inline_region] if c['id'] == choice_id] if len(choices) == 0: raise InvalidArgument('invalid choice_id') for current_choice in self.my_osid_object_form._my_map['choices'][inline_region]: if choice_id == current_choice['id']: self.remove_field_by_language('texts', language_type, current_choice)
def set_learning_objective_ids(self, learning_objective_ids): """the learning objective to find related items for This can only be set if there are no items specifically set """ if self.get_learning_objective_ids_metadata().is_read_only(): raise NoAccess() for learning_objective_id in learning_objective_ids: if not self.my_osid_object_form._is_valid_id( learning_objective_id): raise InvalidArgument() if self.my_osid_object_form._my_map['itemIds'][0]: raise IllegalState() self.my_osid_object_form._my_map['learningObjectiveIds'] = [ str(lo) for lo in learning_objective_ids ]
def edit_choice(self, new_choice, choice_id): if self.get_choices_metadata().is_read_only(): raise NoAccess() if not isinstance(new_choice, DisplayText): raise InvalidArgument('new choice is not a DisplayText object') choices = [ c for c in self.my_osid_object_form._my_map['choices'] if c['id'] == choice_id ] if len(choices) == 0: raise InvalidArgument('invalid choice_id') for current_choice in self.my_osid_object_form._my_map['choices']: if choice_id == current_choice['id']: index = self.get_index_of_language_type( 'texts', new_choice.language_type, dictionary=current_choice) current_choice['texts'][index] = self._dict_display_text( new_choice)
def remove_feedback_language(self, language_type): if self.get_feedbacks_metadata().is_read_only(): raise NoAccess() self.remove_field_by_language('feedbacks', language_type)
def clear_feedbacks(self): """stub""" if self.get_feedbacks_metadata().is_read_only(): raise NoAccess() self.my_osid_object_form._my_map['feedbacks'] = \ self._feedbacks_metadata['default_object_values'][0]
def clear_choices(self, inline_region): if self.get_choices_metadata().is_read_only(): raise NoAccess() self.my_osid_object_form._my_map['choices'][inline_region] = \ self._choices_metadata['default_object_values'][0]