tardis.tardis_portal.models package

Submodules

tardis.tardis_portal.models.access_control module

class tardis.tardis_portal.models.access_control.GroupAdmin(*args, **kwargs)

Bases: django.db.models.base.Model

GroupAdmin links the Django User and Group tables for group administrators

Attribute user:a forign key to the django.contrib.auth.models.User
Attribute group:
 a forign key to the django.contrib.auth.models.Group
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception GroupAdmin.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

GroupAdmin.group
GroupAdmin.objects = <django.db.models.manager.Manager object>
GroupAdmin.user
class tardis.tardis_portal.models.access_control.ObjectACL(*args, **kwargs)

Bases: django.db.models.base.Model

The ObjectACL (formerly ExperimentACL) table is the core of the Tardis Authorisation framework

Attribute pluginId:
 the the name of the auth plugin being used
Attribute entityId:
 a foreign key to auth plugins
Attribute object_type:
 a foreign key to ContentType
Attribute object_id:
 the primary key/id of the object_type
Attribute canRead:
 gives the user read access
Attribute canWrite:
 gives the user write access
Attribute canDelete:
 gives the user delete permission
Attribute isOwner:
 the experiment owner flag.
Attribute effectiveDate:
 the date when access takes into effect
Attribute expiryDate:
 the date when access ceases
Attribute aclOwnershipType:
 system-owned or user-owned.

System-owned ACLs will prevent users from removing or editing ACL entries to a particular experiment they own. User-owned ACLs will allow experiment owners to remove/add/edit ACL entries to the experiments they own.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ObjectACL.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ObjectACL.OWNER_OWNED = 1
ObjectACL.SYSTEM_OWNED = 2
ObjectACL.content_object

Provides a generic relation to any object through content-type/object-id fields.

ObjectACL.content_type
ObjectACL.get_aclOwnershipType_display(*moreargs, **morekwargs)
classmethod ObjectACL.get_effective_query()

If possible, resolve the pluginId/entityId combination to a user or group object.

If possible, resolve the pluginId/entityId combination to a user or group object.

ObjectACL.objects = <django.db.models.manager.Manager object>
class tardis.tardis_portal.models.access_control.UserAuthentication(id, userProfile, username, authenticationMethod)

Bases: django.db.models.base.Model

CHOICES = ()
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception UserAuthentication.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

UserAuthentication.getAuthMethodDescription()
UserAuthentication.objects = <django.db.models.manager.Manager object>
UserAuthentication.userProfile
class tardis.tardis_portal.models.access_control.UserProfile(*args, **kwargs)

Bases: django.db.models.base.Model

UserProfile class is an extension to the Django standard user model.

Attribute isDjangoAccount:
 is the user a local DB user
Attribute user:a foreign key to the django.contrib.auth.models.User
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception UserProfile.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

UserProfile.ext_groups
UserProfile.getUserAuthentications()
UserProfile.isValidPublicContact()

Checks if there’s enough information on the user for it to be used as a public contact.

Note: Last name can’t be required, because people don’t necessarilly have a last (or family) name.

UserProfile.objects = <django.db.models.manager.Manager object>
UserProfile.user
UserProfile.userauthentication_set
tardis.tardis_portal.models.access_control.create_user_api_key(sender, **kwargs)

Auto-create ApiKey objects using Tastypie’s create_api_key

tardis.tardis_portal.models.access_control.create_user_profile(sender, instance, created, **kwargs)

tardis.tardis_portal.models.datafile module

class tardis.tardis_portal.models.datafile.DataFile(*args, **kwargs)

Bases: django.db.models.base.Model

Class to store meta-data about a file. The physical copies of a file are described by distinct DataFileObject instances.

Attribute dataset:
 the foreign key to the tardis.tardis_portal.models.Dataset the file belongs to.
Attribute filename:
 the name of the file, excluding the path.
Attribute size:the size of the file.
Attribute created_time:
 time the file was added to tardis
Attribute modification_time:
 last modification time of the file
Attribute mimetype:
 for example ‘application/pdf’
