def clear_display_label(self): """Clears the display label. raise: NoAccess - ``display_label`` cannot be modified *compliance: mandatory -- This method must be implemented.* """ if (self.get_display_label_metadata().is_read_only() or self.get_display_label_metadata().is_required()): raise errors.NoAccess() self._my_map['displayLabel'] = self._display_label_metadata[ 'default_string_values'][0]
def clear_description(self): """Clears the description. raise: NoAccess - ``description`` cannot be modified *compliance: mandatory -- This method must be implemented.* """ if (self.get_domain_metadata().is_read_only() or self.get_domain_metadata().is_required()): raise errors.NoAccess() self._my_map['domain'] = self._domain_metadata[ 'default_string_values'][0]
def clear_allocated_time(self): """Clears the allocated time. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.assessment.AssessmentOfferedForm.clear_duration_template if (self.get_allocated_time_metadata().is_read_only() or self.get_allocated_time_metadata().is_required()): raise errors.NoAccess() self._my_map['allocatedTime'] = self._allocated_time_default
def clear_avatar(self): """Clears the asset. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.clear_avatar_template if (self.get_avatar_metadata().is_read_only() or self.get_avatar_metadata().is_required()): raise errors.NoAccess() self._my_map['avatarId'] = self._avatar_default
def clear_priority(self): """Removes the priority. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.logging.LogEntryForm.clear_priority_template if (self.get_priority_metadata().is_read_only() or self.get_priority_metadata().is_required()): raise errors.NoAccess() self._my_map['priority'] = self._priority_default
def clear_text(self): """Clears the text. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.repository.AssetForm.clear_title_template if (self.get_text_metadata().is_read_only() or self.get_text_metadata().is_required()): raise errors.NoAccess() self._my_map['text'] = dict(self._text_default)
def set_avatar(self, asset_id): """Sets the avatar asset. arg: asset_id (osid.id.Id): an asset ``Id`` raise: InvalidArgument - ``asset_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.set_avatar_template if self.get_avatar_metadata().is_read_only(): raise errors.NoAccess() if not self._is_valid_id(asset_id): raise errors.InvalidArgument() self._my_map['avatarId'] = str(asset_id)
def set_domain(self, domain): """Sets a domain. arg: domain (string): the new domain raise: InvalidArgument - ``domain`` is invalid raise: NoAccess - ``domain`` cannot be modified raise: NullArgument - ``domain`` is ``null`` *compliance: mandatory -- This method must be implemented.* """ if self.get_domain_metadata().is_read_only(): raise errors.NoAccess() if not self._is_valid_string(domain, self.get_domain_metadata()): raise errors.InvalidArgument() self._my_map['domain']['text'] = domain
def set_rating(self, grade_id): """Sets the rating. arg: grade_id (osid.id.Id): the new rating raise: InvalidArgument - ``grade_id`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``grade_id`` is ``null`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.set_avatar_template if self.get_rating_metadata().is_read_only(): raise errors.NoAccess() if not self._is_valid_id(grade_id): raise errors.InvalidArgument() self._my_map['ratingId'] = str(grade_id)
def set_priority(self, priority): """Sets the priority. arg: priority (osid.type.Type): the new priority raise: InvalidArgument - ``priority`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``priority`` is ``null`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.logging.LogEntryForm.set_priority if self.get_priority_metadata().is_read_only(): raise errors.NoAccess() if not self._is_valid_type(priority): raise errors.InvalidArgument() self._my_map['priority'] = str(priority)
def set_group(self, group): """Sets the resource as a group. arg: group (boolean): ``true`` if this resource is a group, ``false`` otherwise raise: InvalidArgument - ``group`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.set_group_template if self.get_group_metadata().is_read_only(): raise errors.NoAccess() if not self._is_valid_boolean(group): raise errors.InvalidArgument() self._my_map['group'] = group
def set_display_label(self, display_label): """Seta a display label. arg: display_label (string): the new display label raise: InvalidArgument - ``display_label`` is invalid raise: NoAccess - ``display_label`` cannot be modified raise: NullArgument - ``display_label`` is ``null`` *compliance: mandatory -- This method must be implemented.* """ if self.get_display_label_metadata().is_read_only(): raise errors.NoAccess() if not self._is_valid_string(display_label, self.get_display_label_metadata()): raise errors.InvalidArgument() self._my_map['displayLabel']['text'] = display_label
def clear_children(self): """Clears the children. raise: NoAccess - ``Metadata.isRequired()`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if not self._supports_simple_sequencing(): raise AttributeError( 'This Assessment Part does not support simple child sequencing' ) if (self.get_children_metadata().is_read_only() or self.get_children_metadata().is_required()): raise errors.NoAccess() self._my_map['childIds'] = self._children_default
def set_cumulative(self, cumulative): """Applies this rule to all previous assessment parts. arg: cumulative (boolean): ``true`` to apply to all previous assessment parts. ``false`` to apply to the immediate previous assessment part raise: InvalidArgument - ``cumulative`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.resource.ResourceForm.set_group_template if self.get_cumulative_metadata().is_read_only(): raise errors.NoAccess() if not self._is_valid_boolean(cumulative): raise errors.InvalidArgument() self._my_map['cumulative'] = cumulative
def set_timestamp(self, timestamp): """Sets the timestamp. arg: timestamp (osid.calendaring.DateTime): the new timestamp raise: InvalidArgument - ``timestamp`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``timestamp`` is ``null`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.assessment.AssessmentOfferedForm.set_start_time_template if self.get_timestamp_metadata().is_read_only(): raise errors.NoAccess() if not self._is_valid_date_time( timestamp, self.get_timestamp_metadata()): raise errors.InvalidArgument() self._my_map['timestamp'] = timestamp
def set_allocated_time(self, time): """Sets the allocated time. arg: time (osid.calendaring.Duration): the allocated time raise: InvalidArgument - ``time`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.assessment.AssessmentOfferedForm.set_duration_template if self.get_allocated_time_metadata().is_read_only(): raise errors.NoAccess() if not self._is_valid_duration(time, self.get_allocated_time_metadata()): raise errors.InvalidArgument() map = dict() map['days'] = time.days map['seconds'] = time.seconds map['microseconds'] = time.microseconds self._my_map['allocatedTime'] = map
def set_children(self, child_ids): """Sets the children. arg: child_ids (osid.id.Id[]): the children``Ids`` raise: InvalidArgument - ``child_ids`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ if not self._supports_simple_sequencing(): raise AttributeError( 'This Assessment Part does not support simple child sequencing' ) if not isinstance(child_ids, list): raise errors.InvalidArgument() if self.get_children_metadata().is_read_only(): raise errors.NoAccess() idstr_list = [] for object_id in child_ids: if not self._is_valid_id(object_id): raise errors.InvalidArgument() if str(object_id) not in idstr_list: idstr_list.append(str(object_id)) self._my_map['childIds'] = idstr_list