tardis.tardis_portal package

Subpackages

Submodules

tardis.tardis_portal.ParameterSetManager module

class tardis.tardis_portal.ParameterSetManager.ParameterSetManager(parameterset=None, parentObject=None, schema=None)

Bases: object

blank_param = None
delete_all_params()
delete_params(parname)
get_param(parname, value=False)
get_params(parname, value=False)
get_schema()
new_param(parname, value, fullparname=None)
parameters = None
parameterset = None
set_param(parname, value, fullparname=None, example_value=None)
set_param_list(parname, value_list, fullparname=None)
set_params_from_dict(dict)

tardis.tardis_portal.admin module

class tardis.tardis_portal.admin.DataFileObjectInline(parent_model, admin_site)

Bases: django.contrib.admin.options.TabularInline

extra = 0
form

alias of DataFileObjectInlineForm

media
model

alias of tardis.tardis_portal.models.datafile.DataFileObject

class tardis.tardis_portal.admin.DataFileObjectInlineForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)

Bases: django.forms.models.ModelForm

class Meta
fields = '__all__'
model

alias of tardis.tardis_portal.models.datafile.DataFileObject

widgets = {'uri': <django.forms.widgets.TextInput object at 0x7f9df37d6d50>}
base_fields = {'datafile': <django.forms.models.ModelChoiceField object at 0x7f9df37e1690>, 'last_verified_time': <django.forms.fields.DateTimeField object at 0x7f9df37e1b90>, 'storage_box': <django.forms.models.ModelChoiceField object at 0x7f9df37e17d0>, 'uri': <django.forms.fields.CharField object at 0x7f9df37e1950>, 'verified': <django.forms.fields.BooleanField object at 0x7f9df37e1b10>}
declared_fields = {}
media
class tardis.tardis_portal.admin.DatafileAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

form

alias of DatafileAdminForm

inlines = [<class 'tardis.tardis_portal.admin.DataFileObjectInline'>]
media
search_fields = ['filename', 'id']
class tardis.tardis_portal.admin.DatafileAdminForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)

Bases: django.forms.models.ModelForm

class Meta
fields = '__all__'
model

alias of tardis.tardis_portal.models.datafile.DataFile

widgets = {'directory': <django.forms.widgets.TextInput object at 0x7f9df37e1610>}
base_fields = {'created_time': <django.forms.fields.DateTimeField object at 0x7f9df37f0210>, 'dataset': <django.forms.models.ModelChoiceField object at 0x7f9df37e1cd0>, 'deleted': <django.forms.fields.BooleanField object at 0x7f9df37f0550>, 'deleted_time': <django.forms.fields.DateTimeField object at 0x7f9df37f0650>, 'directory': <django.forms.fields.CharField object at 0x7f9df37e1f90>, 'filename': <django.forms.fields.CharField object at 0x7f9df37e1e10>, 'md5sum': <django.forms.fields.CharField object at 0x7f9df37f03d0>, 'mimetype': <django.forms.fields.CharField object at 0x7f9df37f0390>, 'modification_time': <django.forms.fields.DateTimeField object at 0x7f9df37f02d0>, 'sha512sum': <django.forms.fields.CharField object at 0x7f9df37f0490>, 'size': <django.forms.fields.IntegerField object at 0x7f9df37f0090>, 'version': <django.forms.fields.IntegerField object at 0x7f9df37f0790>}
declared_fields = {}
media
class tardis.tardis_portal.admin.DatasetAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

media
search_fields = ['description', 'id']
class tardis.tardis_portal.admin.ExperimentAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

inlines = [<class 'tardis.tardis_portal.admin.ObjectACLInline'>]
media
search_fields = ['title', 'id']
class tardis.tardis_portal.admin.ExperimentParameterInline(parent_model, admin_site)

Bases: django.contrib.admin.options.TabularInline

extra = 0
formfield_overrides = {<class 'django.db.models.fields.TextField'>: {'widget': <class 'django.forms.widgets.TextInput'>}}
media
model

alias of tardis.tardis_portal.models.parameters.ExperimentParameter

class tardis.tardis_portal.admin.ExperimentParameterSetAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

inlines = [<class 'tardis.tardis_portal.admin.ExperimentParameterInline'>]
media
class tardis.tardis_portal.admin.FacilityAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

media
search_fields = ['name']
class tardis.tardis_portal.admin.FreeTextSearchFieldAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

media
class tardis.tardis_portal.admin.InstrumentAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

media
search_fields = ['name']
class tardis.tardis_portal.admin.InstrumentParameterInline(parent_model, admin_site)

Bases: django.contrib.admin.options.TabularInline

extra = 0
media
model

alias of tardis.tardis_portal.models.parameters.InstrumentParameter

class tardis.tardis_portal.admin.InstrumentParameterSetAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

inlines = [<class 'tardis.tardis_portal.admin.InstrumentParameterInline'>]
media
class tardis.tardis_portal.admin.ObjectACLAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

list_display = ['__str__', 'pluginId', 'entityId', 'canRead', 'canWrite', 'canDelete', 'isOwner']
media
search_fields = ['content_type', 'object_id']
class tardis.tardis_portal.admin.ObjectACLInline(parent_model, admin_site)

Bases: django.contrib.contenttypes.admin.GenericTabularInline

extra = 0
media
model

alias of tardis.tardis_portal.models.access_control.ObjectACL

class tardis.tardis_portal.admin.ParameterNameAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

media
search_fields = ['name', 'schema__id']
class tardis.tardis_portal.admin.ParameterNameInline(parent_model, admin_site)

Bases: django.contrib.admin.options.TabularInline

extra = 0
media
model

alias of tardis.tardis_portal.models.parameters.ParameterName

class tardis.tardis_portal.admin.SchemaAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

inlines = [<class 'tardis.tardis_portal.admin.ParameterNameInline'>]
media
search_fields = ['name', 'namespace']
class tardis.tardis_portal.admin.StorageBoxAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

form

alias of StorageBoxForm

inlines = [<class 'tardis.tardis_portal.admin.StorageBoxOptionInline'>, <class 'tardis.tardis_portal.admin.StorageBoxAttributeInline'>]
media
search_fields = ['name']
class tardis.tardis_portal.admin.StorageBoxAttributeInline(parent_model, admin_site)

Bases: django.contrib.admin.options.TabularInline

extra = 0
form

alias of StorageBoxAttributeInlineForm

media
model

alias of tardis.tardis_portal.models.storage.StorageBoxAttribute

class tardis.tardis_portal.admin.StorageBoxAttributeInlineForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)

Bases: django.forms.models.ModelForm

class Meta
fields = '__all__'
model

alias of tardis.tardis_portal.models.storage.StorageBoxAttribute

widgets = {'key': <django.forms.widgets.TextInput object at 0x7f9df37d6110>, 'value': <django.forms.widgets.TextInput object at 0x7f9df37d6190>}
base_fields = {'key': <django.forms.fields.CharField object at 0x7f9df37d6550>, 'storage_box': <django.forms.models.ModelChoiceField object at 0x7f9df37d6410>, 'value': <django.forms.fields.CharField object at 0x7f9df37d6710>}
declared_fields = {}
media
class tardis.tardis_portal.admin.StorageBoxForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)

Bases: django.forms.models.ModelForm

class Meta
fields = '__all__'
model

alias of tardis.tardis_portal.models.storage.StorageBox

widgets = {'description': <django.forms.widgets.TextInput object at 0x7f9df37d6c10>, 'django_storage_class': <django.forms.widgets.TextInput object at 0x7f9df37d6810>, 'name': <django.forms.widgets.TextInput object at 0x7f9df37d6c50>}
base_fields = {'description': <django.forms.fields.CharField object at 0x7f9df37e1250>, 'django_storage_class': <django.forms.fields.CharField object at 0x7f9df37d6d90>, 'master_box': <django.forms.models.ModelChoiceField object at 0x7f9df37e13d0>, 'max_size': <django.forms.fields.IntegerField object at 0x7f9df37d6ed0>, 'name': <django.forms.fields.CharField object at 0x7f9df37e1090>, 'status': <django.forms.fields.CharField object at 0x7f9df37d6fd0>}
declared_fields = {}
media
class tardis.tardis_portal.admin.StorageBoxOptionInline(parent_model, admin_site)

Bases: django.contrib.admin.options.TabularInline

extra = 0
form

alias of StorageBoxOptionInlineForm

media
model

alias of tardis.tardis_portal.models.storage.StorageBoxOption

class tardis.tardis_portal.admin.StorageBoxOptionInlineForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)

Bases: django.forms.models.ModelForm

class Meta
fields = '__all__'
model

