code
stringlengths
1
18.2k
def get_gradebook_column_admin_session(self): """Gets the ``OsidSession`` associated with the gradebook column administration service. return: (osid.grading.GradebookColumnAdminSession) - a ``GradebookColumnAdminSession`` raise: OperationFailed - unable to complete request raise: Unimplemented - ``supports_gradebook_co...
def get_gradebook_column_admin_session_for_gradebook(self, gradebook_id): """Gets the ``OsidSession`` associated with the gradebook column admin service for the given gradebook. arg: gradebook_id (osid.id.Id): the ``Id`` of the gradebook return: (osid.grading.GradebookColumnAdminSession) - ``a GradebookColumnAdminSessi...
def get_gradebook_column_gradebook_session(self): """Gets the session for retrieving gradebook column to gradebook mappings. return: (osid.grading.GradebookColumnGradebookSession) - a ``GradebookColumnGradebookSession`` raise: OperationFailed - unable to complete request raise: Unimplemented - ``supports_gradebook_colu...
def get_grade_system_lookup_session(self, proxy): """Gets the ``OsidSession`` associated with the grade system lookup service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradeSystemLookupSession) - a ``GradeSystemLookupSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unab...
def get_grade_system_lookup_session_for_gradebook(self, gradebook_id, proxy): """Gets the ``OsidSession`` associated with the grade system lookup service for the given gradebook. arg: gradebook_id (osid.id.Id): the ``Id`` of the gradebook arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradeSystemLookupSes...
def get_grade_system_admin_session_for_gradebook(self, gradebook_id, proxy): """Gets the ``OsidSession`` associated with the grade system admin service for the given gradebook. arg: gradebook_id (osid.id.Id): the ``Id`` of the gradebook arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradeSystemAdminSessio...
def get_grade_system_gradebook_session(self, proxy): """Gets the session for retrieving grade system to gradebook mappings. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradeSystemGradebookSession) - a ``GradeSystemGradebookSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - u...
def get_grade_system_gradebook_assignment_session(self, proxy): """Gets the session for assigning grade system to gradebook mappings. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradeSystemGradebookSession) - a ``GradeSystemGradebookAssignmentSession`` raise: NullArgument - ``proxy`` is ``null`` raise:...
def get_grade_entry_lookup_session(self, proxy): """Gets the ``OsidSession`` associated with the grade entry lookup service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradeEntryLookupSession) - a ``GradeEntryLookupSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable t...
def get_grade_entry_lookup_session_for_gradebook(self, gradebook_id, proxy): """Gets the ``OsidSession`` associated with the grade entry lookup service for the given gradebook. arg: gradebook_id (osid.id.Id): the ``Id`` of the gradebook arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradeEntryLookupSessio...
def get_grade_entry_admin_session_for_gradebook(self, gradebook_id, proxy): """Gets the ``OsidSession`` associated with the grade entry admin service for the given gradebook. arg: gradebook_id (osid.id.Id): the ``Id`` of the gradebook arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradeEntryAdminSession) ...
def get_gradebook_column_lookup_session(self, proxy): """Gets the ``OsidSession`` associated with the gradebook column lookup service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradebookColumnLookupSession) - a ``GradebookColumnLookupSession`` raise: NullArgument - ``proxy`` is ``null`` raise: Operat...
def get_gradebook_column_lookup_session_for_gradebook(self, gradebook_id, proxy): """Gets the ``OsidSession`` associated with the gradebook column lookup service for the given gradebook. arg: gradebook_id (osid.id.Id): the ``Id`` of the gradebook arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradebookCol...
def get_gradebook_column_query_session(self, proxy): """Gets the ``OsidSession`` associated with the gradebook column query service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradebookColumnQuerySession) - a ``GradebookColumnQuerySession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationF...
def get_gradebook_column_query_session_for_gradebook(self, gradebook_id, proxy): """Gets the ``OsidSession`` associated with the gradebook column query service for the given gradebook. arg: gradebook_id (osid.id.Id): the ``Id`` of the gradebook arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradebookColum...
def get_gradebook_column_gradebook_assignment_session(self, proxy): """Gets the session for assigning gradebook column to gradebook mappings. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradebookColumnGradebookAssignmentSession) - a ``GradebookColumnGradebookAssignmentSession`` raise: NullArgument - ``...
def get_gradebook_lookup_session(self, proxy): """Gets the OsidSession associated with the gradebook lookup service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradebookLookupSession) - a ``GradebookLookupSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable to complete...
def get_gradebook_admin_session(self, proxy): """Gets the OsidSession associated with the gradebook administration service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradebookAdminSession) - a ``GradebookAdminSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable to com...
def get_gradebook_hierarchy_session(self, proxy): """Gets the session traversing gradebook hierarchies. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradebookHierarchySession) - a ``GradebookHierarchySession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable to complete reques...
def get_gradebook_hierarchy_design_session(self, proxy): """Gets the session designing gradebook hierarchies. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.grading.GradebookHierarchyDesignSession) - a ``GradebookHierarchyDesignSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable ...
def _set_hierarchy_view(self, session): """Sets the underlying hierarchy view to match current view""" if self._hierarchy_view == COMPARATIVE: try: session.use_comparative_hierarchy_view() except AttributeError: pass else: try: session.use_plenary_hierarchy_view() except AttributeError: pass
def _instantiate_session(self, method_name, proxy=None, *args, **kwargs): """Instantiates a provider session""" if 'manager' in kwargs: session_class = getattr(kwargs['manager'], method_name) del kwargs['manager'] else: session_class = getattr(self._provider_manager, method_name) if proxy is None: try: return session_c...
def use_comparative_hierarchy_view(self): """Pass through to provider HierarchyLookupSession.use_comparative_hierarchy_view""" self._hierarchy_view = COMPARATIVE # self._get_provider_session('hierarchy_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: session.use_...
def use_plenary_hierarchy_view(self): """Pass through to provider HierarchyLookupSession.use_plenary_hierarchy_view""" self._hierarchy_view = PLENARY # self._get_provider_session('hierarchy_lookup_session') # To make sure the session is tracked for session in self._get_provider_sessions(): try: session.use_plenary_hier...
def get_hierarchies_by_ids(self, *args, **kwargs): """Pass through to provider HierarchyLookupSession.get_hierarchies_by_ids""" # Implemented from kitosid template for - # osid.resource.BinLookupSession.get_bins_by_ids catalogs = self._get_provider_session('hierarchy_lookup_session').get_hierarchies_by_ids(*args, **kwa...
def get_hierarchies(self): """Pass through to provider HierarchyLookupSession.get_hierarchies""" # Implemented from kitosid template for - # osid.resource.BinLookupSession.get_bins_template catalogs = self._get_provider_session('hierarchy_lookup_session').get_hierarchies() cat_list = [] for cat in catalogs: cat_list.ap...
def create_hierarchy(self, *args, **kwargs): """Pass through to provider HierarchyAdminSession.create_hierarchy""" # Implemented from kitosid template for - # osid.resource.BinAdminSession.create_bin return Hierarchy( self._provider_manager, self._get_provider_session('hierarchy_admin_session').create_hierarchy(*args, ...
def get_hierarchy_form(self, *args, **kwargs): """Pass through to provider HierarchyAdminSession.get_hierarchy_form_for_update""" # Implemented from kitosid template for - # osid.resource.BinAdminSession.get_bin_form_for_update_template # This method might be a bit sketchy. Time will tell. if isinstance(args[-1], list)...
def save_hierarchy(self, hierarchy_form, *args, **kwargs): """Pass through to provider HierarchyAdminSession.update_hierarchy""" # Implemented from kitosid template for - # osid.resource.BinAdminSession.update_bin if hierarchy_form.is_for_update(): return self.update_hierarchy(hierarchy_form, *args, **kwargs) else: ret...
def _set_hierarchy_view(self, session): """Sets the underlying hierarchy view to match current view""" if self._hierarchy_view == FEDERATED: try: session.use_federated_hierarchy_view() except AttributeError: pass else: try: session.use_isolated_hierarchy_view() except AttributeError: pass
def _set_object_view(self, session): """Sets the underlying object views to match current view""" for obj_name in self._object_views: if self._object_views[obj_name] == PLENARY: try: getattr(session, 'use_plenary_' + obj_name + '_view')() except AttributeError: pass else: try: getattr(session, 'use_comparative_' + obj_...
def _set_operable_view(self, session): """Sets the underlying operable views to match current view""" for obj_name in self._operable_views: if self._operable_views[obj_name] == ACTIVE: try: getattr(session, 'use_active_' + obj_name + '_view')() except AttributeError: pass else: try: getattr(session, 'use_any_status_' +...
def _set_containable_view(self, session): """Sets the underlying containable views to match current view""" for obj_name in self._containable_views: if self._containable_views[obj_name] == SEQUESTERED: try: getattr(session, 'use_sequestered_' + obj_name + '_view')() except AttributeError: pass else: try: getattr(sessio...
def host_context(func): "Sets the context of the setting to the current host" @wraps(func) def decorator(*args, **kwargs): hosts = get_hosts_settings() with settings(**hosts[env.host]): return func(*args, **kwargs) return decorator
def merge_commit(commit): "Fetches the latest code and merges up the specified commit." with cd(env.path): run('git fetch') if '@' in commit: branch, commit = commit.split('@') run('git checkout {0}'.format(branch)) run('git merge {0}'.format(commit))
def migrate(app_name=None, revision=None): "Syncs and migrates the database using South." cmd = ['python bin/manage.py syncdb --migrate'] if app_name: cmd.append(app_name) if revision: cmd.append(revision) verun(' '.join(cmd))
def reload_wsgi(): "Gets the PID for the wsgi process and sends a HUP signal." pid = run('supervisorctl pid varify-{host}'.format(host=env.host)) try: int(pid) sudo('kill -HUP {0}'.format(pid)) except (TypeError, ValueError): pass
def setup(): "Sets up the initial environment." parent, project = os.path.split(env.path) if not exists(parent): run('mkdir -p {0}'.format(parent)) run('virtualenv {0}'.format(parent)) with cd(parent): if not exists(project): run('git clone {repo_url} {project}'.format(project=project, **env))
def upload_settings(): "Uploads the non-versioned local settings to the server." local_path = os.path.join(curdir, 'settings/{0}.py'.format(env.host)) if os.path.exists(local_path): remote_path = os.path.join(env.path, 'varify/conf/local_settings.py') put(local_path, remote_path) elif not confirm(yellow('No local setti...
def send(template_name, sender=None, to=None, cc=None, bcc=None, subject='mail', attachments=(), html_template_name=None, context=None, headers=None, reply_to=None): """ Render and send an email. `template_name` is a plaintext template. If `html_template_name` is passed then a multipart email will be sent using `templa...
{}, } text_content = render_to_string(template_name, context) email_kwargs['body'] = text_content if html_template_name is None: msg = EmailMessage(**email_kwargs) else: msg = EmailMultiAlternatives(**email_kwargs) html_content = render_to_string(html_template_name, context) msg.attach_alternative(html_content, 'text/h...
def get_info(self, account, params={}): """ Gets account info. @param account: account to get info for @param params: parameters to retrieve @return: AccountInfo """ res = self.invoke(zconstant.NS_ZIMBRA_ADMIN_URL, sconstant.GetInfoRequest, params) return res
def _init_metadata(self): """stub""" self._source_assessment_taken_id_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'source_assessment_taken_id'), 'element_label': 'Source Assessment Taken ID that generated this one', 'instructions': 'accepts a valid OSID Id str...
def materialize_node(self, node, uri, content, meta=None): """ Set node uri and content from backend """ node.uri = uri node.content = content node.meta = meta if meta is not None else {}
def load_image(canvas, filepath, bounds=None): """Takes a tk.Canvas and a filepath, loads image into canvas""" image_data = Image.open(filepath) if bounds: image_data.thumbnail(bounds, PIL.Image.ANTIALIAS) canvas.image = ImageTk.PhotoImage(image_data) canvas.create_image(0, 0, image=canvas.image, anchor=tk.NW)
def load_image(self, imagepath, width=None, height=None): """Loads new image into canvas, updating size if needed.""" if width: self.width = width self.canvas["width"] = width if height: self.height = height self.canvas["height"] = height self.image = imagepath size = (self.width, self.height) load_image(self.canvas, s...
def _get_hierarchy_session(self, hierarchy_id): """Returns a hierarchy traversal session for the hierarchy""" hierarchy_mgr = self._get_provider_manager('HIERARCHY', local=True) return hierarchy_mgr.get_hierarchy_traversal_session_for_hierarchy( hierarchy_id, proxy=self._proxy)
def _caching_enabled(self): """Returns True if caching is enabled per configuration, false otherwise.""" try: config = self._runtime.get_configuration() parameter_id = Id('parameter:useCachingForQualifierIds@json') if config.get_value_by_parameter(parameter_id).get_boolean_value(): return True else: return False except...
def _get_parent_id_list(self, qualifier_id, hierarchy_id): """Returns list of parent id strings for qualifier_id in hierarchy. Uses memcache if caching is enabled. """ if self._caching_enabled(): key = 'parent_id_list_{0}'.format(str(qualifier_id)) # If configured to use memcache as the caching engine, use it. # Otherw...
as for memcache above. # However, for diskcache.Cache, we have to call ".close()" or use a # ``with`` statement to safeguard calling ".close()", so we keep this # separate from the memcache implementation. parent_id_list = cache.get(key) if parent_id_list is None: parent_ids = self._get_hierarchy_session(hierarchy_id)....
def is_authorized(self, agent_id, function_id, qualifier_id): """Determines if the given agent is authorized. An agent is authorized if an active authorization exists whose ``Agent,`` ``Function`` and ``Qualifier`` matches the supplied parameters. Authorizations may be defined using groupings or hieratchical structures...
``function_id`` or ``qualifier_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure making request *compliance: mandatory -- This method must be implemented.* *implementation notes*: Authorizations may be stored in a normalized form with respect to various...
hierarchy_id) if parent_id_list: try: collection.find_one( {'agentId': str(agent_id), 'functionId': str(function_id), 'qualifierId': {'$in': parent_id_list}}) except errors.NotFound: for parent_id in parent_id_list: if is_parent_authorized(Id(parent_id)): return True return False else: return True else: return False # ...
def get_authorization(self, authorization_id): """Gets the ``Authorization`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Authorization`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id`` was assigned to an `...
'authorization').get_identifier())}, **self._view_filter())) return objects.Authorization(osid_object_map=result, runtime=self._runtime, proxy=self._proxy)
def get_authorizations_by_ids(self, authorization_ids): """Gets an ``AuthorizationList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the authorizations specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id`` in the supp...
for # osid.resource.ResourceLookupSession.get_resources_by_ids # NOTE: This implementation currently ignores plenary view collection = JSONClientValidated('authorization', collection='Authorization', runtime=self._runtime) object_id_list = [] for i in authorization_ids: object_id_list.append(ObjectId(self._get_id(i, 'a...
def get_authorizations_by_genus_type(self, authorization_genus_type): """Gets an ``AuthorizationList`` corresponding to the given authorization genus ``Type`` which does not include authorizations of genus types derived from the specified ``Type``. In plenary mode, the returned list contains all known authorizations or...
def get_authorizations_on_date(self, from_, to): """Gets an ``AuthorizationList`` effective during the entire given date range inclusive but not confined to the date range. arg: from (osid.calendaring.DateTime): starting date arg: to (osid.calendaring.DateTime): ending date return: (osid.authorization.AuthorizationList...
def get_authorizations_for_function(self, function_id): """Gets a list of ``Authorizations`` associated with a given function. In plenary mode, the returned list contains all known authorizations or an error results. Otherwise, the returned list may contain only those authorizations that are accessible through this ses...
def get_authorizations_for_resource_and_function(self, resource_id, function_id): """Gets a list of ``Authorizations`` associated with a given resource. Authorizations related to the given resource, including those related through an ``Agent,`` are returned. In plenary mode, the returned list contains all known authori...
= collection.find( dict({'sourceId': str(resource_id), 'destinationId': str(function_id)}, **self._view_filter())).sort('_id', ASCENDING) return objects.AuthorizationList(result, runtime=self._runtime)
def get_authorizations_for_agent_and_function(self, agent_id, function_id): """Gets a list of ``Authorizations`` associated with a given agent. Authorizations related to the given resource, including those related through an ``Agent,`` are returned. In plenary mode, the returned list contains all known authorizations o...
def get_authorizations(self): """Geta all ``Authorizations``. In plenary mode, the returned list contains all known authorizations or an error results. Otherwise, the returned list may contain only those authorizations that are accessible through this session. return: (osid.authorization.AuthorizationList) - a list of ...
def get_authorizations_by_query(self, authorization_query): """Gets a list of ``Authorizations`` matching the given query. arg: authorization_query (osid.authorization.AuthorizationQuery): the authorization query return: (osid.authorization.AuthorizationList) - the returned ``AuthorizationList`` raise: NullArgument - `...
result = [] return objects.AuthorizationList(result, runtime=self._runtime, proxy=self._proxy)
def get_authorization_form_for_create_for_agent(self, agent_id, function_id, qualifier_id, authorization_record_types): """Gets the authorization form for creating new authorizations. A new form should be requested for each create transaction. arg: agent_id (osid.id.Id): the agent ``Id`` arg: function_id (osid.id.Id): ...
a valid OSID Id') if not isinstance(qualifier_id, ABCId): raise errors.InvalidArgument('argument is not a valid OSID Id') for arg in authorization_record_types: if not isinstance(arg, ABCType): raise errors.InvalidArgument('one or more argument array elements is not a valid OSID Type') if authorization_record_types == ...
def create_authorization(self, authorization_form): """Creates a new explicit ``Authorization``. arg: authorization_form (osid.authorization.AuthorizationForm): the authorization form return: (osid.authorization.Authorization) - ``t`` he new ``Authorization`` raise: IllegalState - ``authorization_form`` already used in...
already used in a create transaction') except KeyError: raise errors.Unsupported('authorization_form did not originate from this session') if not authorization_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') # try to check first here try: osid_map = collection.find_one({"age...
def update_authorization(self, authorization_form): """Updates an existing authorization. arg: authorization_form (osid.authorization.AuthorizationForm): the authorization ``Id`` raise: IllegalState - ``authorization_form`` already used in an update transaction raise: InvalidArgument - one or more of the form elements ...
session') if not authorization_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') collection.save(authorization_form._my_map) self._forms[authorization_form.get_id().get_identifier()] = UPDATED # Note: this is out of spec. The OSIDs don't require an object to be returned: retur...
def delete_authorization(self, authorization_id): """Deletes the ``Authorization`` identified by the given ``Id``. arg: authorization_id (osid.id.Id): the ``Id`` of the ``Authorization`` to delete raise: NotFound - an ``Authorization`` was not found identified by the given ``Id`` raise: NullArgument - ``authorization_i...
def alias_authorization(self, authorization_id, alias_id): """Adds an ``Id`` to an ``Authorization`` for the purpose of creating compatibility. The primary ``Id`` of the ``Authorization`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another autho...
def use_comparative_vault_view(self): """The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision. *compliance: mandatory -- This method is must be i...
def use_plenary_vault_view(self): """A complete view of the ``Authorization`` and ``Vault`` returns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability. *compliance: mandatory -- This method is must be implemente...
def get_authorization_ids_by_vault(self, vault_id): """Gets the list of ``Authorization`` ``Ids`` associated with a ``Vault``. arg: vault_id (osid.id.Id): ``Id`` of a ``Vault`` return: (osid.id.IdList) - list of related authorization ``Ids`` raise: NotFound - ``vault_id`` is not found raise: NullArgument - ``vault_id``...
def get_authorizations_by_vault(self, vault_id): """Gets the list of ``Authorizations`` associated with a ``Vault``. arg: vault_id (osid.id.Id): ``Id`` of a ``Vault`` return: (osid.authorization.AuthorizationList) - list of related authorization raise: NotFound - ``vault_id`` is not found raise: NullArgument - ``vault_...
def get_authorizations_ids_by_vault(self, vault_ids): """Gets the list of ``Authorization Ids`` corresponding to a list of ``Vault`` objects. arg: vault_ids (osid.id.IdList): list of vault ``Ids`` return: (osid.id.IdList) - list of authorization ``Ids`` raise: NullArgument - ``vault_ids`` is ``null`` raise: OperationFa...
def get_vault_ids_by_authorization(self, authorization_id): """Gets the list of ``Vault`` ``Ids`` mapped to an ``Authorization``. arg: authorization_id (osid.id.Id): ``Id`` of an ``Authorization`` return: (osid.id.IdList) - list of vault ``Ids`` raise: NotFound - ``authorization_id`` is not found raise: NullArgument - ...
def get_assignable_vault_ids(self, vault_id): """Gets a list of vault including and under the given vault node in which any authorization can be assigned. arg: vault_id (osid.id.Id): the ``Id`` of the ``Vault`` return: (osid.id.IdList) - list of assignable vault ``Ids`` raise: NullArgument - ``vault_id`` is ``null`` ra...
def assign_authorization_to_vault(self, authorization_id, vault_id): """Adds an existing ``Authorization`` to a ``Vault``. arg: authorization_id (osid.id.Id): the ``Id`` of the ``Authorization`` arg: vault_id (osid.id.Id): the ``Id`` of the ``Vault`` raise: AlreadyExists - ``authorization_id`` is already assigned to ``...
def unassign_authorization_from_vault(self, authorization_id, vault_id): """Removes an ``Authorization`` from a ``Vault``. arg: authorization_id (osid.id.Id): the ``Id`` of the ``Authorization`` arg: vault_id (osid.id.Id): the ``Id`` of the ``Vault`` raise: NotFound - ``authorization_id`` or ``vault_id`` not found or `...
def reassign_authorization_to_vault(self, authorization_id, from_vault_id, to_vault_id): """Moves an ``Authorization`` from one ``Vault`` to another. Mappings to other ``Vaults`` are unaffected. arg: authorization_id (osid.id.Id): the ``Id`` of the ``Authorization`` arg: from_vault_id (osid.id.Id): the ``Id`` of the cu...
def get_vaults_by_genus_type(self, vault_genus_type): """Gets a ``VaultList`` corresponding to the given vault genus ``Type`` which does not include vaults of types derived from the specified ``Type``. In plenary mode, the returned list contains all known vaults or an error results. Otherwise, the returned list may con...
def get_vaults_by_query(self, vault_query): """Gets a list of ``Vault`` objects matching the given search. arg: vault_query (osid.authorization.VaultQuery): the vault query return: (osid.authorization.VaultList) - the returned ``VaultList`` raise: NullArgument - ``vault_query`` is ``null`` raise: OperationFailed - unab...
def can_create_vault_with_record_types(self, vault_record_types): """Tests if this user can create a single ``Vault`` using the desired record types. While ``AuthorizationManager.getVaultRecordTypes()`` can be used to examine which records are supported, this method tests which record(s) are required for creating a spe...
return self._catalog_session.can_create_catalog_with_record_types(catalog_record_types=vault_record_types) return True
def get_vault_form_for_create(self, vault_record_types): """Gets the vault form for creating new vaults. A new form should be requested for each create transaction. arg: vault_record_types (osid.type.Type[]): array of vault record types return: (osid.authorization.VaultForm) - the vault form raise: NullArgument - ``vau...
have proxy in form. else: result = objects.VaultForm( record_types=vault_record_types, runtime=self._runtime, effective_agent_id=self.get_effective_agent_id(), proxy=self._proxy) # Probably don't need effective agent id now that we have proxy in form. self._forms[result.get_id().get_identifier()] = not CREATED return r...
def create_vault(self, vault_form): """Creates a new ``Vault``. arg: vault_form (osid.authorization.VaultForm): the form for this ``Vault`` return: (osid.authorization.Vault) - the new ``Vault`` raise: IllegalState - ``vault_form`` already used in a create transaction raise: InvalidArgument - one or more of the form el...
used in a create transaction') except KeyError: raise errors.Unsupported('vault_form did not originate from this session') if not vault_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') insert_result = collection.insert_one(vault_form._my_map) self._forms[vault_form.get_id().g...
def get_vault_form_for_update(self, vault_id): """Gets the vault form for updating an existing vault. A new vault form should be requested for each update transaction. arg: vault_id (osid.id.Id): the ``Id`` of the ``Vault`` return: (osid.authorization.VaultForm) - the vault form raise: NotFound - ``vault_id`` is not fo...
def update_vault(self, vault_form): """Updates an existing vault. arg: vault_form (osid.authorization.VaultForm): the form containing the elements to be updated raise: IllegalState - ``vault_form`` already used in an update transaction raise: InvalidArgument - the form contains an invalid value raise: NullArgument - ``...
except KeyError: raise errors.Unsupported('vault_form did not originate from this session') if not vault_form.is_valid(): raise errors.InvalidArgument('one or more of the form elements is invalid') collection.save(vault_form._my_map) # save is deprecated - change to replace_one self._forms[vault_form.get_id().get_ident...
def delete_vault(self, vault_id): """Deletes a ``Vault``. arg: vault_id (osid.id.Id): the ``Id`` of the ``Vault`` to remove raise: NotFound - ``vault_id`` not found raise: NullArgument - ``vault_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure *complia...
def alias_vault(self, vault_id, alias_id): """Adds an ``Id`` to a ``Vault`` for the purpose of creating compatibility. The primary ``Id`` of the ``Vault`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another vault it is reassigned to the given va...
def get_root_vaults(self): """Gets the root vaults in this vault hierarchy. return: (osid.authorization.VaultList) - the root vaults raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure *compliance: mandatory -- This method is must be implemented.* """ # Implemented from t...
def has_parent_vaults(self, vault_id): """Tests if the ``Vault`` has any parents. arg: vault_id (osid.id.Id): a vault ``Id`` return: (boolean) - ``true`` if the vault has parents, ``false`` otherwise raise: NotFound - ``vault_id`` is not found raise: NullArgument - ``vault_id`` is ``null`` raise: OperationFailed - unab...
def is_parent_of_vault(self, id_, vault_id): """Tests if an ``Id`` is a direct parent of a vault. arg: id (osid.id.Id): an ``Id`` arg: vault_id (osid.id.Id): the ``Id`` of a vault return: (boolean) - ``true`` if this ``id`` is a parent of ``vault_id,`` ``false`` otherwise raise: NotFound - ``vault_id`` is not found rai...