tardis.tardis_portal package

Subpackages

Submodules

tardis.tardis_portal.MultiPartForm module

class tardis.tardis_portal.MultiPartForm.MultiPartForm

Bases: object

Accumulate the data to be used when posting a form.

add_field(name, value)

Add a simple field to the form data.

add_file(fieldname, filename, fileHandle, mimetype=None)

Add a file to be uploaded.

get_content_type()

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 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)

Bases: django.forms.models.ModelForm

class Meta
fields = '__all__'
model

alias of DataFileObject

widgets = {'uri': <django.forms.widgets.TextInput object at 0x7f455bb3fd10>}
DataFileObjectInlineForm.base_fields = OrderedDict([('datafile', <django.forms.models.ModelChoiceField object at 0x7f455bb4c4d0>), ('storage_box', <django.forms.models.ModelChoiceField object at 0x7f455bb4c690>), ('uri', <django.forms.fields.CharField object at 0x7f455bb4c750>), ('verified', <django.forms.fields.BooleanField object at 0x7f455bb4c890>), ('last_verified_time', <django.forms.fields.DateTimeField object at 0x7f455bb4c910>)])
DataFileObjectInlineForm.declared_fields = OrderedDict()
DataFileObjectInlineForm.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)

Bases: django.forms.models.ModelForm

class Meta
fields = '__all__'
model

alias of DataFile

widgets = {'directory': <django.forms.widgets.TextInput object at 0x7f455bb4c490>}
DatafileAdminForm.base_fields = OrderedDict([('dataset', <django.forms.models.ModelChoiceField object at 0x7f455bb4cb10>), ('filename', <django.forms.fields.CharField object at 0x7f455bb4ccd0>), ('directory', <django.forms.fields.CharField object at 0x7f455bb4cd90>), ('size', <django.forms.fields.IntegerField object at 0x7f455bb4ce90>), ('created_time', <django.forms.fields.DateTimeField object at 0x7f455bb5a050>), ('modification_time', <django.forms.fields.DateTimeField object at 0x7f455bb5a0d0>), ('mimetype', <django.forms.fields.CharField object at 0x7f455bb5a150>), ('md5sum', <django.forms.fields.CharField object at 0x7f455bb5a210>), ('sha512sum', <django.forms.fields.CharField object at 0x7f455bb5a310>), ('deleted', <django.forms.fields.BooleanField object at 0x7f455bb5a410>), ('deleted_time', <django.forms.fields.DateTimeField object at 0x7f455bb5a4d0>), ('version', <django.forms.fields.IntegerField object at 0x7f455bb5a550>)])
DatafileAdminForm.declared_fields = OrderedDict()
DatafileAdminForm.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 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.FreeTextSearchFieldAdmin(model, admin_site)

Bases: django.contrib.admin.options.ModelAdmin

media
class tardis.tardis_portal.admin.InstrumentParameterInline(parent_model, admin_site)

Bases: django.contrib.admin.options.TabularInline

extra = 0
media
model

alias of 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 = ['__unicode__', '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 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 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
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 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)

Bases: django.forms.models.ModelForm

class Meta
fields = '__all__'
model

alias of StorageBoxAttribute

widgets = {'value': <django.forms.widgets.TextInput object at 0x7f455bb3f250>, 'key': <django.forms.widgets.TextInput object at 0x7f455bb3f1d0>}
StorageBoxAttributeInlineForm.base_fields = OrderedDict([('storage_box', <django.forms.models.ModelChoiceField object at 0x7f455bb3f4d0>), ('key', <django.forms.fields.CharField object at 0x7f455bb3f690>), ('value', <django.forms.fields.CharField object at 0x7f455bb3f6d0>)])
StorageBoxAttributeInlineForm.declared_fields = OrderedDict()
StorageBoxAttributeInlineForm.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)

Bases: django.forms.models.ModelForm

class Meta
fields = '__all__'
model

alias of StorageBox

widgets = {'name': <django.forms.widgets.TextInput object at 0x7f455bb3fb90>, 'django_storage_class': <django.forms.widgets.TextInput object at 0x7f455bb3f890>, 'description': <django.forms.widgets.TextInput object at 0x7f455bb3fbd0>}
StorageBoxForm.base_fields = OrderedDict([('django_storage_class', <django.forms.fields.CharField object at 0x7f455bb3fd50>), ('max_size', <django.forms.fields.IntegerField object at 0x7f455bb3fdd0>), ('status', <django.forms.fields.CharField object at 0x7f455bb3ff10>), ('name', <django.forms.fields.CharField object at 0x7f455bb4c050>), ('description', <django.forms.fields.CharField object at 0x7f455bb4c110>), ('master_box', <django.forms.models.ModelChoiceField object at 0x7f455bb4c190>)])
StorageBoxForm.declared_fields = OrderedDict()
StorageBoxForm.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 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)

Bases: django.forms.models.ModelForm

class Meta
fields = '__all__'
model

alias of StorageBoxOption

widgets = {'value': <django.forms.widgets.TextInput object at 0x7f455bb3f710>, 'key': <django.forms.widgets.TextInput object at 0x7f455bb3f490>}
StorageBoxOptionInlineForm.base_fields = OrderedDict([('storage_box', <django.forms.models.ModelChoiceField object at 0x7f455bb3f8d0>), ('key', <django.forms.fields.CharField object at 0x7f455bb3fa90>), ('value', <django.forms.fields.CharField object at 0x7f455bb3fad0>), ('value_type', <django.forms.fields.TypedChoiceField object at 0x7f455bb3fb10>)])
StorageBoxOptionInlineForm.declared_fields = OrderedDict()
StorageBoxOptionInlineForm.media

tardis.tardis_portal.ands_doi module

ands_doi.py

class tardis.tardis_portal.ands_doi.DOIService(experiment)

Bases: object

Mints DOIs using ANDS’ Cite My Data service POSTs DataCite XML to a web services endpoint

get_doi()
Returns:DOI or None

:rtype string

get_or_mint_doi(url)
Parameters:url (string) – the URL the DOI will resolve to
Returns:the DOI string

:rtype string

class tardis.tardis_portal.ands_doi.DOIXMLProvider(experiment)

Bases: object