alias of tardis.tardis_portal.models.storage.StorageBoxOption

widgets = {'key': <django.forms.widgets.TextInput object at 0x7f9df37d6390>, 'value': <django.forms.widgets.TextInput object at 0x7f9df37d6790>}
base_fields = {'key': <django.forms.fields.CharField object at 0x7f9df37d6990>, 'storage_box': <django.forms.models.ModelChoiceField object at 0x7f9df37d6850>, 'value': <django.forms.fields.CharField object at 0x7f9df37d6b50>, 'value_type': <django.forms.fields.TypedChoiceField object at 0x7f9df37d6bd0>}
declared_fields = {}
media
class tardis.tardis_portal.admin.UserAuthenticationAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

media
search_fields = ['username', 'authenticationMethod', 'userProfile__user__username']

tardis.tardis_portal.api module

RESTful API for MyTardis models and data. Implemented with Tastypie.

class tardis.tardis_portal.api.ACLAuthorization

Bases: tastypie.authorization.Authorization

Authorisation class for Tastypie.

create_detail(object_list, bundle)
create_list(object_list, bundle)
delete_detail(object_list, bundle)
delete_list(object_list, bundle)
read_detail(object_list, bundle)
read_list(object_list, bundle)
update_detail(object_list, bundle)

Latest TastyPie requires update_detail permissions to be able to create objects. Rather than duplicating code here, we’ll just use the same authorization rules we use for create_detail.

update_list(object_list, bundle)
class tardis.tardis_portal.api.DataFileResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

class Meta

Bases: tardis.tardis_portal.api.Meta

filtering = {'dataset': 2, 'directory': ('exact', 'startswith'), 'filename': ('exact',)}
object_class

alias of tardis.tardis_portal.models.datafile.DataFile

ordering = ['filename', 'modification_time']
queryset
resource_name = 'dataset_file'
base_fields = {'created_time': <tastypie.fields.DateTimeField object at 0x7f9df00487d0>, 'datafile': <tastypie.fields.FileField object at 0x7f9df0048290>, 'dataset': <tastypie.fields.ForeignKey object at 0x7f9df0048050>, 'deleted': <tastypie.fields.BooleanField object at 0x7f9df0048910>, 'deleted_time': <tastypie.fields.DateTimeField object at 0x7f9df0048950>, 'directory': <tastypie.fields.CharField object at 0x7f9df0048750>, 'filename': <tastypie.fields.CharField object at 0x7f9df0048710>, u'id': <tastypie.fields.IntegerField object at 0x7f9df00486d0>, 'md5sum': <tastypie.fields.CharField object at 0x7f9df0048890>, 'mimetype': <tastypie.fields.CharField object at 0x7f9df0048850>, 'modification_time': <tastypie.fields.DateTimeField object at 0x7f9df0048810>, 'parameter_sets': <tastypie.fields.ToManyField object at 0x7f9df0048250>, 'replicas': <tastypie.fields.ToManyField object at 0x7f9df00482d0>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0048690>, 'sha512sum': <tastypie.fields.CharField object at 0x7f9df00488d0>, 'size': <tastypie.fields.IntegerField object at 0x7f9df0048790>, 'version': <tastypie.fields.IntegerField object at 0x7f9df0048990>}
declared_fields = {'datafile': <tastypie.fields.FileField object at 0x7f9df0048290>, 'dataset': <tastypie.fields.ForeignKey object at 0x7f9df0048050>, 'parameter_sets': <tastypie.fields.ToManyField object at 0x7f9df0048250>, 'replicas': <tastypie.fields.ToManyField object at 0x7f9df00482d0>}
deserialize(request, data, format=None)

from https://github.com/toastdriven/django-tastypie/issues/42 modified to deserialize json sent via POST. Would fail if data is sent in a different format. uses a hack to get back pure json from request.POST

download_file(request, **kwargs)

curl needs the -J switch to get the filename right auth needs to be added manually here

hydrate(bundle)
obj_create(bundle, **kwargs)

Creates a new DataFile object from the provided bundle.data dict.

If a duplicate key error occurs, responds with HTTP Error 409: CONFLICT

post_list(request, **kwargs)
prepend_urls()
put_detail(request, **kwargs)

from https://github.com/toastdriven/django-tastypie/issues/42

temp_url = None
verify_file(request, **kwargs)

triggers verification of file, e.g. after non-POST upload complete

class tardis.tardis_portal.api.DatafileParameterResource(api_name=None)

Bases: tardis.tardis_portal.api.ParameterResource

class Meta

Bases: tardis.tardis_portal.api.Meta

object_class

alias of tardis.tardis_portal.models.parameters.DatafileParameter

queryset
base_fields = {'datetime_value': <tastypie.fields.DateTimeField object at 0x7f9df00562d0>, u'id': <tastypie.fields.IntegerField object at 0x7f9df00561d0>, 'link_id': <tastypie.fields.IntegerField object at 0x7f9df0056350>, 'name': <tastypie.fields.ForeignKey object at 0x7f9df0056110>, 'numerical_value': <tastypie.fields.FloatField object at 0x7f9df0056250>, 'parameterset': <tastypie.fields.ForeignKey object at 0x7f9df0048e10>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0056190>, 'string_value': <tastypie.fields.CharField object at 0x7f9df0056210>, 'value': <tastypie.fields.CharField object at 0x7f9df0056150>}
declared_fields = {'parameterset': <tastypie.fields.ForeignKey object at 0x7f9df0048e10>}
class tardis.tardis_portal.api.DatafileParameterSetResource(api_name=None)

Bases: tardis.tardis_portal.api.ParameterSetResource

class Meta

Bases: tardis.tardis_portal.api.Meta

object_class

alias of tardis.tardis_portal.models.parameters.DatafileParameterSet

queryset
base_fields = {'datafile': <tastypie.fields.ForeignKey object at 0x7f9df0048650>, u'id': <tastypie.fields.IntegerField object at 0x7f9df0048d50>, 'parameters': <tastypie.fields.ToManyField object at 0x7f9df00489d0>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0048dd0>, 'schema': <tastypie.fields.ForeignKey object at 0x7f9df0048d90>}
declared_fields = {'datafile': <tastypie.fields.ForeignKey object at 0x7f9df0048650>, 'parameters': <tastypie.fields.ToManyField object at 0x7f9df00489d0>}
class tardis.tardis_portal.api.DatasetParameterResource(api_name=None)

Bases: tardis.tardis_portal.api.ParameterResource

class Meta

Bases: tardis.tardis_portal.api.Meta

object_class

alias of tardis.tardis_portal.models.parameters.DatasetParameter

queryset
base_fields = {'datetime_value': <tastypie.fields.DateTimeField object at 0x7f9df02767d0>, u'id': <tastypie.fields.IntegerField object at 0x7f9df02766d0>, 'link_id': <tastypie.fields.IntegerField object at 0x7f9df0276850>, 'name': <tastypie.fields.ForeignKey object at 0x7f9df0276610>, 'numerical_value': <tastypie.fields.FloatField object at 0x7f9df0276750>, 'parameterset': <tastypie.fields.ForeignKey object at 0x7f9df0276350>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0276690>, 'string_value': <tastypie.fields.CharField object at 0x7f9df0276710>, 'value': <tastypie.fields.CharField object at 0x7f9df0276650>}
declared_fields = {'parameterset': <tastypie.fields.ForeignKey object at 0x7f9df0276350>}
class tardis.tardis_portal.api.DatasetParameterSetResource(api_name=None)

Bases: tardis.tardis_portal.api.ParameterSetResource

class Meta

Bases: tardis.tardis_portal.api.Meta

object_class

alias of tardis.tardis_portal.models.parameters.DatasetParameterSet

queryset
base_fields = {'dataset': <tastypie.fields.ForeignKey object at 0x7f9df026db50>, u'id': <tastypie.fields.IntegerField object at 0x7f9df0276290>, 'parameters': <tastypie.fields.ToManyField object at 0x7f9df026df10>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0276310>, 'schema': <tastypie.fields.ForeignKey object at 0x7f9df02762d0>}
declared_fields = {'dataset': <tastypie.fields.ForeignKey object at 0x7f9df026db50>, 'parameters': <tastypie.fields.ToManyField object at 0x7f9df026df10>}
class tardis.tardis_portal.api.DatasetResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

class Meta

Bases: tardis.tardis_portal.api.Meta

always_return_data = True
filtering = {'description': ('exact',), 'directory': ('exact',), 'experiments': 2, 'id': ('exact',), 'instrument': 2}
object_class

alias of tardis.tardis_portal.models.dataset.Dataset