Attribute md5sum:
 digest of length 32, containing only hexadecimal digits
Attribute sha512sum:
 digest of length 128, containing only hexadecimal digits
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception DataFile.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

DataFile.cache_file()
DataFile.datafileparameterset_set
DataFile.dataset
DataFile.file_object
DataFile.file_objects
DataFile.getParameterSets(schemaType=None)

Return datafile parametersets associated with this datafile.

DataFile.get_absolute_filepath()
DataFile.get_as_temporary_file(*args, **kwds)

Returns a traditional file-system-based file object that is a copy of the original data. The file is deleted when the context is destroyed. :param basestring directory: the directory in which to create the temp

file
Returns:the temporary file object
Return type:NamedTemporaryFile
DataFile.get_default_storage_box()

try to guess appropriate box from files, dataset or experiment

DataFile.get_download_url()
DataFile.get_file(verified_only=True)

Returns the file as a readable file-like object from the best avaiable storage box.

If verified_only=False, the return of files without a verified checksum is allowed, otherwise None is returned for unverified files.

Parameters:verified_only (bool) – if False return files without verified checksums
Returns:Python file object
Return type:Python File object
DataFile.get_image_data()
DataFile.get_mimetype()
DataFile.get_preferred_dfo(verified_only=True)
DataFile.get_receiving_storage_box()
DataFile.get_size()
DataFile.get_view_url()
DataFile.has_image()
DataFile.is_image()

returns True if it’s an image and not an x-icon and not an img the image/img mimetype is made up though and may need revisiting if there is an official img mimetype that does not refer to diffraction images

DataFile.is_local()
DataFile.is_online

return False if a file is on tape. At this stage it checks it returns true for no file objects, because those files are offline through other checks

DataFile.is_public()
DataFile.objects = <django.db.models.manager.Manager object>
DataFile.save(*args, **kwargs)
DataFile.status

returns information about the status of the file. States are defined in StorageBox

classmethod DataFile.sum_sizes(datafiles)

Takes a query set of datafiles and returns their total size.

DataFile.update_mimetype(mimetype=None, force=False, save=True)
DataFile.verified
DataFile.verify(reverify=False)
class tardis.tardis_portal.models.datafile.DataFileObject(*args, **kwargs)

Bases: django.db.models.base.Model

holds one copy of the data for a datafile

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception DataFileObject.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

DataFileObject.cache_file()
DataFileObject.copy_file(dest_box=None, verify=True)

copies verified file to new storage box checks for existing copy triggers async verification if not disabled :param StorageBox dest_box: StorageBox instance :param bool verify: :returns: DataFileObject of copy :rtype: DataFileObject

DataFileObject.create_set_uri(force=False, save=False)

sets the uri as well as building it :param bool force: :param book save: :return: :rtype: basestring

DataFileObject.datafile
DataFileObject.delete_data()
DataFileObject.file_object

A set of accessor functions that convert the file information to a standard Python file object for reading and copy the contents of an existing file_object into the storage backend.

Returns:a file object
Return type:Python File object
DataFileObject.get_full_path()
DataFileObject.get_next_by_created_time(*moreargs, **morekwargs)
DataFileObject.get_previous_by_created_time(*moreargs, **morekwargs)
DataFileObject.modified_time
DataFileObject.move_file(dest_box=None)

moves a file copies first, then synchronously verifies deletes file if copy is true copy and has been verified

Parameters:dest_box (StorageBox) – StorageBox instance
Returns:moved file dfo
Return type:DataFileObject
DataFileObject.objects = <django.db.models.manager.Manager object>
DataFileObject.save(*args, **kwargs)
DataFileObject.storage_box
DataFileObject.storage_type
Returns:storage_box type
Return type:StorageBox type constant
DataFileObject.verify(add_checksums=True, add_size=True)
tardis.tardis_portal.models.datafile.compute_checksums(file_object, compute_md5=True, compute_sha512=True, close_file=True)

Computes checksums for a python file object

Parameters:
  • file_object (object) – Python File object
  • compute_md5 (bool) – whether to compute md5 default=True
  • compute_sha512 (bool) – whether to compute sha512, default=True
  • close_file (bool) – whether to close the file_object, default=True