provides datacite XML metadata for a given experiment

datacite_xml()
Returns:datacite XML for self.experiment
Return type:string

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)
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 = {'directory': ('exact', 'startswith'), 'filename': ('exact',), 'dataset': 2}
object_class

alias of DataFile

ordering = ['filename', 'modification_time']
queryset
resource_name = 'dataset_file'
DataFileResource.base_fields = {'sha512sum': <tastypie.fields.CharField object at 0x7f4559d4aa50>, 'replicas': <tastypie.fields.ToManyField object at 0x7f4559d4af50>, 'deleted': <tastypie.fields.BooleanField object at 0x7f4559d4a990>, 'dataset': <tastypie.fields.ForeignKey object at 0x7f4559d4a590>, 'modification_time': <tastypie.fields.DateTimeField object at 0x7f4559d4a310>, 'created_time': <tastypie.fields.DateTimeField object at 0x7f4559d4a2d0>, u'id': <tastypie.fields.IntegerField object at 0x7f4559d4a050>, 'size': <tastypie.fields.CharField object at 0x7f4559d4a290>, 'mimetype': <tastypie.fields.CharField object at 0x7f4559d4a450>, 'datafile': <tastypie.fields.FileField object at 0x7f4559d4a350>, 'deleted_time': <tastypie.fields.DateTimeField object at 0x7f4559d4aa90>, 'md5sum': <tastypie.fields.CharField object at 0x7f4559d4a410>, 'filename': <tastypie.fields.CharField object at 0x7f4559d4a210>, 'version': <tastypie.fields.IntegerField object at 0x7f4559d4aad0>, 'directory': <tastypie.fields.CharField object at 0x7f4559d4a250>, 'parameter_sets': <tastypie.fields.ToManyField object at 0x7f4559d4a490>, u'resource_uri': <tastypie.fields.CharField object at 0x7f4559d4ae10>}
DataFileResource.declared_fields = {'datafile': <tastypie.fields.FileField object at 0x7f4559d4a350>, 'dataset': <tastypie.fields.ForeignKey object at 0x7f4559d4a590>, 'parameter_sets': <tastypie.fields.ToManyField object at 0x7f4559d4a490>, 'replicas': <tastypie.fields.ToManyField object at 0x7f4559d4af50>}
DataFileResource.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

DataFileResource.download_file(request, **kwargs)

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

DataFileResource.hydrate(bundle)
DataFileResource.obj_create(bundle, **kwargs)
DataFileResource.post_list(request, **kwargs)
DataFileResource.prepend_urls()
DataFileResource.put_detail(request, **kwargs)

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

DataFileResource.temp_url = None
DataFileResource.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 DatafileParameter

queryset
DatafileParameterResource.base_fields = {'name': <tastypie.fields.ForeignKey object at 0x7f4559e17ad0>, 'string_value': <tastypie.fields.CharField object at 0x7f4559e17290>, 'datetime_value': <tastypie.fields.DateTimeField object at 0x7f4559e17110>, 'value': <tastypie.fields.CharField object at 0x7f4559e17750>, 'link_id': <tastypie.fields.IntegerField object at 0x7f4559e170d0>, 'numerical_value': <tastypie.fields.FloatField object at 0x7f4559e17590>, 'parameterset': <tastypie.fields.ForeignKey object at 0x7f4559d4a6d0>, u'id': <tastypie.fields.IntegerField object at 0x7f4559e17490>, u'resource_uri': <tastypie.fields.CharField object at 0x7f4559e17550>}
DatafileParameterResource.declared_fields = {'parameterset': <tastypie.fields.ForeignKey object at 0x7f4559d4a6d0>}
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 DatafileParameterSet

queryset
DatafileParameterSetResource.base_fields = {'datafile': <tastypie.fields.ForeignKey object at 0x7f4559d4add0>, u'resource_uri': <tastypie.fields.CharField object at 0x7f4559d4ae50>, u'id': <tastypie.fields.IntegerField object at 0x7f4559d4ae90>, 'parameters': <tastypie.fields.ToManyField object at 0x7f4559d4ab10>, 'schema': <tastypie.fields.ForeignKey object at 0x7f4559d4a690>}
DatafileParameterSetResource.declared_fields = {'datafile': <tastypie.fields.ForeignKey object at 0x7f4559d4add0>, 'parameters': <tastypie.fields.ToManyField object at 0x7f4559d4ab10>}
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 DatasetParameter

queryset
DatasetParameterResource.base_fields = {'name': <tastypie.fields.ForeignKey object at 0x7f4559e0c450>, 'string_value': <tastypie.fields.CharField object at 0x7f4559e0ccd0>, 'datetime_value': <tastypie.fields.DateTimeField object at 0x7f4559e0cd50>, 'value': <tastypie.fields.CharField object at 0x7f4559e0cf50>, 'link_id': <tastypie.fields.IntegerField object at 0x7f4559e0c8d0>, 'numerical_value': <tastypie.fields.FloatField object at 0x7f4559e0ca50>, 'parameterset': <tastypie.fields.ForeignKey object at 0x7f4559e0c550>, u'id': <tastypie.fields.IntegerField object at 0x7f4559e0cd90>, u'resource_uri': <tastypie.fields.CharField object at 0x7f4559e0cfd0>}
DatasetParameterResource.declared_fields = {'parameterset': <tastypie.fields.ForeignKey object at 0x7f4559e0c550>}
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 DatasetParameterSet

queryset
DatasetParameterSetResource.base_fields = {'dataset': <tastypie.fields.ForeignKey object at 0x7f455baaef50>, u'resource_uri': <tastypie.fields.CharField object at 0x7f4559e0ce50>, u'id': <tastypie.fields.IntegerField object at 0x7f4559e0c4d0>, 'parameters': <tastypie.fields.ToManyField object at 0x7f455ba32310>, 'schema': <tastypie.fields.ForeignKey object at 0x7f4559e0ce10>}
DatasetParameterSetResource.declared_fields = {'parameters': <tastypie.fields.ToManyField object at 0x7f455ba32310>, 'dataset': <tastypie.fields.ForeignKey object at 0x7f455baaef50>}
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 = {'directory': ('exact',), 'experiments': 2, 'id': ('exact',), 'description': ('exact',)}
object_class