ordering = ['description']
queryset
base_fields = {'created_time': <tastypie.fields.DateTimeField object at 0x7f9df0048190>, 'description': <tastypie.fields.CharField object at 0x7f9df0048110>, 'directory': <tastypie.fields.CharField object at 0x7f9df0048150>, 'experiments': <tastypie.fields.ToManyField object at 0x7f9df0280bd0>, u'id': <tastypie.fields.IntegerField object at 0x7f9df00480d0>, 'immutable': <tastypie.fields.BooleanField object at 0x7f9df0048210>, 'instrument': <tastypie.fields.ForeignKey object at 0x7f9df0280c90>, 'modified_time': <tastypie.fields.DateTimeField object at 0x7f9df00481d0>, 'parameter_sets': <tastypie.fields.ToManyField object at 0x7f9df0280c50>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0048090>}
declared_fields = {'experiments': <tastypie.fields.ToManyField object at 0x7f9df0280bd0>, 'instrument': <tastypie.fields.ForeignKey object at 0x7f9df0280c90>, 'parameter_sets': <tastypie.fields.ToManyField object at 0x7f9df0280c50>}
get_datafiles(request, **kwargs)
prepend_urls()
class tardis.tardis_portal.api.ExperimentParameterResource(api_name=None)

Bases: tardis.tardis_portal.api.ParameterResource

class Meta

Bases: tardis.tardis_portal.api.Meta

object_class

alias of tardis.tardis_portal.models.parameters.ExperimentParameter

queryset
base_fields = {'datetime_value': <tastypie.fields.DateTimeField object at 0x7f9df026d790>, u'id': <tastypie.fields.IntegerField object at 0x7f9df026d690>, 'link_id': <tastypie.fields.IntegerField object at 0x7f9df026d810>, 'name': <tastypie.fields.ForeignKey object at 0x7f9df026d5d0>, 'numerical_value': <tastypie.fields.FloatField object at 0x7f9df026d710>, 'parameterset': <tastypie.fields.ForeignKey object at 0x7f9df026d310>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df026d650>, 'string_value': <tastypie.fields.CharField object at 0x7f9df026d6d0>, 'value': <tastypie.fields.CharField object at 0x7f9df026d610>}
declared_fields = {'parameterset': <tastypie.fields.ForeignKey object at 0x7f9df026d310>}
class tardis.tardis_portal.api.ExperimentParameterSetResource(api_name=None)

Bases: tardis.tardis_portal.api.ParameterSetResource

API for ExperimentParameterSets

class Meta

Bases: tardis.tardis_portal.api.Meta

object_class

alias of tardis.tardis_portal.models.parameters.ExperimentParameterSet

queryset
base_fields = {'experiment': <tastypie.fields.ForeignKey object at 0x7f9df0269cd0>, u'id': <tastypie.fields.IntegerField object at 0x7f9df026d250>, 'parameters': <tastypie.fields.ToManyField object at 0x7f9df0269e10>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df026d2d0>, 'schema': <tastypie.fields.ForeignKey object at 0x7f9df026d290>}
declared_fields = {'experiment': <tastypie.fields.ForeignKey object at 0x7f9df0269cd0>, 'parameters': <tastypie.fields.ToManyField object at 0x7f9df0269e10>}
class tardis.tardis_portal.api.ExperimentResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

API for Experiments also creates a default ACL and allows ExperimentParameterSets to be read and written.

TODO: catch duplicate schema submissions for parameter sets

class Meta

Bases: tardis.tardis_portal.api.Meta

always_return_data = True
filtering = {'id': ('exact',), 'title': ('exact',)}
object_class

alias of tardis.tardis_portal.models.experiment.Experiment

ordering = ['title', 'created_time', 'update_time']
queryset
base_fields = {'approved': <tastypie.fields.BooleanField object at 0x7f9df026dc50>, 'created_by': <tastypie.fields.ForeignKey object at 0x7f9df026d590>, 'created_time': <tastypie.fields.DateTimeField object at 0x7f9df026ddd0>, 'description': <tastypie.fields.CharField object at 0x7f9df026dd10>, 'end_time': <tastypie.fields.DateTimeField object at 0x7f9df026dd90>, 'handle': <tastypie.fields.CharField object at 0x7f9df026de50>, u'id': <tastypie.fields.IntegerField object at 0x7f9df026dbd0>, 'institution_name': <tastypie.fields.CharField object at 0x7f9df026dcd0>, 'locked': <tastypie.fields.BooleanField object at 0x7f9df026de90>, 'parameter_sets': <tastypie.fields.ToManyField object at 0x7f9df026d850>, 'public_access': <tastypie.fields.IntegerField object at 0x7f9df026ded0>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df026db90>, 'start_time': <tastypie.fields.DateTimeField object at 0x7f9df026dd50>, 'title': <tastypie.fields.CharField object at 0x7f9df026dc90>, 'update_time': <tastypie.fields.DateTimeField object at 0x7f9df026de10>, 'url': <tastypie.fields.CharField object at 0x7f9df026dc10>}
declared_fields = {'created_by': <tastypie.fields.ForeignKey object at 0x7f9df026d590>, 'parameter_sets': <tastypie.fields.ToManyField object at 0x7f9df026d850>}
dehydrate(bundle)
hydrate_m2m(bundle)

create ACL before any related objects are created in order to use ACL permissions for those objects.

obj_create(bundle, **kwargs)

experiments need at least one ACL to be available through the ExperimentManager (Experiment.safe) Currently not tested for failed db transactions as sqlite does not enforce limits.

class tardis.tardis_portal.api.FacilityResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

class Meta

Bases: tardis.tardis_portal.api.Meta

always_return_data = True
filtering = {'id': ('exact',), 'manager_group': 2, 'name': ('exact',)}
object_class

alias of tardis.tardis_portal.models.facility.Facility

queryset
base_fields = {u'id': <tastypie.fields.IntegerField object at 0x7f9df0280810>, 'manager_group': <tastypie.fields.ForeignKey object at 0x7f9df0280450>, 'name': <tastypie.fields.CharField object at 0x7f9df02808d0>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0280850>}
declared_fields = {'manager_group': <tastypie.fields.ForeignKey object at 0x7f9df0280450>}
class tardis.tardis_portal.api.GroupResource(api_name=None)

Bases: tastypie.resources.ModelResource

class Meta
authentication = <tardis.tardis_portal.api.MyTardisAuthentication object>
authorization

Authorisation class for Tastypie.

filtering = {'id': ('exact',), 'name': ('exact',)}
object_class

alias of django.contrib.auth.models.Group

queryset
base_fields = {u'id': <tastypie.fields.IntegerField object at 0x7f9deff5fe10>, 'name': <tastypie.fields.CharField object at 0x7f9deff5fed0>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9deff5fe50>}
declared_fields = {}
class tardis.tardis_portal.api.InstrumentResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

class Meta

Bases: tardis.tardis_portal.api.Meta

always_return_data = True
filtering = {'facility': 2, 'id': ('exact',), 'name': ('exact',)}
object_class

alias of tardis.tardis_portal.models.instrument.Instrument

queryset
base_fields = {'facility': <tastypie.fields.ForeignKey object at 0x7f9df0280890>, u'id': <tastypie.fields.IntegerField object at 0x7f9df0280b50>, 'name': <tastypie.fields.CharField object at 0x7f9df0280c10>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0280b90>}
declared_fields = {'facility': <tastypie.fields.ForeignKey object at 0x7f9df0280890>}
class tardis.tardis_portal.api.LocationResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

class Meta

Bases: tardis.tardis_portal.api.Meta

object_class

alias of tardis.tardis_portal.models.storage.StorageBox

queryset
base_fields = {'description': <tastypie.fields.CharField object at 0x7f9df00566d0>, 'django_storage_class': <tastypie.fields.CharField object at 0x7f9df00565d0>, u'id': <tastypie.fields.IntegerField object at 0x7f9df0056590>, 'max_size': <tastypie.fields.IntegerField object at 0x7f9df0056610>, 'name': <tastypie.fields.CharField object at 0x7f9df0056690>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0056550>, 'status': <tastypie.fields.CharField object at 0x7f9df0056650>}
declared_fields = {}
class tardis.tardis_portal.api.MyTardisAuthentication

Bases: object

custom tastypie authentication that works with both anonymous use and a number of available auth mechanisms.

get_identifier(request)
is_authenticated(request, **kwargs)

handles backends explicitly so that it can return False when credentials are given but wrong and return Anonymous User when credentials are not given or the session has expired (web use).

class tardis.tardis_portal.api.MyTardisModelResource(api_name=None)

Bases: tastypie.resources.ModelResource

class Meta
authentication = <tardis.tardis_portal.api.MyTardisAuthentication object>
authorization