Returns:

the checksums as {‘md5sum’: result, ‘sha512sum’: result}

Return type:

dict

tardis.tardis_portal.models.datafile.delete_dfo(sender, instance, **kwargs)

tardis.tardis_portal.models.dataset module

class tardis.tardis_portal.models.dataset.Dataset(*args, **kwargs)

Bases: django.db.models.base.Model

Class to link datasets to experiments

Attribute experiment:
 a forign key to the tardis.tardis_portal.models.Experiment
Attribute facility:
 the foreign key to the facility that generated this data
Attribute instrument:
 the foreign key to the instrument that generated this data
Attribute description:
 description of this dataset
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Dataset.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Dataset.datafile_set
Dataset.datasetparameterset_set
Dataset.equipment_set
Dataset.experiments
Dataset.getParameterSets(schemaType=None)

Return the dataset parametersets associated with this experiment.

Dataset.get_absolute_url(*args, **kwargs)

Return the absolute url to the current Dataset

Dataset.get_all_storage_boxes_used()
Dataset.get_download_urls()
Dataset.get_edit_url(*args, **kwargs)

Return the absolute url to the edit view of the current Dataset

Dataset.get_first_experiment()
Dataset.get_images()
Dataset.get_path()
Dataset.get_size()
Dataset.get_thumbnail_url()
Dataset.image
Dataset.instrument
Dataset.is_online
Dataset.objects = <tardis.tardis_portal.managers.OracleSafeManager object>

tardis.tardis_portal.models.experiment module

class tardis.tardis_portal.models.experiment.Experiment(*args, **kwargs)

Bases: django.db.models.base.Model

The Experiment model inherits from django.db.models.Model

Attribute url:Undocumented
Attribute approved:
 Undocumented
Attribute title:
 the title of the experiment.
Attribute institution_name:
 the name of the institution who created the dataset.
Attribute start_time:
 Undocumented
Attribute end_time:
 Undocumented
Attribute created_time:
 Undocumented
Attribute handle:
 Undocumented
Attribute public:
 Undocumented
Attribute objects:
 default model manager
Attribute safe:ACL aware model manager
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Experiment.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Experiment.PUBLICATION_DETAILS_SCHEMA = 'http://www.tardis.edu.au/schemas/publication/details/'
Experiment.PUBLICATION_DRAFT_SCHEMA = 'http://www.tardis.edu.au/schemas/publication/draft/'
Experiment.PUBLICATION_SCHEMA_ROOT = 'http://www.tardis.edu.au/schemas/publication/'
Experiment.PUBLIC_ACCESS_CHOICES = ((1, 'No public access (hidden)'), (25, 'Ready to be released pending embargo expiry'), (50, 'Public Metadata only (no data file access)'), (100, 'Public'))
Experiment.PUBLIC_ACCESS_EMBARGO = 25
Experiment.PUBLIC_ACCESS_FULL = 100
Experiment.PUBLIC_ACCESS_METADATA = 50
Experiment.PUBLIC_ACCESS_NONE = 1
Experiment.created_by
Experiment.datasets
Experiment.experimentauthor_set
Experiment.experimentparameterset_set
Experiment.getParameterSets(schemaType=None)

Return the experiment parametersets associated with this experiment.

Experiment.get_absolute_url(*args, **kwargs)

Return the absolute url to the current Experiment

Experiment.get_create_token_url(*args, **kwargs)

Return the absolute url to the create token view of the current Experiment

Experiment.get_ct()
Experiment.get_datafiles()
Experiment.get_download_urls()
Experiment.get_edit_url(*args, **kwargs)

Return the absolute url to the edit view of the current Experiment

Experiment.get_groups()
Experiment.get_images()
Experiment.get_next_by_created_time(*moreargs, **morekwargs)
Experiment.get_next_by_update_time(*moreargs, **morekwargs)
Experiment.get_or_create_directory()
Experiment.get_owners()
Experiment.get_previous_by_created_time(*moreargs, **morekwargs)
Experiment.get_previous_by_update_time(*moreargs, **morekwargs)
Experiment.get_public_access_display(*moreargs, **morekwargs)
Experiment.get_size()
Experiment.is_publication()
Experiment.is_publication_draft()
Experiment.license
Experiment.objectacls