alias of Dataset

ordering = ['description']
queryset
DatasetResource.base_fields = {'description': <tastypie.fields.CharField object at 0x7f4559d4a3d0>, 'immutable': <tastypie.fields.BooleanField object at 0x7f4559d4a810>, u'id': <tastypie.fields.IntegerField object at 0x7f4559d4a390>, 'instrument': <tastypie.fields.ForeignKey object at 0x7f4559dd14d0>, 'experiments': <tastypie.fields.ToManyField object at 0x7f4559dd1d90>, 'directory': <tastypie.fields.CharField object at 0x7f4559d4a7d0>, 'parameter_sets': <tastypie.fields.ToManyField object at 0x7f4559dd1b90>, u'resource_uri': <tastypie.fields.CharField object at 0x7f4559d4a190>}
DatasetResource.declared_fields = {'instrument': <tastypie.fields.ForeignKey object at 0x7f4559dd14d0>, 'experiments': <tastypie.fields.ToManyField object at 0x7f4559dd1d90>, 'parameter_sets': <tastypie.fields.ToManyField object at 0x7f4559dd1b90>}
DatasetResource.get_datafiles(request, **kwargs)
DatasetResource.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 ExperimentParameter

queryset
ExperimentParameterResource.base_fields = {'name': <tastypie.fields.ForeignKey object at 0x7f455ba27e10>, 'string_value': <tastypie.fields.CharField object at 0x7f455aae1650>, 'datetime_value': <tastypie.fields.DateTimeField object at 0x7f455aae1e10>, 'value': <tastypie.fields.CharField object at 0x7f455ba27d10>, 'link_id': <tastypie.fields.IntegerField object at 0x7f455aae1f10>, 'numerical_value': <tastypie.fields.FloatField object at 0x7f455aae1fd0>, 'parameterset': <tastypie.fields.ForeignKey object at 0x7f455ba27450>, u'id': <tastypie.fields.IntegerField object at 0x7f455aae1e90>, u'resource_uri': <tastypie.fields.CharField object at 0x7f455ba27d90>}
ExperimentParameterResource.declared_fields = {'parameterset': <tastypie.fields.ForeignKey object at 0x7f455ba27450>}
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 ExperimentParameterSet

queryset
ExperimentParameterSetResource.base_fields = {u'id': <tastypie.fields.IntegerField object at 0x7f455ba27250>, u'resource_uri': <tastypie.fields.CharField object at 0x7f455ba27390>, 'experiment': <tastypie.fields.ForeignKey object at 0x7f455ba27510>, 'parameters': <tastypie.fields.ToManyField object at 0x7f455ba27650>, 'schema': <tastypie.fields.ForeignKey object at 0x7f455ba273d0>}
ExperimentParameterSetResource.declared_fields = {'experiment': <tastypie.fields.ForeignKey object at 0x7f455ba27510>, 'parameters': <tastypie.fields.ToManyField object at 0x7f455ba27650>}
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 Experiment

ordering = ['title', 'created_time', 'update_time']
queryset
ExperimentResource.base_fields = {'update_time': <tastypie.fields.DateTimeField object at 0x7f455ba32c90>, 'handle': <tastypie.fields.CharField object at 0x7f455ba329d0>, 'description': <tastypie.fields.CharField object at 0x7f455baae490>, 'start_time': <tastypie.fields.DateTimeField object at 0x7f455ba32e90>, 'created_time': <tastypie.fields.DateTimeField object at 0x7f455ba32050>, 'public_access': <tastypie.fields.IntegerField object at 0x7f455ba32910>, 'approved': <tastypie.fields.BooleanField object at 0x7f455baae290>, 'locked': <tastypie.fields.BooleanField object at 0x7f455ba328d0>, 'title': <tastypie.fields.CharField object at 0x7f455baae310>, 'url': <tastypie.fields.CharField object at 0x7f455baae2d0>, 'institution_name': <tastypie.fields.CharField object at 0x7f455baae350>, 'created_by': <tastypie.fields.ForeignKey object at 0x7f455ba27690>, u'id': <tastypie.fields.IntegerField object at 0x7f455baaefd0>, 'end_time': <tastypie.fields.DateTimeField object at 0x7f455ba32c10>, 'parameter_sets': <tastypie.fields.ToManyField object at 0x7f455aaf8050>, u'resource_uri': <tastypie.fields.CharField object at 0x7f455baae210>}
ExperimentResource.declared_fields = {'parameter_sets': <tastypie.fields.ToManyField object at 0x7f455aaf8050>, 'created_by': <tastypie.fields.ForeignKey object at 0x7f455ba27690>}
ExperimentResource.dehydrate(bundle)
ExperimentResource.hydrate_m2m(bundle)

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

ExperimentResource.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.

ExperimentResource.obj_get_list(bundle, **kwargs)

responds to EPN query for Australian Synchrotron

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 = {'manager_group': 2, 'id': ('exact',), 'name': ('exact',)}
object_class

alias of Facility

queryset
FacilityResource.base_fields = {'manager_group': <tastypie.fields.ForeignKey object at 0x7f4559dd1310>, u'id': <tastypie.fields.IntegerField object at 0x7f4559dd1ed0>, 'name': <tastypie.fields.CharField object at 0x7f4559dd1110>, u'resource_uri': <tastypie.fields.CharField object at 0x7f4559dd1b50>}
FacilityResource.declared_fields = {'manager_group': <tastypie.fields.ForeignKey object at 0x7f4559dd1310>}
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 Group

queryset
GroupResource.base_fields = {u'id': <tastypie.fields.IntegerField object at 0x7f455ba94a10>, 'name': <tastypie.fields.CharField object at 0x7f455ba94790>, u'resource_uri': <tastypie.fields.CharField object at 0x7f455ba94f90>}
GroupResource.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 = {'id': ('exact',), 'name': ('exact',), 'facility': 2}
object_class

alias of Instrument

queryset
InstrumentResource.base_fields = {'facility': <tastypie.fields.ForeignKey object at 0x7f4559dd1290>, u'id': <tastypie.fields.IntegerField object at 0x7f4559dd1990>, 'name': <tastypie.fields.CharField object at 0x7f4559dd19d0>, u'resource_uri': <tastypie.fields.CharField object at 0x7f4559dd1fd0>}
InstrumentResource.declared_fields = {'facility': <tastypie.fields.ForeignKey object at 0x7f4559dd1290>}
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 StorageBox