Authorisation class for Tastypie.

object_class = None
serializer = <tardis.tardis_portal.api.PrettyJSONSerializer object>
base_fields = {u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0269290>}
declared_fields = {}
lookup_kwargs_with_identifiers(bundle, kwargs)
class tardis.tardis_portal.api.ObjectACLResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

class Meta
authentication = <tardis.tardis_portal.api.MyTardisAuthentication object>
authorization

Authorisation class for Tastypie.

filtering = {'entityId': ('exact',), 'pluginId': ('exact',)}
object_class

alias of tardis.tardis_portal.models.access_control.ObjectACL

queryset
base_fields = {'aclOwnershipType': <tastypie.fields.IntegerField object at 0x7f9df0062150>, 'canDelete': <tastypie.fields.BooleanField object at 0x7f9df0062050>, 'canRead': <tastypie.fields.BooleanField object at 0x7f9df0056f90>, 'canWrite': <tastypie.fields.BooleanField object at 0x7f9df0056fd0>, 'content_object': <tastypie.contrib.contenttypes.fields.GenericForeignKeyField object at 0x7f9df0056990>, 'effectiveDate': <tastypie.fields.DateField object at 0x7f9df00620d0>, 'entityId': <tastypie.fields.CharField object at 0x7f9df0056f10>, 'expiryDate': <tastypie.fields.DateField object at 0x7f9df0062110>, u'id': <tastypie.fields.IntegerField object at 0x7f9df0056e90>, 'isOwner': <tastypie.fields.BooleanField object at 0x7f9df0062090>, 'object_id': <tastypie.fields.IntegerField object at 0x7f9df0056f50>, 'pluginId': <tastypie.fields.CharField object at 0x7f9df0056ed0>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0056e50>}
declared_fields = {'content_object': <tastypie.contrib.contenttypes.fields.GenericForeignKeyField object at 0x7f9df0056990>}
hydrate(bundle)
class tardis.tardis_portal.api.ParameterNameResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

class Meta

Bases: tardis.tardis_portal.api.Meta

filtering = {'schema': 2}
object_class

alias of tardis.tardis_portal.models.parameters.ParameterName

queryset
base_fields = {'choices': <tastypie.fields.CharField object at 0x7f9df0269a90>, 'comparison_type': <tastypie.fields.IntegerField object at 0x7f9df02699d0>, 'data_type': <tastypie.fields.IntegerField object at 0x7f9df0269950>, 'full_name': <tastypie.fields.CharField object at 0x7f9df02698d0>, u'id': <tastypie.fields.IntegerField object at 0x7f9df0269850>, 'immutable': <tastypie.fields.BooleanField object at 0x7f9df0269990>, 'is_searchable': <tastypie.fields.BooleanField object at 0x7f9df0269a50>, 'name': <tastypie.fields.CharField object at 0x7f9df0269890>, 'order': <tastypie.fields.IntegerField object at 0x7f9df0269ad0>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0269810>, 'schema': <tastypie.fields.ForeignKey object at 0x7f9df0269390>, 'units': <tastypie.fields.CharField object at 0x7f9df0269910>}
declared_fields = {'schema': <tastypie.fields.ForeignKey object at 0x7f9df0269390>}
class tardis.tardis_portal.api.ParameterResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

base_fields = {'name': <tastypie.fields.ForeignKey object at 0x7f9df02697d0>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0269bd0>, 'value': <tastypie.fields.CharField object at 0x7f9df0269b10>}
declared_fields = {'name': <tastypie.fields.ForeignKey object at 0x7f9df02697d0>, 'value': <tastypie.fields.CharField object at 0x7f9df0269b10>}
hydrate(bundle)

sets the parametername by uri or name if untyped value is given, set value via parameter method, otherwise use modelresource automatisms

class tardis.tardis_portal.api.ParameterSetResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

base_fields = {u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0269d50>, 'schema': <tastypie.fields.ForeignKey object at 0x7f9df0269b90>}
declared_fields = {'schema': <tastypie.fields.ForeignKey object at 0x7f9df0269b90>}
hydrate_schema(bundle)
class tardis.tardis_portal.api.PrettyJSONSerializer(formats=None, content_types=None, datetime_formatting=None)

Bases: tastypie.serializers.Serializer

json_indent = 2
to_json(data, options=None)
class tardis.tardis_portal.api.ReplicaResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

class Meta

Bases: tardis.tardis_portal.api.Meta

filtering = {'url': ('exact', 'startswith'), 'verified': ('exact',)}
object_class

alias of tardis.tardis_portal.models.datafile.DataFileObject

queryset
base_fields = {'created_time': <tastypie.fields.DateTimeField object at 0x7f9df0056a90>, 'datafile': <tastypie.fields.ForeignKey object at 0x7f9df0056510>, u'id': <tastypie.fields.IntegerField object at 0x7f9df0056a10>, 'last_verified_time': <tastypie.fields.DateTimeField object at 0x7f9df0056b10>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df00569d0>, 'uri': <tastypie.fields.CharField object at 0x7f9df0056a50>, 'verified': <tastypie.fields.BooleanField object at 0x7f9df0056ad0>}
declared_fields = {'datafile': <tastypie.fields.ForeignKey object at 0x7f9df0056510>}
dehydrate(bundle)
hydrate(bundle)
class tardis.tardis_portal.api.SchemaResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

class Meta

Bases: tardis.tardis_portal.api.Meta

filtering = {'id': ('exact',), 'namespace': ('exact',)}
object_class

alias of tardis.tardis_portal.models.parameters.Schema

queryset
base_fields = {'hidden': <tastypie.fields.BooleanField object at 0x7f9df0269590>, u'id': <tastypie.fields.IntegerField object at 0x7f9df0269410>, 'immutable': <tastypie.fields.BooleanField object at 0x7f9df0269550>, 'name': <tastypie.fields.CharField object at 0x7f9df0269490>, 'namespace': <tastypie.fields.CharField object at 0x7f9df0269450>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df02693d0>, 'subtype': <tastypie.fields.CharField object at 0x7f9df0269510>, 'type': <tastypie.fields.IntegerField object at 0x7f9df02694d0>}
declared_fields = {}
lookup_kwargs_with_identifiers(bundle, kwargs)
class tardis.tardis_portal.api.StorageBoxAttributeResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

class Meta

Bases: tardis.tardis_portal.api.Meta

object_class

alias of tardis.tardis_portal.models.storage.StorageBoxAttribute

queryset
base_fields = {u'id': <tastypie.fields.IntegerField object at 0x7f9df02804d0>, 'key': <tastypie.fields.CharField object at 0x7f9df0280510>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0280490>, 'storage_box': <tastypie.fields.ForeignKey object at 0x7f9df0280050>, 'value': <tastypie.fields.CharField object at 0x7f9df0280550>}
declared_fields = {'storage_box': <tastypie.fields.ForeignKey object at 0x7f9df0280050>}
class tardis.tardis_portal.api.StorageBoxOptionResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

class Meta

Bases: tardis.tardis_portal.api.Meta

object_class

alias of tardis.tardis_portal.models.storage.StorageBoxOption

queryset
accessible_keys = ['location']
base_fields = {u'id': <tastypie.fields.IntegerField object at 0x7f9df02800d0>, 'key': <tastypie.fields.CharField object at 0x7f9df0280110>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0280090>, 'storage_box': <tastypie.fields.ForeignKey object at 0x7f9df0276b90>, 'value': <tastypie.fields.CharField object at 0x7f9df0280150>, 'value_type': <tastypie.fields.CharField object at 0x7f9df0280190>}
declared_fields = {'storage_box': <tastypie.fields.ForeignKey object at 0x7f9df0276b90>}
class tardis.tardis_portal.api.StorageBoxResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

class Meta

Bases: tardis.tardis_portal.api.Meta

object_class

alias of tardis.tardis_portal.models.storage.StorageBox

queryset
base_fields = {'attributes': <tastypie.fields.ToManyField object at 0x7f9df0276890>, 'description': <tastypie.fields.CharField object at 0x7f9df0276d50>, 'django_storage_class': <tastypie.fields.CharField object at 0x7f9df0276c50>, u'id': <tastypie.fields.IntegerField object at 0x7f9df0276c10>, 'max_size': <tastypie.fields.IntegerField object at 0x7f9df0276c90>, 'name': <tastypie.fields.CharField object at 0x7f9df0276d10>, 'options': <tastypie.fields.ToManyField object at 0x7f9df02765d0>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df0276bd0>, 'status': <tastypie.fields.CharField object at 0x7f9df0276cd0>}
declared_fields = {'attributes': <tastypie.fields.ToManyField object at 0x7f9df0276890>, 'options': <tastypie.fields.ToManyField object at 0x7f9df02765d0>}
class tardis.tardis_portal.api.UserResource(api_name=None)