This class provides the functionality that makes the related-object managers available as attributes on a model class, for fields that have multiple “remote” values and have a GenericRelation defined in their model (rather than having another model pointed at them). In the example “article.publications”, the publications attribute is a ReverseGenericRelatedObjectsDescriptor instance.

Experiment.objects = <tardis.tardis_portal.managers.OracleSafeManager object>
classmethod Experiment.public_access_implies_distribution(public_access_level)

Determines if a level of public access implies that distribution should be allowed, or alternately if it should not be allowed. Used to prevent free-distribution licences for essentially private data, and overly-restrictive licences for public data.

Experiment.public_download_allowed()

instance method version of ‘public_access_implies_distribution’

Experiment.safe = <tardis.tardis_portal.managers.ExperimentManager object>
Experiment.save(*args, **kwargs)
Experiment.token_set
class tardis.tardis_portal.models.experiment.ExperimentAuthor(id, experiment, author, institution, email, order, url)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ExperimentAuthor.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ExperimentAuthor.experiment
ExperimentAuthor.objects = <django.db.models.manager.Manager object>
ExperimentAuthor.save(*args, **kwargs)

tardis.tardis_portal.models.facility module

class tardis.tardis_portal.models.facility.Facility(*args, **kwargs)

Bases: django.db.models.base.Model

Represents a facility that produces data

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Facility.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Facility.instrument_set
Facility.manager_group
Facility.objects = <django.db.models.manager.Manager object>
tardis.tardis_portal.models.facility.facilities_managed_by(user)

Returns a list of facilities managed by a user

tardis.tardis_portal.models.facility.is_facility_manager(user)

Returns true if the user manages one or more facilities

tardis.tardis_portal.models.hooks module

tardis.tardis_portal.models.hooks.ensure_doi_exists(sender, **kwargs)
tardis.tardis_portal.models.hooks.post_save_experiment(sender, **kwargs)
tardis.tardis_portal.models.hooks.post_save_experiment_parameter(sender, **kwargs)
tardis.tardis_portal.models.hooks.post_save_experimentauthor(sender, **kwargs)
tardis.tardis_portal.models.hooks.publish_public_expt_rifcs(experiment)

tardis.tardis_portal.models.instrument module

class tardis.tardis_portal.models.instrument.Instrument(*args, **kwargs)

Bases: django.db.models.base.Model

Represents an instrument belonging to a facility that produces data

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Instrument.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Instrument.dataset_set
Instrument.facility
Instrument.getParameterSets(schemaType=None)

Return the instrument parametersets associated with this instrument.

Instrument.instrumentparameterset_set
Instrument.objects = <django.db.models.manager.Manager object>

tardis.tardis_portal.models.jti module

class tardis.tardis_portal.models.jti.JTI(id, jti, created_time)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception JTI.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

JTI.get_next_by_created_time(*moreargs, **morekwargs)
JTI.get_previous_by_created_time(*moreargs, **morekwargs)
JTI.objects = <django.db.models.manager.Manager object>

tardis.tardis_portal.models.license module

class tardis.tardis_portal.models.license.License(*args, **kwargs)

Bases: django.db.models.base.Model

Represents a licence for experiment content.

Instances should provide enough detail for both researchers to select the licence, and for the users of their data to divine correct usage of experiment content.

(Non-US developers: We’re using US spelling in the code.)

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception License.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

License.experiment_set
classmethod License.get_none_option_license()
classmethod License.get_suitable_licenses(public_access_method=None)
License.objects = <django.db.models.manager.Manager object>

tardis.tardis_portal.models.parameters module

class tardis.tardis_portal.models.parameters.DatafileParameter(id, name, string_value, numerical_value, datetime_value, link_id, link_ct, parameterset)