queryset
LocationResource.base_fields = {'status': <tastypie.fields.CharField object at 0x7f4559e174d0>, 'description': <tastypie.fields.CharField object at 0x7f4559e175d0>, 'name': <tastypie.fields.CharField object at 0x7f4559e17b50>, 'max_size': <tastypie.fields.CharField object at 0x7f4559e172d0>, u'id': <tastypie.fields.IntegerField object at 0x7f4559e17250>, 'django_storage_class': <tastypie.fields.CharField object at 0x7f4559e17210>, u'resource_uri': <tastypie.fields.CharField object at 0x7f4559e17090>}
LocationResource.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.

serializer = <tardis.tardis_portal.api.PrettyJSONSerializer object>
MyTardisModelResource.base_fields = {u'resource_uri': <tastypie.fields.CharField object at 0x7f455ba9d910>}
MyTardisModelResource.declared_fields = {}
MyTardisModelResource.lookup_kwargs_with_identifiers(bundle, kwargs)
MyTardisModelResource.patch_list(request, **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 = {'pluginId': ('exact',), 'entityId': ('exact',)}
object_class

alias of ObjectACL

queryset
ObjectACLResource.base_fields = {'canDelete': <tastypie.fields.BooleanField object at 0x7f4559ceb510>, 'effectiveDate': <tastypie.fields.DateTimeField object at 0x7f4559ceb650>, 'pluginId': <tastypie.fields.CharField object at 0x7f4559ceb090>, 'object_id': <tastypie.fields.IntegerField object at 0x7f4559ceb290>, 'expiryDate': <tastypie.fields.DateTimeField object at 0x7f4559ceb310>, 'content_object': <tastypie.contrib.contenttypes.fields.GenericForeignKeyField object at 0x7f4559e17d90>, 'isOwner': <tastypie.fields.BooleanField object at 0x7f4559ceb610>, 'canWrite': <tastypie.fields.BooleanField object at 0x7f4559ceb590>, 'canRead': <tastypie.fields.BooleanField object at 0x7f4559ceb210>, 'entityId': <tastypie.fields.CharField object at 0x7f4559ceb150>, 'aclOwnershipType': <tastypie.fields.IntegerField object at 0x7f4559ceb350>, u'id': <tastypie.fields.IntegerField object at 0x7f4559ceb110>, u'resource_uri': <tastypie.fields.CharField object at 0x7f4559ceb390>}
ObjectACLResource.declared_fields = {'content_object': <tastypie.contrib.contenttypes.fields.GenericForeignKeyField object at 0x7f4559e17d90>}
ObjectACLResource.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 ParameterName

queryset
ParameterNameResource.base_fields = {'name': <tastypie.fields.CharField object at 0x7f455ba9d9d0>, 'data_type': <tastypie.fields.IntegerField object at 0x7f455ba9db50>, 'immutable': <tastypie.fields.BooleanField object at 0x7f455ba27290>, 'is_searchable': <tastypie.fields.BooleanField object at 0x7f455ba27310>, 'order': <tastypie.fields.IntegerField object at 0x7f455ba272d0>, 'comparison_type': <tastypie.fields.IntegerField object at 0x7f455ba27490>, 'choices': <tastypie.fields.CharField object at 0x7f455ba27410>, 'full_name': <tastypie.fields.CharField object at 0x7f455ba9dd50>, 'units': <tastypie.fields.CharField object at 0x7f455ba9dcd0>, u'resource_uri': <tastypie.fields.CharField object at 0x7f455ba9dd90>, u'id': <tastypie.fields.IntegerField object at 0x7f455ba9d890>, 'schema': <tastypie.fields.ForeignKey object at 0x7f455ba9df10>}
ParameterNameResource.declared_fields = {'schema': <tastypie.fields.ForeignKey object at 0x7f455ba9df10>}
class tardis.tardis_portal.api.ParameterResource(api_name=None)

Bases: tardis.tardis_portal.api.MyTardisModelResource

base_fields = {'name': <tastypie.fields.ForeignKey object at 0x7f455ba9db90>, 'value': <tastypie.fields.CharField object at 0x7f455ba27050>, u'resource_uri': <tastypie.fields.CharField object at 0x7f455ba27f90>}
declared_fields = {'name': <tastypie.fields.ForeignKey object at 0x7f455ba9db90>, 'value': <tastypie.fields.CharField object at 0x7f455ba27050>}
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 = {'schema': <tastypie.fields.ForeignKey object at 0x7f455ba270d0>, u'resource_uri': <tastypie.fields.CharField object at 0x7f455ba27210>}
declared_fields = {'schema': <tastypie.fields.ForeignKey object at 0x7f455ba270d0>}
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 DataFileObject

queryset
ReplicaResource.base_fields = {'datafile': <tastypie.fields.ForeignKey object at 0x7f4559e17050>, 'verified': <tastypie.fields.BooleanField object at 0x7f4559e17c90>, 'last_verified_time': <tastypie.fields.DateTimeField object at 0x7f4559e17c50>, 'created_time': <tastypie.fields.DateTimeField object at 0x7f4559e17b10>, 'uri': <tastypie.fields.CharField object at 0x7f4559e17e90>, u'id': <tastypie.fields.IntegerField object at 0x7f4559e17ed0>, u'resource_uri': <tastypie.fields.CharField object at 0x7f4559e17d50>}
ReplicaResource.declared_fields = {'datafile': <tastypie.fields.ForeignKey object at 0x7f4559e17050>}
ReplicaResource.dehydrate(bundle)
ReplicaResource.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 = {'namespace': ('exact',), 'id': ('exact',)}
object_class

alias of Schema

queryset
SchemaResource.base_fields = {'name': <tastypie.fields.CharField object at 0x7f455ba9da50>, 'namespace': <tastypie.fields.CharField object at 0x7f455ba9de10>, u'id': <tastypie.fields.IntegerField object at 0x7f455ba9d790>, 'subtype': <tastypie.fields.CharField object at 0x7f455ba9d050>, 'hidden': <tastypie.fields.BooleanField object at 0x7f455ba9d950>, 'type': <tastypie.fields.IntegerField object at 0x7f455ba9dc90>, 'immutable': <tastypie.fields.BooleanField object at 0x7f455ba9dad0>, u'resource_uri': <tastypie.fields.CharField object at 0x7f455ba9da10>}
SchemaResource.declared_fields = {}
SchemaResource.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 StorageBoxAttribute

queryset
StorageBoxAttributeResource.base_fields = {u'id': <tastypie.fields.IntegerField object at 0x7f4559dd11d0>, 'key': <tastypie.fields.CharField object at 0x7f4559dd1a90>, 'value': <tastypie.fields.CharField object at 0x7f4559dd1790>, 'storage_box': <tastypie.fields.ForeignKey object at 0x7f4559dd1050>, u'resource_uri': <tastypie.fields.CharField object at 0x7f4559dd1b10>}
StorageBoxAttributeResource.declared_fields = {'storage_box': <tastypie.fields.ForeignKey object at 0x7f4559dd1050>}
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 StorageBoxOption

queryset
StorageBoxOptionResource.accessible_keys = ['location']
StorageBoxOptionResource.base_fields = {'value_type': <tastypie.fields.CharField object at 0x7f4559dd1bd0>, 'key': <tastypie.fields.CharField object at 0x7f4559dd12d0>, 'storage_box': <tastypie.fields.ForeignKey object at 0x7f4559e0cf90>, u'id': <tastypie.fields.IntegerField object at 0x7f4559dd10d0>, 'value': <tastypie.fields.CharField object at 0x7f4559dd1690>, u'resource_uri': <tastypie.fields.CharField object at 0x7f4559dd1350>}
StorageBoxOptionResource.declared_fields = {'storage_box': <tastypie.fields.ForeignKey object at 0x7f4559e0cf90>}
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 StorageBox

queryset
StorageBoxResource.base_fields = {'status': <tastypie.fields.CharField object at 0x7f4559e0c910>, 'description': <tastypie.fields.CharField object at 0x7f4559dd1210>, 'name': <tastypie.fields.CharField object at 0x7f4559e0c850>, u'id': <tastypie.fields.IntegerField object at 0x7f4559e0c650>, 'max_size': <tastypie.fields.CharField object at 0x7f4559e0c990>, 'attributes': <tastypie.fields.ToManyField object at 0x7f4559e0c710>, 'options': <tastypie.fields.ToManyField object at 0x7f4559e0c5d0>, 'django_storage_class': <tastypie.fields.CharField object at 0x7f4559e0c590>, u'resource_uri': <tastypie.fields.CharField object at 0x7f4559e0ced0>}
StorageBoxResource.declared_fields = {'attributes': <tastypie.fields.ToManyField object at 0x7f4559e0c710>, 'options': <tastypie.fields.ToManyField object at 0x7f4559e0c5d0>}
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 = {'username': ('exact',), 'email': ('iexact',)}
object_class

alias of User

queryset
serializer = <tardis.tardis_portal.api.PrettyJSONSerializer object>
UserResource.base_fields = {'username': <tastypie.fields.CharField object at 0x7f455ba94990>, 'first_name': <tastypie.fields.CharField object at 0x7f455ba94f50>, 'last_name': <tastypie.fields.CharField object at 0x7f455ba94e50>, 'groups': <tastypie.fields.ManyToManyField object at 0x7f455ba94b50>, 'email': <tastypie.fields.CharField object at 0x7f455ba94d90>, u'resource_uri': <tastypie.fields.CharField object at 0x7f455ba949d0>}
UserResource.declared_fields = {'groups': <tastypie.fields.ManyToManyField object at 0x7f455ba94b50>}
UserResource.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.manage_account_processor(request)
tardis.tardis_portal.context_processors.registration_processor(request)
tardis.tardis_portal.context_processors.single_search_processor(request)
tardis.tardis_portal.context_processors.tokenuser_processor(request)
tardis.tardis_portal.context_processors.user_details_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.download module

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.fetcher module

tardis.tardis_portal.fetcher.get_credential_handler()
tardis.tardis_portal.fetcher.get_privileged_opener()

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)