Bases: tastypie.resources.ModelResource

class Meta
allowed_methods = ['get']
authentication = <tardis.tardis_portal.api.MyTardisAuthentication object>
authorization

Authorisation class for Tastypie.

fields = ['username', 'first_name', 'last_name', 'email']
filtering = {'email': ('iexact',), 'username': ('exact',)}
object_class

alias of django.contrib.auth.models.User

queryset
serializer = <tardis.tardis_portal.api.PrettyJSONSerializer object>
base_fields = {'email': <tastypie.fields.CharField object at 0x7f9df02691d0>, 'first_name': <tastypie.fields.CharField object at 0x7f9df0269150>, 'groups': <tastypie.fields.ManyToManyField object at 0x7f9deff5fe90>, 'last_name': <tastypie.fields.CharField object at 0x7f9df0269190>, u'resource_uri': <tastypie.fields.CharField object at 0x7f9df02690d0>, 'username': <tastypie.fields.CharField object at 0x7f9df0269110>}
declared_fields = {'groups': <tastypie.fields.ManyToManyField object at 0x7f9deff5fe90>}
dehydrate(bundle)

use cases:

public user:
  anonymous:
    name, uri, email, id
  authenticated:
    other user:
      name, uri, email, id [, username if facility manager]
    same user:
      name, uri, email, id, username
private user:
  anonymous:
    none
  authenticated:
    other user:
      name, uri, id [, username, email if facility manager]
    same user:
      name, uri, email, id, username
tardis.tardis_portal.api.lookup_by_unique_id_only(resource)

returns custom lookup function. initialise with resource type

tardis.tardis_portal.constants module

constants.py

@author: Gerson Galang

tardis.tardis_portal.context_processors module

tardis.tardis_portal.context_processors.global_contexts(request)
tardis.tardis_portal.context_processors.google_analytics(request)

adds context for portal_template.html

tardis.tardis_portal.context_processors.registration_processor(request)
tardis.tardis_portal.context_processors.single_search_processor(request)
tardis.tardis_portal.context_processors.user_details_processor(request)
tardis.tardis_portal.context_processors.user_menu_processor(request)

tardis.tardis_portal.creativecommonshandler module

Creative Commons Handler

A wrapper for creative commons interactions on a ParameterSet

class tardis.tardis_portal.creativecommonshandler.CreativeCommonsHandler(experiment_id=None, create=True)
experiment_id = None
get_or_create_cc_parameterset(create=True)

Gets the creative commons parameterset for the experiment :param create: If true, creates a new parameterset object to hold the cc license if one doesn’t exist :type create: boolean :return: The parameterset manager for the cc parameterset :rtype: tardis.tardis_portal.ParameterSetManager. ParameterSetManager

has_cc_license()
Returns:True if there’s a cc license parameterset for the experiment
Return type:boolean
psm = None
save_license(request)

Saves a license parameterset with the POST variables from the creative commons form :param request: a HTTP Request instance :type request: django.http.HttpRequest

schema = 'http://www.tardis.edu.au/schemas/creative_commons/2011/05/17'

tardis.tardis_portal.deprecations module

Deprecation warnings

exception tardis.tardis_portal.deprecations.RemovedInMyTardis41Warning

Bases: exceptions.DeprecationWarning

Used to raise warnings about deprecated functionality.

Usage:

import warnings

warnings.warn(
    "This method will be removed in MyTardis 4.1. "
    "Please use method2 instead.",
    RemovedInMyTardis41Warning
)
exception tardis.tardis_portal.deprecations.RemovedInMyTardis42Warning

Bases: exceptions.PendingDeprecationWarning

Used to raise warnings about deprecated functionality.

Usage:

import warnings

warnings.warn(
    "This method will be removed in MyTardis 4.2. "
    "Please use method2 instead.",
    RemovedInMyTardis42Warning
)

tardis.tardis_portal.download module

download.py

class tardis.tardis_portal.download.UncachedTarStream(mapped_file_objs, filename, do_gzip=False, buffersize=131072, comp_level=6, http_buffersize=65535)

Bases: tarfile.TarFile

Stream files into a compressed tar stream on the fly

close_gzip()
compress(buf)
compute_size()
get_response(tracker_data=None)
make_tar()

main tar generator. until python 3 needs to be in one function because ‘yield’s don’t bubble up.

prepare_output(uc_buf, remainder)
tarinfo_for_df(df, name)
tardis.tardis_portal.download.classic_mapper(rootdir)
tardis.tardis_portal.download.download_api_key(request, *args, **kwargs)
tardis.tardis_portal.download.download_datafile(request, datafile_id)
tardis.tardis_portal.download.get_download_organizations()
tardis.tardis_portal.download.make_mapper(organization, rootdir)
tardis.tardis_portal.download.streaming_download_datafiles(request)

takes string parameter “comptype” for compression method. Currently implemented: “tgz” and “tar” The datafiles to be downloaded are selected using “datafile”, “dataset” or “url” parameters. An “expid” parameter may be supplied for use in the download archive name. If “url” is used, the “expid” parameter is also used to limit the datafiles to be downloaded to a given experiment.

tardis.tardis_portal.download.view_datafile(request, datafile_id)

tardis.tardis_portal.email module

tardis.tardis_portal.email.build_template_html(template_filename, context)
tardis.tardis_portal.email.build_template_text(template_filename, context)
tardis.tardis_portal.email.email_user(subject, template_filename, context, user)

tardis.tardis_portal.errors module

Created on 02/09/2010

exception tardis.tardis_portal.errors.ParameterChoicesFormatError(msg)

Bases: exceptions.Exception

exception tardis.tardis_portal.errors.SearchQueryTypeUnprovidedError(msg)

Bases: exceptions.Exception

exception tardis.tardis_portal.errors.UnsupportedSearchQueryTypeError(msg)

Bases: exceptions.Exception

tardis.tardis_portal.fields module

class tardis.tardis_portal.fields.MultiValueCommaSeparatedField(fields=(), *args, **kwargs)

Bases: django.forms.fields.MultiValueField

compress(data_list)

tardis.tardis_portal.forms module

forms module

class tardis.tardis_portal.forms.AddGroupPermissionsForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)

Bases: django.forms.forms.Form

base_fields = {'addgroup': <django.forms.fields.CharField object at 0x7f9df0d24410>, 'authMethod': <django.forms.fields.CharField object at 0x7f9df0d24510>}
declared_fields = {'addgroup': <django.forms.fields.CharField object at 0x7f9df0d24410>, 'authMethod': <django.forms.fields.CharField object at 0x7f9df0d24510>}
media
class tardis.tardis_portal.forms.AddUserPermissionsForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)

Bases: django.forms.forms.Form

base_fields = {'authMethod': <django.forms.fields.CharField object at 0x7f9df0d24150>, 'autocomp_user': <django.forms.fields.CharField object at 0x7f9df0d24050>, 'delete': <django.forms.fields.BooleanField object at 0x7f9df0d24350>, 'entered_user': <django.forms.fields.CharField object at 0x7f9df0d18f90>, 'read': <django.forms.fields.BooleanField object at 0x7f9df0d240d0>, 'write': <django.forms.fields.BooleanField object at 0x7f9df0d242d0>}
declared_fields = {'authMethod': <django.forms.fields.CharField object at 0x7f9df0d24150>, 'autocomp_user': <django.forms.fields.CharField object at 0x7f9df0d24050>, 'delete': <django.forms.fields.BooleanField object at 0x7f9df0d24350>, 'entered_user': <django.forms.fields.CharField object at 0x7f9df0d18f90>, 'read': <django.forms.fields.BooleanField object at 0x7f9df0d240d0>, 'write': <django.forms.fields.BooleanField object at 0x7f9df0d242d0>}
media
class tardis.tardis_portal.forms.ChangeGroupPermissionsForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)

Bases: django.forms.forms.Form

base_fields = {'canDelete': <django.forms.fields.BooleanField object at 0x7f9df0d18dd0>, 'canRead': <django.forms.fields.BooleanField object at 0x7f9df0d18850>, 'canWrite': <django.forms.fields.BooleanField object at 0x7f9df0d18d50>, 'effectiveDate': <django.forms.fields.DateTimeField object at 0x7f9df0d18e10>, 'expiryDate': <django.forms.fields.DateTimeField object at 0x7f9df0d18f10>}
declared_fields = {'canDelete': <django.forms.fields.BooleanField object at 0x7f9df0d18dd0>, 'canRead': <django.forms.fields.BooleanField object at 0x7f9df0d18850>, 'canWrite': <django.forms.fields.BooleanField object at 0x7f9df0d18d50>, 'effectiveDate': <django.forms.fields.DateTimeField object at 0x7f9df0d18e10>, 'expiryDate': <django.forms.fields.DateTimeField object at 0x7f9df0d18f10>}
media
class tardis.tardis_portal.forms.ChangeUserPermissionsForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)