Bases: tardis.tardis_portal.models.parameters.Parameter

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception DatafileParameter.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Provides a generic relation to any object through content-type/object-id fields.

DatafileParameter.name
DatafileParameter.objects = <tardis.tardis_portal.managers.OracleSafeManager object>
DatafileParameter.parameter_type = 'Datafile'
DatafileParameter.parameterset
class tardis.tardis_portal.models.parameters.DatafileParameterSet(id, schema, datafile)

Bases: tardis.tardis_portal.models.parameters.ParameterSet

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception DatafileParameterSet.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

DatafileParameterSet.datafile
DatafileParameterSet.datafileparameter_set
DatafileParameterSet.objects = <django.db.models.manager.Manager object>
DatafileParameterSet.parameter_class

alias of DatafileParameter

DatafileParameterSet.schema
DatafileParameterSet.storage_box
class tardis.tardis_portal.models.parameters.DatasetParameter(id, name, string_value, numerical_value, datetime_value, link_id, link_ct, parameterset)

Bases: tardis.tardis_portal.models.parameters.Parameter

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception DatasetParameter.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Provides a generic relation to any object through content-type/object-id fields.

DatasetParameter.name
DatasetParameter.objects = <tardis.tardis_portal.managers.OracleSafeManager object>
DatasetParameter.parameter_type = 'Dataset'
DatasetParameter.parameterset
class tardis.tardis_portal.models.parameters.DatasetParameterSet(id, schema, dataset)

Bases: tardis.tardis_portal.models.parameters.ParameterSet

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception DatasetParameterSet.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

DatasetParameterSet.dataset
DatasetParameterSet.datasetparameter_set
DatasetParameterSet.objects = <django.db.models.manager.Manager object>
DatasetParameterSet.parameter_class

alias of DatasetParameter

DatasetParameterSet.schema
DatasetParameterSet.storage_box
class tardis.tardis_portal.models.parameters.ExperimentParameter(id, name, string_value, numerical_value, datetime_value, link_id, link_ct, parameterset)

Bases: tardis.tardis_portal.models.parameters.Parameter

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ExperimentParameter.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Provides a generic relation to any object through content-type/object-id fields.

ExperimentParameter.name
ExperimentParameter.objects = <tardis.tardis_portal.managers.OracleSafeManager object>
ExperimentParameter.parameter_type = 'Experiment'
ExperimentParameter.parameterset
ExperimentParameter.save(*args, **kwargs)
class tardis.tardis_portal.models.parameters.ExperimentParameterSet(id, schema, experiment)

Bases: tardis.tardis_portal.models.parameters.ParameterSet

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception ExperimentParameterSet.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ExperimentParameterSet.experiment
ExperimentParameterSet.experimentparameter_set
ExperimentParameterSet.objects = <django.db.models.manager.Manager object>
ExperimentParameterSet.parameter_class

alias of ExperimentParameter

ExperimentParameterSet.schema
ExperimentParameterSet.storage_box
class tardis.tardis_portal.models.parameters.FreeTextSearchField(id, parameter_name)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception FreeTextSearchField.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

FreeTextSearchField.objects = <django.db.models.manager.Manager object>
FreeTextSearchField.parameter_name
class tardis.tardis_portal.models.parameters.InstrumentParameter(id, name, string_value, numerical_value, datetime_value, link_id, link_ct, parameterset)

Bases: tardis.tardis_portal.models.parameters.Parameter

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception InstrumentParameter.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Provides a generic relation to any object through content-type/object-id fields.

InstrumentParameter.name
InstrumentParameter.objects = <tardis.tardis_portal.managers.OracleSafeManager object>
InstrumentParameter.parameter_type = 'Instrument'
InstrumentParameter.parameterset
class tardis.tardis_portal.models.parameters.InstrumentParameterSet(id, schema, instrument)

Bases: tardis.tardis_portal.models.parameters.ParameterSet

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception InstrumentParameterSet.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

InstrumentParameterSet.instrument
InstrumentParameterSet.instrumentparameter_set
InstrumentParameterSet.objects = <django.db.models.manager.Manager object>
InstrumentParameterSet.parameter_class