Bases: django.forms.forms.Form

base_fields = OrderedDict([('addgroup', <django.forms.fields.CharField object at 0x7f4559ba2ad0>), ('authMethod', <django.forms.fields.CharField object at 0x7f4559ba2bd0>)])
declared_fields = OrderedDict([('addgroup', <django.forms.fields.CharField object at 0x7f4559ba2ad0>), ('authMethod', <django.forms.fields.CharField object at 0x7f4559ba2bd0>)])
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)

Bases: django.forms.forms.Form

base_fields = OrderedDict([('entered_user', <django.forms.fields.CharField object at 0x7f4559ba2650>), ('autocomp_user', <django.forms.fields.CharField object at 0x7f4559ba2710>), ('authMethod', <django.forms.fields.CharField object at 0x7f4559ba2810>), ('read', <django.forms.fields.BooleanField object at 0x7f4559ba2850>), ('write', <django.forms.fields.BooleanField object at 0x7f4559ba28d0>), ('delete', <django.forms.fields.BooleanField object at 0x7f4559ba2950>)])
declared_fields = OrderedDict([('entered_user', <django.forms.fields.CharField object at 0x7f4559ba2650>), ('autocomp_user', <django.forms.fields.CharField object at 0x7f4559ba2710>), ('authMethod', <django.forms.fields.CharField object at 0x7f4559ba2810>), ('read', <django.forms.fields.BooleanField object at 0x7f4559ba2850>), ('write', <django.forms.fields.BooleanField object at 0x7f4559ba28d0>), ('delete', <django.forms.fields.BooleanField object at 0x7f4559ba2950>)])
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)

Bases: django.forms.forms.Form

class SelectDateWidget(attrs=None, years=None, months=None, empty_label=None)

Bases: django.forms.widgets.Widget

A Widget that splits date input into three <select> boxes.

This also serves as an example of a Widget that has more than one HTML element and hence implements value_from_datadict.