Bases: django.forms.models.ModelForm

class Meta
class 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 MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OWNER_OWNED = 1
SYSTEM_OWNED = 2
aclOwnershipType

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

canDelete

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

canRead

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

canWrite

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

content_object

Provide a generic many-to-one relation through the content_type and object_id fields.

This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.

content_type

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

content_type_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

effectiveDate

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

entityId

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

expiryDate

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_aclOwnershipType_display(**morekwargs)
classmethod 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.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

isOwner

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

object_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
openidaclmigration_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

pluginId

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

fields = ['canDelete', 'canRead', 'canWrite', 'effectiveDate', 'expiryDate', 'isOwner']
model

alias of tardis.tardis_portal.models.access_control.ObjectACL

widgets = {'effectiveDate': <django.forms.widgets.SelectDateWidget object at 0x7f9df0d18750>, 'expiryDate': <django.forms.widgets.SelectDateWidget object at 0x7f9df0d18710>}
base_fields = {'canDelete': <django.forms.fields.BooleanField object at 0x7f9df0d189d0>, 'canRead': <django.forms.fields.BooleanField object at 0x7f9df0d18890>, 'canWrite': <django.forms.fields.BooleanField object at 0x7f9df0d18950>, 'effectiveDate': <django.forms.fields.DateField object at 0x7f9df0d18b50>, 'expiryDate': <django.forms.fields.DateField object at 0x7f9df0d18c90>, 'isOwner': <django.forms.fields.BooleanField object at 0x7f9df0d18a90>}
declared_fields = {}
media
class tardis.tardis_portal.forms.CreateGroupPermissionsForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)

Bases: django.forms.forms.Form

base_fields = {'addgroup': <django.forms.fields.CharField object at 0x7f9df0d245d0>, 'adduser': <django.forms.fields.CharField object at 0x7f9df0d24690>, 'authMethod': <django.forms.fields.CharField object at 0x7f9df0d24710>}
declared_fields = {'addgroup': <django.forms.fields.CharField object at 0x7f9df0d245d0>, 'adduser': <django.forms.fields.CharField object at 0x7f9df0d24690>, 'authMethod': <django.forms.fields.CharField object at 0x7f9df0d24710>}
media
class tardis.tardis_portal.forms.CreateUserPermissionsForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)

Bases: tardis.tardis_portal.forms.RegistrationForm

base_fields = {'authMethod': <django.forms.fields.CharField object at 0x7f9df0d24bd0>, 'email': <django.forms.fields.EmailField object at 0x7f9df0d18390>, 'password1': <django.forms.fields.CharField object at 0x7f9df0d98910>, 'password2': <django.forms.fields.CharField object at 0x7f9df0d18550>, 'username': <django.forms.fields.RegexField object at 0x7f9df0cd9890>}
declared_fields = {'authMethod': <django.forms.fields.CharField object at 0x7f9df0d24bd0>, 'email': <django.forms.fields.EmailField object at 0x7f9df0d18390>, 'password1': <django.forms.fields.CharField object at 0x7f9df0d98910>, 'password2': <django.forms.fields.CharField object at 0x7f9df0d18550>, 'username': <django.forms.fields.RegexField object at 0x7f9df0cd9890>}
media
class tardis.tardis_portal.forms.DatasetForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)

Bases: django.forms.models.ModelForm

class Meta
fields = ['description', 'directory', 'instrument']
model

alias of tardis.tardis_portal.models.dataset.Dataset

base_fields = {'description': <django.forms.fields.CharField object at 0x7f9df0d2e6d0>, 'directory': <django.forms.fields.CharField object at 0x7f9df0d2e950>, 'instrument': <django.forms.models.ModelChoiceField object at 0x7f9df0d2ea10>}
declared_fields = {'description': <django.forms.fields.CharField object at 0x7f9df0d2e6d0>}
media
class tardis.tardis_portal.forms.ExperimentAuthor(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)

Bases: django.forms.models.ModelForm

class Meta
fields = ['author', 'institution', 'email', 'order', 'url']
model

alias of tardis.tardis_portal.models.experiment.ExperimentAuthor

base_fields = {'author': <django.forms.fields.CharField object at 0x7f9df0d2e8d0>, 'email': <django.forms.fields.CharField object at 0x7f9df0d2ed50>, 'institution': <django.forms.fields.CharField object at 0x7f9df0d2ec90>, 'order': <django.forms.fields.IntegerField object at 0x7f9df0d2eed0>, 'url': <django.forms.fields.URLField object at 0x7f9df0d2ef50>}
declared_fields = {}
media
class tardis.tardis_portal.forms.ExperimentForm(data=None, files=None, auto_id='%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=':', empty_permitted=False, instance=None, extra=0)

Bases: django.forms.models.ModelForm

This handles the complex experiment forms.

All internal datasets forms are prefixed with dataset_, and all internal dataset file fields are prefixed with file_. These are parsed out of the post data and added to the form as internal lists.

class FullExperiment(**kwargs)

Bases: UserDict.UserDict

This is a dict wrapper that store the values returned from the tardis.tardis_portal.forms.ExperimentForm.save() function. It provides a convience method for saving the model objects.

save_m2m()

{‘experiment’: experiment, ‘experiment_authors’: experiment_authors, ‘authors’: authors, ‘datasets’: datasets, ‘datafiles’: datafiles}

class Meta
fields = ('title', 'institution_name', 'description')
model

alias of tardis.tardis_portal.models.experiment.Experiment

base_fields = {'description': <django.forms.fields.CharField object at 0x7f9df0c79450>, 'institution_name': <django.forms.fields.CharField object at 0x7f9df0c79350>, 'title': <django.forms.fields.CharField object at 0x7f9df0c792d0>, 'url': <django.forms.fields.CharField object at 0x7f9df0d2e810>}
declared_fields = {'url': <django.forms.fields.CharField object at 0x7f9df0d2e810>}
is_valid()

Test the validity of the form, the form may be invalid even if the error attribute has no contents. This is because the returnd value is dependent on the validity of the nested forms.

This validity also takes into account forign keys that might be dependent on an unsaved model.

Returns:validity
Return type:bool
media
save(commit=True)
class tardis.tardis_portal.forms.ImportParamsForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)

Bases: django.forms.forms.Form

base_fields = {'params': <django.forms.fields.FileField object at 0x7f9df0d24dd0>, 'password': <django.forms.fields.CharField object at 0x7f9df0d24d10>, 'username': <django.forms.fields.CharField object at 0x7f9df0d24c50>}
declared_fields = {'params': <django.forms.fields.FileField object at 0x7f9df0d24dd0>, 'password': <django.forms.fields.CharField object at 0x7f9df0d24d10>, 'username': <django.forms.fields.CharField object at 0x7f9df0d24c50>}
media
class tardis.tardis_portal.forms.LoginForm(*args, **kwargs)

Bases: django.contrib.auth.forms.AuthenticationForm

base_fields = {'password': <django.forms.fields.CharField object at 0x7f9df381bb10>, 'username': <django.contrib.auth.forms.UsernameField object at 0x7f9df381ba50>}
declared_fields = {'password': <django.forms.fields.CharField object at 0x7f9df381bb10>, 'username': <django.contrib.auth.forms.UsernameField object at 0x7f9df381ba50>}
media
class tardis.tardis_portal.forms.ManageAccountForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)

Bases: django.forms.models.ModelForm

Form for changing account details.

class Meta
fields = ('first_name', 'last_name', 'email')
model

alias of django.contrib.auth.models.User

base_fields = {'email': <django.forms.fields.EmailField object at 0x7f9df0c79f10>, 'first_name': <django.forms.fields.CharField object at 0x7f9df0c79c50>, 'last_name': <django.forms.fields.CharField object at 0x7f9df0c79d50>}
declared_fields = {}
media
class tardis.tardis_portal.forms.ManageGroupPermissionsForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)

Bases: django.forms.forms.Form