alias of InstrumentParameter

InstrumentParameterSet.schema
InstrumentParameterSet.storage_box
class tardis.tardis_portal.models.parameters.Parameter(*args, **kwargs)

Bases: django.db.models.base.Model

class Meta
abstract = False
app_label = 'tardis_portal'
ordering = ['name']
Parameter.get()

Provides a generic relation to any object through content-type/object-id fields.

Parameter.name
Parameter.objects
Parameter.parameter_type = 'Abstract'
Parameter.set_value(value)

Sets the parameter value, converting into the appropriate data type. Deals with date/time strings that are timezone naive or aware, based on the USE_TZ setting.

Parameters:value (basestring) – a string (or string-like) repr of the value
Raises:SuspiciousOperation
class tardis.tardis_portal.models.parameters.ParameterName(id, schema, name, full_name, units, data_type, immutable, comparison_type, is_searchable, choices, order)

Bases: django.db.models.base.Model

CONTAINS_COMPARISON = 8
DATETIME = 6
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

ParameterName.EXACT_VALUE_COMPARISON = 1
ParameterName.FILENAME = 5
ParameterName.GREATER_THAN_COMPARISON = 4
ParameterName.GREATER_THAN_EQUAL_COMPARISON = 5
ParameterName.JSON = 8
ParameterName.LESS_THAN_COMPARISON = 6
ParameterName.LESS_THAN_EQUAL_COMPARISON = 7
ParameterName.LONGSTRING = 7
exception ParameterName.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ParameterName.NOT_EQUAL_COMPARISON = 2
ParameterName.NUMERIC = 1
ParameterName.RANGE_COMPARISON = 3
ParameterName.STRING = 2
ParameterName.URL = 3
ParameterName.datafileparameter_set
ParameterName.datasetparameter_set
ParameterName.experimentparameter_set
ParameterName.freetextsearchfield_set
ParameterName.getUniqueShortName()
ParameterName.get_comparison_type_display(*moreargs, **morekwargs)
ParameterName.get_data_type_display(*moreargs, **morekwargs)
ParameterName.instrumentparameter_set
ParameterName.isDateTime()
ParameterName.isFilename()
ParameterName.isLongString()
ParameterName.isNumeric()
ParameterName.isString()
ParameterName.isURL()
ParameterName.is_json()
ParameterName.natural_key()
ParameterName.objects = <tardis.tardis_portal.managers.ParameterNameManager object>
ParameterName.schema
class tardis.tardis_portal.models.parameters.ParameterSet(*args, **kwargs)

Bases: django.db.models.base.Model, tardis.tardis_portal.models.parameters.ParameterSetManagerMixin

class Meta
abstract = False
app_label = 'tardis_portal'
ordering = ['id']
ParameterSet.parameter_class = None
ParameterSet.save(*args, **kwargs)
ParameterSet.schema
ParameterSet.storage_box
class tardis.tardis_portal.models.parameters.ParameterSetManagerMixin(parameterset=None, parentObject=None, schema=None)

Bases: tardis.tardis_portal.ParameterSetManager.ParameterSetManager

for clarity’s sake and for future extension this class makes ParameterSetManager local to this file. At the moment its only function is increasing the line count

class tardis.tardis_portal.models.parameters.Schema(id, namespace, name, type, subtype, immutable, hidden)

Bases: django.db.models.base.Model

DATAFILE = 3
DATASET = 2
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

Schema.EXPERIMENT = 1
Schema.INSTRUMENT = 5
exception Schema.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Schema.NONE = 4
exception Schema.UnsupportedType(msg)

Bases: exceptions.Exception

Schema.datafileparameterset_set
Schema.datasetparameterset_set
Schema.experimentparameterset_set
classmethod Schema.getNamespaces(type_, subtype=None)

Return the list of namespaces for equipment, sample, and experiment schemas.

classmethod Schema.getSubTypes()
classmethod Schema.get_internal_schema(schema_type)
classmethod Schema.get_schema_type_name(schema_type, short=False)
Schema.get_type_display(*moreargs, **morekwargs)
Schema.instrumentparameterset_set
Schema.natural_key()
Schema.objects = <tardis.tardis_portal.managers.SchemaManager object>
Schema.parametername_set