create_select(name, field, value, val, choices, none_value)
day_field = u'%s_day'
id_for_label(id_)
media
month_field = u'%s_month'
none_value = (0, u'---')
render(name, value, attrs=None)
value_from_datadict(data, files, name)
year_field = u'%s_year'
ChangeGroupPermissionsForm.base_fields = OrderedDict([('canRead', <django.forms.fields.BooleanField object at 0x7f4559ba2150>), ('canWrite', <django.forms.fields.BooleanField object at 0x7f4559ba2410>), ('canDelete', <django.forms.fields.BooleanField object at 0x7f4559ba2490>), ('effectiveDate', <django.forms.fields.DateTimeField object at 0x7f4559ba2550>), ('expiryDate', <django.forms.fields.DateTimeField object at 0x7f4559ba25d0>)])
ChangeGroupPermissionsForm.declared_fields = OrderedDict([('canRead', <django.forms.fields.BooleanField object at 0x7f4559ba2150>), ('canWrite', <django.forms.fields.BooleanField object at 0x7f4559ba2410>), ('canDelete', <django.forms.fields.BooleanField object at 0x7f4559ba2490>), ('effectiveDate', <django.forms.fields.DateTimeField object at 0x7f4559ba2550>), ('expiryDate', <django.forms.fields.DateTimeField object at 0x7f4559ba25d0>)])
ChangeGroupPermissionsForm.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)

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 ChangeUserPermissionsForm.Meta.ObjectACL.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

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

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

ChangeUserPermissionsForm.Meta.ObjectACL.content_type
ChangeUserPermissionsForm.Meta.ObjectACL.get_aclOwnershipType_display(*moreargs, **morekwargs)
classmethod ChangeUserPermissionsForm.Meta.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.

ChangeUserPermissionsForm.Meta.ObjectACL.objects = <django.db.models.manager.Manager object>
class ChangeUserPermissionsForm.Meta.SelectDateWidget(attrs=None, years=None, months=None, empty_label=None)

Bases: django.forms.widgets.Widget

A Widget that splits date input into three <select> boxes.

This also serves as an example of a Widget that has more than one HTML element and hence implements value_from_datadict.

create_select(name, field, value, val, choices, none_value)
day_field = u'%s_day'
id_for_label(id_)
media
month_field = u'%s_month'
none_value = (0, u'---')
render(name, value, attrs=None)
value_from_datadict(data, files, name)
year_field = u'%s_year'
ChangeUserPermissionsForm.Meta.fields = ['canDelete', 'canRead', 'canWrite', 'effectiveDate', 'expiryDate', 'isOwner']
ChangeUserPermissionsForm.Meta.model

alias of ObjectACL

ChangeUserPermissionsForm.Meta.widgets = {'effectiveDate': <django.forms.extras.widgets.SelectDateWidget object at 0x7f4559ba6ed0>, 'expiryDate': <django.forms.extras.widgets.SelectDateWidget object at 0x7f4559ba6e90>}
ChangeUserPermissionsForm.base_fields = OrderedDict([('canDelete', <django.forms.fields.BooleanField object at 0x7f4559ba2250>), ('canRead', <django.forms.fields.BooleanField object at 0x7f4559ba2110>), ('canWrite', <django.forms.fields.BooleanField object at 0x7f4559ba21d0>), ('effectiveDate', <django.forms.fields.DateField object at 0x7f4559ba2350>), ('expiryDate', <django.forms.fields.DateField object at 0x7f4559ba2390>), ('isOwner', <django.forms.fields.BooleanField object at 0x7f4559ba22d0>)])
ChangeUserPermissionsForm.declared_fields = OrderedDict()
ChangeUserPermissionsForm.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)

Bases: django.forms.forms.Form

base_fields = OrderedDict([('addgroup', <django.forms.fields.CharField object at 0x7f4559ba2cd0>), ('authMethod', <django.forms.fields.CharField object at 0x7f4559ba2dd0>), ('adduser', <django.forms.fields.CharField object at 0x7f4559ba2e10>)])
declared_fields = OrderedDict([('addgroup', <django.forms.fields.CharField object at 0x7f4559ba2cd0>), ('authMethod', <django.forms.fields.CharField object at 0x7f4559ba2dd0>), ('adduser', <django.forms.fields.CharField object at 0x7f4559ba2e10>)])
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)

Bases: tardis.tardis_portal.forms.RegistrationForm

base_fields = OrderedDict([('username', <django.forms.fields.RegexField object at 0x7f4559ba6890>), ('email', <django.forms.fields.EmailField object at 0x7f4559ba6a50>), ('password1', <django.forms.fields.CharField object at 0x7f4559ba6b10>), ('password2', <django.forms.fields.CharField object at 0x7f4559ba6c10>), ('authMethod', <django.forms.fields.CharField object at 0x7f4559b6a2d0>)])
declared_fields = OrderedDict([('username', <django.forms.fields.RegexField object at 0x7f4559ba6890>), ('email', <django.forms.fields.EmailField object at 0x7f4559ba6a50>), ('password1', <django.forms.fields.CharField object at 0x7f4559ba6b10>), ('password2', <django.forms.fields.CharField object at 0x7f4559ba6c10>), ('authMethod', <django.forms.fields.CharField object at 0x7f4559b6a2d0>)])
media
class tardis.tardis_portal.forms.DatafileSearchForm(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)

Bases: django.forms.forms.Form

base_fields = OrderedDict([('filename', <django.forms.fields.CharField object at 0x7f4559b6a390>)])
declared_fields = OrderedDict([('filename', <django.forms.fields.CharField object at 0x7f4559b6a390>)])
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)

Bases: django.forms.models.ModelForm

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

alias of Dataset

DatasetForm.base_fields = OrderedDict([('description', <django.forms.fields.CharField object at 0x7f4559b75450>), ('directory', <django.forms.fields.CharField object at 0x7f4559b75690>), ('instrument', <django.forms.models.ModelChoiceField object at 0x7f4559b75790>)])
DatasetForm.declared_fields = OrderedDict([('description', <django.forms.fields.CharField object at 0x7f4559b75450>)])
DatasetForm.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)

Bases: django.forms.models.ModelForm

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

alias of ExperimentAuthor

