General

Interface General

class portal.vidispine.igeneral.Base(user=None, runas=None, *args, **kwargs)

Base interface object providing functions for setting up the interface for each API in the VidiREST

If user is not set, it will automatically fall back to the admin user defined in the config file.

provideUser()

Setup the user. This is so that we could pass the user of the system through to vidispine at a later date.

portal.vidispine.igeneral.performVSAPICall(func, args, vsapierror_templateorcode='404.html', servercommunicationerror_templatecode='500.html', notauthorized_templateorcode=None, exception_templateorcode=None, specific_log=None)

Performs an API call using the interface code It wraps the function together with the give arguments and handles the possible exceptions in a unified fashion

Args:
  • func: Function pointer to the API function.

  • args: Args to the function, either as a list or dictionary

  • vsapierror_templateorcode: Template to be used in case a VSAPIError occurs

  • servercommunicationerror_templatecode: Template to be used in case a ServerCommunication occurs

  • notauthorized_templateorcode: Template to be used in case the user is not authorized

  • exception_templateorcode: Template to be used in case in a generic exception

  • specific_log: If this action should be logged to a specific logger. If not set, the generic logger will be used.

Returns:
  • In case of success:

    {‘success’:True, ‘response’:[response of the API call] }

  • In case of failure:

    {‘success’:False, ‘templateorcode’:[template or code depending on the error], ‘extra_context’:[dictionary that contains the error], ‘exception’:[The actual exception object]}