tardis.tardis_portal.models.storage module

class tardis.tardis_portal.models.storage.StorageBox(*args, **kwargs)

Bases: django.db.models.base.Model

table that holds storage boxes of any type. to extend to new types, add fields if necessary

Attribute max_size:
 max size in bytes
BUNDLE = 6
CACHE = 3
DISK = 1
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception StorageBox.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

StorageBox.TAPE = 2
StorageBox.TEMPORARY = 4
StorageBox.TYPES = {'disk': 1, 'cache': 3, 'tape': 2, 'receiving': 4, 'bundle': 6}
StorageBox.TYPE_UNKNOWN = 5
StorageBox.attributes
StorageBox.cache_box

Get cache box if set up

StorageBox.child_boxes
StorageBox.copy_files(dest_box=None)
StorageBox.copy_to_master()
classmethod StorageBox.create_local_box(location=None)
StorageBox.datafileparametersets
StorageBox.datasetparametersets
StorageBox.experimentparametersets
StorageBox.file_objects
classmethod StorageBox.get_default_storage(location=None, user=None)

gets default storage box or get local storage box with given base location or create one if it doesn’t exist.

policies: Have a StorageBoxAttribute: key=’default’, value=True find a storage box where location is DEFAULT_STORAGE_BASE_DIR create a default storage box at DEFAULT_STORAGE_BASE_DIR lowest id storage box is default no storage box defined, use hard coded default for now TODO: consider removing this

Would be nice: get largest free space one, test for authorisation

StorageBox.get_initialised_storage_instance()
StorageBox.get_options_as_dict()
StorageBox.instrumentparametersets
StorageBox.master_box
StorageBox.move_files(dest_box=None)
StorageBox.move_to_master()
StorageBox.objects = <django.db.models.manager.Manager object>
StorageBox.offline_types = [2]
StorageBox.online_types = [3, 1, 4, 6]
StorageBox.options
StorageBox.storage_type
StorageBox.type_order = [3, 6, 1, 2, 4, 5]
class tardis.tardis_portal.models.storage.StorageBoxAttribute(*args, **kwargs)

Bases: django.db.models.base.Model

can hold attributes/metadata about different storage locations.

built-ins: key values description type receiving holds files temporarily for ingestion only

permanent permanent location (assumed by default) cache holds files for fast access
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception StorageBoxAttribute.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

StorageBoxAttribute.objects = <django.db.models.manager.Manager object>
StorageBoxAttribute.storage_box
class tardis.tardis_portal.models.storage.StorageBoxOption(*args, **kwargs)

Bases: django.db.models.base.Model

holds the options passed to the storage class defined in StorageBox. key->value store with support for typed values through pickling when value_type is set to ‘pickle’

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception StorageBoxOption.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

StorageBoxOption.PICKLE = 'pickle'
StorageBoxOption.STRING = 'string'
StorageBoxOption.TYPE_CHOICES = (('string', 'String value'), ('pickle', 'Pickled value'))
StorageBoxOption.get_value_type_display(*moreargs, **morekwargs)
StorageBoxOption.objects = <django.db.models.manager.Manager object>
StorageBoxOption.storage_box
StorageBoxOption.unpickled_value

tardis.tardis_portal.models.token module

class tardis.tardis_portal.models.token.Token(id, token, experiment, expiry_date, user)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Token.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Token.experiment
Token.get_absolute_url(*args, **kwargs)
Token.get_next_by_expiry_date(*moreargs, **morekwargs)
Token.get_previous_by_expiry_date(*moreargs, **morekwargs)
Token.get_session_expiry()

A token login should expire at the earlier of a) tomorrow at 4am b) the (end of) the token’s expiry date

It is the responsibility of token_auth to set the session expiry

Token.is_expired()
Token.objects = <tardis.tardis_portal.managers.OracleSafeManager object>
Token.save_with_random_token()
Token.user

Module contents

models/__init__.py