ExperimentAuthor.base_fields = OrderedDict([('author', <django.forms.fields.CharField object at 0x7f4559b75650>), ('institution', <django.forms.fields.CharField object at 0x7f4559b75a50>), ('email', <django.forms.fields.CharField object at 0x7f4559b75b50>), ('order', <django.forms.fields.IntegerField object at 0x7f4559b75c90>), ('url', <django.forms.fields.URLField object at 0x7f4559b75d90>)])
ExperimentAuthor.declared_fields = OrderedDict()
ExperimentAuthor.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(*args, **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 ExperimentForm.Meta
fields = ('title', 'institution_name', 'description')
model

alias of Experiment

ExperimentForm.base_fields = OrderedDict([('title', <django.forms.fields.CharField object at 0x7f4559b9e050>), ('institution_name', <django.forms.fields.CharField object at 0x7f4559b9e150>), ('description', <django.forms.fields.CharField object at 0x7f4559b9e250>), ('url', <django.forms.fields.CharField object at 0x7f4559b75e50>)])
ExperimentForm.declared_fields = OrderedDict([('url', <django.forms.fields.CharField object at 0x7f4559b75e50>)])
ExperimentForm.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.

Return type:bool
ExperimentForm.media
ExperimentForm.save(commit=True)
class tardis.tardis_portal.forms.IRDatafileSearchForm(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)

Bases: tardis.tardis_portal.forms.DatafileSearchForm

base_fields = OrderedDict([('filename', <django.forms.fields.CharField object at 0x7f4559b6a390>)])
declared_fields = OrderedDict([('filename', <django.forms.fields.CharField object at 0x7f4559b6a390>)])
media
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)

Bases: django.forms.forms.Form

base_fields = OrderedDict([('username', <django.forms.fields.CharField object at 0x7f4559b6aa10>), ('password', <django.forms.fields.CharField object at 0x7f4559b6aad0>), ('params', <django.forms.fields.FileField object at 0x7f4559b6ab90>)])
declared_fields = OrderedDict([('username', <django.forms.fields.CharField object at 0x7f4559b6aa10>), ('password', <django.forms.fields.CharField object at 0x7f4559b6aad0>), ('params', <django.forms.fields.FileField object at 0x7f4559b6ab90>)])
media
class tardis.tardis_portal.forms.LoginForm(*args, **kwargs)

Bases: django.contrib.auth.forms.AuthenticationForm

base_fields = OrderedDict([('username', <django.forms.fields.CharField object at 0x7f455bbb7e50>), ('password', <django.forms.fields.CharField object at 0x7f455bbb7f10>)])
declared_fields = OrderedDict([('username', <django.forms.fields.CharField object at 0x7f455bbb7e50>), ('password', <django.forms.fields.CharField object at 0x7f455bbb7f10>)])
media
class tardis.tardis_portal.forms.MXDatafileSearchForm(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)

Bases: tardis.tardis_portal.forms.DatafileSearchForm

base_fields = OrderedDict([('filename', <django.forms.fields.CharField object at 0x7f4559b6a390>), ('diffractometerType', <django.forms.fields.CharField object at 0x7f4559b6a550>), ('xraySource', <django.forms.fields.CharField object at 0x7f4559b6a590>), ('crystalName', <django.forms.fields.CharField object at 0x7f4559b6a650>), ('resolutionLimit', <django.forms.fields.IntegerField object at 0x7f4559b6a710>), ('xrayWavelengthFrom', <django.forms.fields.IntegerField object at 0x7f4559b6a7d0>), ('xrayWavelengthTo', <django.forms.fields.IntegerField object at 0x7f4559b6a850>)])
declared_fields = OrderedDict([('filename', <django.forms.fields.CharField object at 0x7f4559b6a390>), ('diffractometerType', <django.forms.fields.CharField object at 0x7f4559b6a550>), ('xraySource', <django.forms.fields.CharField object at 0x7f4559b6a590>), ('crystalName', <django.forms.fields.CharField object at 0x7f4559b6a650>), ('resolutionLimit', <django.forms.fields.IntegerField object at 0x7f4559b6a710>), ('xrayWavelengthFrom', <django.forms.fields.IntegerField object at 0x7f4559b6a7d0>), ('xrayWavelengthTo', <django.forms.fields.IntegerField object at 0x7f4559b6a850>)])
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)

Bases: django.forms.models.ModelForm

Form for changing account details.

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

alias of User

ManageAccountForm.base_fields = OrderedDict([('first_name', <django.forms.fields.CharField object at 0x7f4559b9e950>), ('last_name', <django.forms.fields.CharField object at 0x7f4559b9ea90>), ('email', <django.forms.fields.EmailField object at 0x7f4559b9ec50>)])
ManageAccountForm.declared_fields = OrderedDict()
ManageAccountForm.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)

Bases: django.forms.forms.Form

base_fields = OrderedDict([('authMethod', <django.forms.fields.CharField object at 0x7f4559b6a050>), ('adduser', <django.forms.fields.CharField object at 0x7f4559b6a090>), ('admin', <django.forms.fields.BooleanField object at 0x7f4559b6a150>)])
declared_fields = OrderedDict([('authMethod', <django.forms.fields.CharField object at 0x7f4559b6a050>), ('adduser', <django.forms.fields.CharField object at 0x7f4559b6a090>), ('admin', <django.forms.fields.BooleanField object at 0x7f4559b6a150>)])
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 = OrderedDict([('q', <django.forms.fields.CharField object at 0x7f4559af9a10>)])
declared_fields = OrderedDict([('q', <django.forms.fields.CharField object at 0x7f4559af9a10>)])
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)

Bases: django.forms.forms.Form