base_fields = {'adduser': <django.forms.fields.CharField object at 0x7f9df0d24910>, 'admin': <django.forms.fields.BooleanField object at 0x7f9df0d249d0>, 'authMethod': <django.forms.fields.CharField object at 0x7f9df0d24950>}
declared_fields = {'adduser': <django.forms.fields.CharField object at 0x7f9df0d24910>, 'admin': <django.forms.fields.BooleanField object at 0x7f9df0d249d0>, 'authMethod': <django.forms.fields.CharField object at 0x7f9df0d24950>}
media
class tardis.tardis_portal.forms.NoInput(attrs=None)

Bases: django.forms.widgets.Widget

media
render(name, value, attrs=None)
class tardis.tardis_portal.forms.RawSearchForm(*args, **kwargs)

Bases: haystack.forms.SearchForm

base_fields = {'q': <django.forms.fields.CharField object at 0x7f9df0d12090>}
declared_fields = {'q': <django.forms.fields.CharField object at 0x7f9df0d12090>}
media
search()
class tardis.tardis_portal.forms.RegisterExperimentForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)

Bases: django.forms.forms.Form

base_fields = {'experiment_owner': <django.forms.fields.CharField object at 0x7f9df0d2e290>, 'from_url': <django.forms.fields.CharField object at 0x7f9df0d2e450>, 'originid': <django.forms.fields.CharField object at 0x7f9df0d2e350>, 'password': <django.forms.fields.CharField object at 0x7f9df0d2e050>, 'username': <django.forms.fields.CharField object at 0x7f9df0d24f90>, 'xml_filename': <django.forms.fields.CharField object at 0x7f9df0d2e210>, 'xmldata': <django.forms.fields.FileField object at 0x7f9df0d2e110>}
declared_fields = {'experiment_owner': <django.forms.fields.CharField object at 0x7f9df0d2e290>, 'from_url': <django.forms.fields.CharField object at 0x7f9df0d2e450>, 'originid': <django.forms.fields.CharField object at 0x7f9df0d2e350>, 'password': <django.forms.fields.CharField object at 0x7f9df0d2e050>, 'username': <django.forms.fields.CharField object at 0x7f9df0d24f90>, 'xml_filename': <django.forms.fields.CharField object at 0x7f9df0d2e210>, 'xmldata': <django.forms.fields.FileField object at 0x7f9df0d2e110>}
media
class tardis.tardis_portal.forms.RegistrationForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)

Bases: django.forms.forms.Form

Form for registering a new user account.

Validates that the requested username is not already in use, and requires the password to be entered twice to catch typos.

Subclasses should feel free to add any additional validation they need, but should avoid defining a save() method – the actual saving of collected user data is delegated to the active registration backend.

base_fields = {'email': <django.forms.fields.EmailField object at 0x7f9df0d18390>, 'password1': <django.forms.fields.CharField object at 0x7f9df0d98910>, 'password2': <django.forms.fields.CharField object at 0x7f9df0d18550>, 'username': <django.forms.fields.RegexField object at 0x7f9df0cd9890>}
clean()

Verifiy that the values entered into the two password fields match. Note that an error here will end up in non_field_errors() because it doesn’t apply to a single field.

clean_username()

Validate that the username is alphanumeric and is not already in use.

declared_fields = {'email': <django.forms.fields.EmailField object at 0x7f9df0d18390>, 'password1': <django.forms.fields.CharField object at 0x7f9df0d98910>, 'password2': <django.forms.fields.CharField object at 0x7f9df0d18550>, 'username': <django.forms.fields.RegexField object at 0x7f9df0cd9890>}
media
save(**kwargs)
class tardis.tardis_portal.forms.RightsForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)

Bases: django.forms.models.ModelForm

Form for changing public access and licence.

class Meta
fields = ('public_access', 'license')
model

alias of tardis.tardis_portal.models.experiment.Experiment

widgets = {'license': <django.forms.widgets.HiddenInput object at 0x7f9df0c79750>}
base_fields = {'license': <django.forms.models.ModelChoiceField object at 0x7f9df0c799d0>, 'public_access': <django.forms.fields.TypedChoiceField object at 0x7f9df0c79850>}
clean()
declared_fields = {}
media
class tardis.tardis_portal.forms.StaticField(required=True, widget=None, label=None, initial=None, help_text=u'', error_messages=None, show_hidden_initial=False, validators=(), localize=False, disabled=False, label_suffix=None)

Bases: django.forms.fields.Field

clean(value)
widget

alias of NoInput

tardis.tardis_portal.forms.createLinkedUserAuthenticationForm(authMethods)

Create a LinkedUserAuthenticationForm and use the contents of authMethods to the list of options in the dropdown menu for authenticationMethod.

tardis.tardis_portal.forms.createSearchExperimentForm()
tardis.tardis_portal.forms.create_datafile_add_form(schema, parentObject, request=None)
tardis.tardis_portal.forms.create_parameterset_edit_form(parameterset, request=None)
tardis.tardis_portal.forms.getAuthMethodChoices()
tardis.tardis_portal.forms.save_datafile_add_form(schema, parentObject, request)
tardis.tardis_portal.forms.save_datafile_edit_form(parameterset, request)

tardis.tardis_portal.hacks module

hacks.py For hacks which should be removed at a later stage

tardis.tardis_portal.hacks.oracle_dbops_hack(f)

affects only oracle - safe for other database engines

tardis.tardis_portal.iiif module

tardis.tardis_portal.iiif.compliance_header(f)
tardis.tardis_portal.iiif.compute_etag(request, datafile_id, *args, **kwargs)
tardis.tardis_portal.iiif.download_image(request, *args, **kwargs)
tardis.tardis_portal.iiif.download_info(request, *args, **kwargs)

tardis.tardis_portal.logging_middleware module

class tardis.tardis_portal.logging_middleware.LoggingMiddleware(get_response)

Bases: object

process_exception(request, exception)
process_response(request, response)
tardis.tardis_portal.logging_middleware.get_client_ip(request)

tardis.tardis_portal.managers module

managers.py

class tardis.tardis_portal.managers.ExperimentManager

Bases: tardis.tardis_portal.managers.OracleSafeManager

Implements a custom manager for the Experiment model which checks the authorisation rules for the requesting user first

To make this work, the request must be passed to all class functions. The username and the group memberships are then resolved via the user.userprofile.ext_groups and user objects.

The tardis.tardis_portal.auth.AuthService is responsible for filling the request.groups object.

all(user)

Returns all experiments a user - either authenticated or anonymous - is allowed to see and search

Parameters:user (User) – a User instance
Returns:QuerySet of Experiments
Return type:QuerySet
external_users(experiment_id)

returns a list of groups which have external ACL rules

Parameters:experiment_id (int) – the ID of the experiment to be edited
Returns:list of groups with external ACLs
Return type:list
get(user, experiment_id)

Returns an experiment under the consideration of the ACL rules Raises PermissionDenied if the user does not have access.

Parameters:
  • user (User) – a User instance
  • experiment_id (int) – the ID of the experiment to be edited
Returns:

Experiment

Return type:

Experiment

Raises:

PermissionDenied

group_acls_system_owned(experiment_id)

Returns a list of ACL rules associated with this experiment.

Parameters:experiment_id (int) – the ID of the experiment
Returns:QuerySet of system-owned ACLs for experiment
Return type:QuerySet
group_acls_user_owned(experiment_id)

Returns a list of ACL rules associated with this experiment.

Parameters:experiment_id (int) – the ID of the experiment
Returns:QuerySet of ACLs
Return type:QuerySet
owned(user)

Return all experiments which are owned by a particular user, including those shared with a group of which the user is a member.

Parameters:user (User) – a User instance
Returns:QuerySet of Experiments owned by user
Return type:QuerySet
owned_and_shared(user)
owned_by_group(group)

Return all experiments that are owned by a particular group

owned_by_user(user)

Return all experiments which are owned by a particular user id

Parameters:user (User) – a User Object
Returns:QuerySet of Experiments owned by user
Return type:QuerySet
owned_by_user_id(userId)

Return all experiments which are owned by a particular user id

Parameters:userId (int) – a User ID
Returns:QuerySet of Experiments owned by user id
Return type:QuerySet
public()
shared(user)
system_owned_groups(experiment_id)

returns a list of sytem-owned groups which have ACL rules associated with this experiment

Parameters:experiment_id (string) – the ID of the experiment to be edited
Returns:system owned groups for experiment
Return type:QuerySet
user_acls(experiment_id)

Returns a list of ACL rules associated with this experiment.

Parameters:experiment_id (string) – the ID of the experiment
Returns:QuerySet of ACLs
Return type:QuerySet
user_owned_groups(experiment_id)

returns a list of user owned-groups which have ACL rules associated with this experiment

Parameters:experiment_id (int) – the ID of the experiment to be edited
Returns:QuerySet of non system Groups
Return type:QuerySet
users(experiment_id)