base_fields = OrderedDict([('username', <django.forms.fields.CharField object at 0x7f4559b6ad10>), ('password', <django.forms.fields.CharField object at 0x7f4559b6add0>), ('xmldata', <django.forms.fields.FileField object at 0x7f4559b6ae90>), ('xml_filename', <django.forms.fields.CharField object at 0x7f4559b6af10>), ('experiment_owner', <django.forms.fields.CharField object at 0x7f4559b75050>), ('originid', <django.forms.fields.CharField object at 0x7f4559b75150>), ('from_url', <django.forms.fields.CharField object at 0x7f4559b75250>)])
declared_fields = OrderedDict([('username', <django.forms.fields.CharField object at 0x7f4559b6ad10>), ('password', <django.forms.fields.CharField object at 0x7f4559b6add0>), ('xmldata', <django.forms.fields.FileField object at 0x7f4559b6ae90>), ('xml_filename', <django.forms.fields.CharField object at 0x7f4559b6af10>), ('experiment_owner', <django.forms.fields.CharField object at 0x7f4559b75050>), ('originid', <django.forms.fields.CharField object at 0x7f4559b75150>), ('from_url', <django.forms.fields.CharField object at 0x7f4559b75250>)])
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)

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 = OrderedDict([('username', <django.forms.fields.RegexField object at 0x7f4559ba6890>), ('email', <django.forms.fields.EmailField object at 0x7f4559ba6a50>), ('password1', <django.forms.fields.CharField object at 0x7f4559ba6b10>), ('password2', <django.forms.fields.CharField object at 0x7f4559ba6c10>)])
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 = OrderedDict([('username', <django.forms.fields.RegexField object at 0x7f4559ba6890>), ('email', <django.forms.fields.EmailField object at 0x7f4559ba6a50>), ('password1', <django.forms.fields.CharField object at 0x7f4559ba6b10>), ('password2', <django.forms.fields.CharField object at 0x7f4559ba6c10>)])
media
save(*args, **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)

Bases: django.forms.models.ModelForm

Form for changing public access and licence.

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

alias of Experiment

widgets = {'license': <django.forms.widgets.HiddenInput object at 0x7f4559b9e4d0>}
RightsForm.base_fields = OrderedDict([('public_access', <django.forms.fields.TypedChoiceField object at 0x7f4559b9e650>), ('license', <django.forms.models.ModelChoiceField object at 0x7f4559b9e710>)])
RightsForm.clean()
RightsForm.declared_fields = OrderedDict()
RightsForm.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, 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.createSearchDatafileForm(searchQueryType)
tardis.tardis_portal.forms.createSearchDatafileSelectionForm(initial=None)
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

Bases: object

process_exception(request, exception)
process_response(request, response)

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 – a User instance
external_users(experiment_id)

returns a list of groups which have external ACL rules

Parameters:experiment_id (string) – the ID of the experiment to be edited
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 – a User instance
  • experiment_id (string) – the ID of the experiment to be edited
group_acls_system_owned(experiment_id)

Returns a list of ACL rules associated with this experiment.

Parameters:experiment_id (string) – the ID of the experiment
group_acls_user_owned(experiment_id)

Returns a list of ACL rules associated with this experiment.

Parameters:experiment_id (string) – the ID of the experiment
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:request (django.http.HttpRequest) – a HTTP Request instance
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:userId (User) – a User Object
owned_by_user_id(userId)

Return all experiments which are owned by a particular user id

Parameters:userId (integer) – a User ID
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
user_acls(experiment_id)

Returns a list of ACL rules associated with this experiment.

Parameters:experiment_id (string) – the ID of the experiment
user_owned_groups(experiment_id)

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

Parameters:experiment_id (string) – the ID of the experiment to be edited
users(experiment_id)

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

Parameters:experiment_id (string) – the ID of the experiment
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()
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.sftp module

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.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.staging module

staging.py

tardis.tardis_portal.staging.get_dataset_path(dataset)
tardis.tardis_portal.staging.get_full_staging_path(username)
tardis.tardis_portal.staging.get_staging_path()

return the path to the staging directory

tardis.tardis_portal.staging.get_staging_url_and_size(username, filepath)

Returns a file:// URL and the size of the file.

tardis.tardis_portal.staging.get_sync_location()
tardis.tardis_portal.staging.get_sync_root(prefix='')
tardis.tardis_portal.staging.get_sync_url_and_protocol(sync_path, filepath)
tardis.tardis_portal.staging.staging_list(pathname='/home/docs/checkouts/readthedocs.org/user_builds/mytardis/checkouts/develop/var/test/staging', dirname='/home/docs/checkouts/readthedocs.org/user_builds/mytardis/checkouts/develop/var/test/staging', root=False)
tardis.tardis_portal.staging.write_uploaded_file_to_dataset(dataset, uploaded_file_post, subdir=None)

Broken, now that the storagebox takes care of writing files. Writes file POST data to the dataset directory in the file store

Parameters:
  • dataset (models.Model) – dataset whose directory to be written to
  • uploaded_file_post (types.FileType) – uploaded file (either UploadedFile or File)
Return type:

the path of the file written to

tardis.tardis_portal.tasks module

tardis.tardis_portal.tasks.init_filters()

load filters and avoid circular import :return:

tardis.tardis_portal.util module

tardis.tardis_portal.widgets module

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

Bases: django.forms.widgets.TextInput

media
render(name, value, attrs=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 – The relative path to the Django template to be

rendered :type template_path: string :param context: The Context object (dictionary of variables for template output) :type context: django.template.context.Context :returns: The full path to the created file :rtype: string

static write_template_to_file(prefix_dir, objectprefix, uniqueid, templatepath, context)
Parameters:prefix_dir – The subdirectory off of the OAI_DOCS_PATH to store

the resulting document in :type prefix_dir: string :param objectprefix: The name prefix of the resulting file. Files are output in the format prefix-uniqueid.xml :type objectprefix: string :param uniqueid: The unique ID of the file to be output :type uniqueid: string :param templatepath: The relative path to the Django template to be rendered :type templatepath: string :param context: The Context object (dictionary of variables for template output) :type context: django.template.context.Context :returns: The full path to the created file :rtype: string

static write_xml_to_file(prefix_dir, objectprefix, uniqueid, xmlstring)
Parameters:prefix_dir – The subdirectory off of the OAI_DOCS_PATH to store

the resulting document in :type prefix_dir: string :param objectprefix: The name prefix of the resulting file. Files are output in the format prefix-uniqueid.xml :type objectprefix: string :param uniqueid: The unique ID of the file to be output :type uniqueid: string :param xmlstring: The relative path to the Django template to be rendered :type xmlstring: string :returns: The full path to the created file :rtype: string

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

XML Writer

A set of static methods for writing xml files.

Module contents

models/__init__.py