Returns a list of users who have ACL rules associated with this experiment.

Parameters:experiment_id (int) – the ID of the experiment
Returns:QuerySet of Users with experiment access
Return type:QuerySet
class tardis.tardis_portal.managers.OracleSafeManager

Bases: django.db.models.manager.Manager

Implements a custom manager which automatically defers the retreival of any TextField fields on calls to get_queryset. This is to avoid the known issue that ‘distinct’ calls on query_sets containing TextFields fail when Oracle is being used as the backend.

get_queryset()

Returns a new QuerySet object. Subclasses can override this method to easily customize the behavior of the Manager.

class tardis.tardis_portal.managers.ParameterNameManager

Bases: django.db.models.manager.Manager

get_by_natural_key(namespace, name)
class tardis.tardis_portal.managers.SchemaManager

Bases: django.db.models.manager.Manager

get_by_natural_key(namespace)

tardis.tardis_portal.rfc3339 module

The function rfc3339 formats dates according to the RFC 3339. rfc3339 tries to have as much as possible sensible defaults.

tardis.tardis_portal.rfc3339.rfc3339(date, utc=False, use_system_timezone=True)

Return a string formatted according to the RFC 3339. If called with utc=True, it normalizes date to the UTC date. If date does not have any timezone information, uses the local timezone:

>>> date = datetime.datetime(2008, 4, 2, 20)
>>> rfc3339(date, utc=True, use_system_timezone=False)
'2008-04-02T20:00:00Z'
>>> rfc3339(date) 
'2008-04-02T20:00:00...'

If called with user_system_time=False don’t use the local timezone and consider the offset to UTC to be zero:

>>> rfc3339(date, use_system_timezone=False)
'2008-04-02T20:00:00+00:00'

date must be a a datetime.datetime, datetime.date or a timestamp as returned by time.time():

>>> rfc3339(0, utc=True, use_system_timezone=False)
'1970-01-01T00:00:00Z'
>>> rfc3339(datetime.date(2008, 9, 6), use_system_timezone=False)
'2008-09-06T00:00:00+00:00'
>>> rfc3339('foo bar')
Traceback (most recent call last):
...
TypeError: excepted datetime, got str instead

tardis.tardis_portal.search_backend module

class tardis.tardis_portal.search_backend.HighlightSearchBackend(connection_alias, **connection_options)

Bases: haystack.backends.elasticsearch_backend.ElasticsearchSearchBackend

search(query_string, sort_by=None, start_offset=0, end_offset=None, fields='', highlight=False, facets=None, date_facets=None, query_facets=None, narrow_queries=None, spelling_query=None, limit_to_registered_models=None, result_class=None, **kwargs)

tardis.tardis_portal.search_query module

search_backend.py

class tardis.tardis_portal.search_query.FacetFixedSearchQuery(using=u'default')

Bases: haystack.backends.elasticsearch_backend.ElasticsearchSearchQuery

get_facet_counts()

tardis.tardis_portal.shortcuts module

class tardis.tardis_portal.shortcuts.RestfulExperimentParameterSet(schema_func, form_cls)

Bases: object

Helper class which enables a Backbone.sync-compatible interface to be created for a ExperimentParameterSet just by specifying a function which provides the schema and a form.

(A function for the schema is required rather than the actual schema, as to run unit tests effectively the object needs to be able to create the schema after instantiation.)

For UI consistency, it’s best to make sure the schema has hidden == true.

schema

Use schema function to get the schema.

view_functions
tardis.tardis_portal.shortcuts.get_experiment_referer(request, dataset_id)
tardis.tardis_portal.shortcuts.redirect_back_with_error(request, message)
tardis.tardis_portal.shortcuts.render_error_message(request, message, status=400)

Render a simple text error message in a generic error page. Any newlines are turned into <br>.

tardis.tardis_portal.shortcuts.render_response_index(request, *args, **kwargs)
tardis.tardis_portal.shortcuts.render_to_file(template, filename, context)
tardis.tardis_portal.shortcuts.return_response_error(request)
tardis.tardis_portal.shortcuts.return_response_error_message(request, redirect_path, context)
tardis.tardis_portal.shortcuts.return_response_not_found(request)

tardis.tardis_portal.signals module

tardis.tardis_portal.tasks module

tardis.tardis_portal.tasks.get_response(_)
tardis.tardis_portal.tasks.init_filters()

load filters and avoid circular import

tardis.tardis_portal.util module

tardis.tardis_portal.util.generate_file_checksums(sourceFile, tempFile=None, leave_open=False)

DEPRECATED Generate checksums, etcetera for a file read from ‘sourceFile’. If ‘tempFile’ is provided, the bytes are written to it as they are read. The result is a tuple comprising the MD5 checksum, the SHA512 checksum, the file length, and chunk containing the start of the file (for doing mimetype guessing if necessary).

tardis.tardis_portal.util.get_filesystem_safe_dataset_name(dataset)

Given a Dataset, return a filesystem safe string representing the dataset. Useful for filenames for dataset downloads, maybe URLs.

Parameters:dataset (tardis.tardis_portal.models.dataset.Dataset) – A Dataset object.
Returns:A filesystem safe string as a Dataset name.
Return type:basestring
tardis.tardis_portal.util.get_filesystem_safe_experiment_name(experiment)

Given an Experiment, return a filesystem safe string representing the experiment. Useful for filenames for experiment downloads, maybe URLs.

Parameters:experiment (tardis.tardis_portal.models.experiment.Experiment) – A Experiment object.
Returns:A filesystem safe string as a Experiment name.
Return type:basestring
tardis.tardis_portal.util.get_free_space(fs_dir)

Return free space on the file system holding the given directory (in bytes). This should work on Linux, BSD, Mac OSX and Windows.

tardis.tardis_portal.util.get_local_time(dt)

Ensure datetime is timezone-aware and in local time.

If the USE_TZ setting in the current dev version of Django comes in, this should keep providing correct behaviour.

tardis.tardis_portal.util.get_utc_time(dt)

Ensure datetime is timezone-aware and in UTC time.

If the USE_TZ setting in the current dev version of Django comes in, this should keep providing correct behaviour.

tardis.tardis_portal.util.render_mustache(template_name, data)
tardis.tardis_portal.util.render_public_access_badge(experiment)
tardis.tardis_portal.util.split_path(p)

tardis.tardis_portal.widgets module

class tardis.tardis_portal.widgets.CommaSeparatedInput(attrs=None)

Bases: django.forms.widgets.TextInput

media
render(name, value, attrs=None, renderer=None)
value_from_datadict(data, files, name)
class tardis.tardis_portal.widgets.Label(attrs=None)

Bases: django.forms.widgets.Widget

media
render(name, value, attrs=None)
tag = 'label'
class tardis.tardis_portal.widgets.Span(attrs=None)

Bases: tardis.tardis_portal.widgets.Label

media
tag = 'span'

tardis.tardis_portal.xmlwriter module

class tardis.tardis_portal.xmlwriter.XMLWriter
static write_template_to_dir(dest_dir, dest_filename, template_path, context)
Parameters:
  • dest_dir (string) – The directory to store the resulting document in
  • dest_filename (string) – The name of the file to be output
  • template_path (string) – The relative path to the Django template to be rendered
  • context (django.template.context.Context) – The Context object (dictionary of variables for template output)
Returns:

The full path to the created file

Return type:

string

static write_template_to_file(prefix_dir, objectprefix, uniqueid, templatepath, context)
Parameters:
  • prefix_dir (string) – The subdirectory off of the OAI_DOCS_PATH to store the resulting document in
  • objectprefix (string) – The name prefix of the resulting file. Files are output in the format prefix-uniqueid.xml
  • uniqueid (string) – The unique ID of the file to be output
  • templatepath (string) – The relative path to the Django template to be rendered
  • context (django.template.context.Context) – The Context object (dictionary of variables for template output)
Returns:

The full path to the created file

Return type:

string

static write_xml_to_file(prefix_dir, objectprefix, uniqueid, xmlstring)
Parameters:
  • prefix_dir (string) – The subdirectory off of the OAI_DOCS_PATH to store the resulting document in
  • objectprefix (string) – The name prefix of the resulting file. Files are output in the format prefix-uniqueid.xml
  • uniqueid (string) – The unique ID of the file to be output
  • xmlstring (string) – The relative path to the Django template to be rendered
Returns:

The full path to the created file

Return type:

string

tardis.tardis_portal.xmlwriter.logger = <celery.utils.log.ProcessAwareLogger object>

XML Writer

A set of static methods for writing xml files.

Module contents

importing all views files here, so that any old code will work as expected, when importing from tardis.tardis_portal.views

models/__init__.py