diff --git a/beat/web/experiments/models/experiment.py b/beat/web/experiments/models/experiment.py index 60e589d7da04676bbb337ae09f93ad753e7bca62..d09485e832ccc399378f5f155037eb79ed10622a 100755 --- a/beat/web/experiments/models/experiment.py +++ b/beat/web/experiments/models/experiment.py @@ -48,6 +48,9 @@ from ...common.models import get_contribution_declaration_filename from ...common.models import get_contribution_description_filename from ...common.models import get_description from ...common.models import set_description +from ...common.models import get_declaration +from ...common.models import set_declaration +from ...common.models import get_declaration_string from ...common import storage from ...common.exceptions import ShareError @@ -749,23 +752,9 @@ class Experiment(Shareable): #_____ Properties __________ - def set_declaration(self, value): - if isinstance(value, dict): - value = simplejson.dumps(value, indent=4, cls=NumpyJSONEncoder) - - storage.set_file_content(self, 'declaration_file', self.declaration_filename(), value) - - def get_declaration(self): - return simplejson.loads(storage.get_file_content(self, 'declaration_file')) - - declaration = property(get_declaration, set_declaration) - description = property(get_description, set_description) - - - @property - def declaration_string(self): - return storage.get_file_content(self, 'declaration_file') + declaration = property(get_declaration, set_declaration) + declaration_string = property(beat.web.common.models.get_declaration_string) def schedule(self): @@ -788,6 +777,6 @@ class Experiment(Shareable): author = username or self.author name = name or self.name xp, _, __ = Experiment.objects.create_experiment(author, - self.toolchain, name, self.get_declaration(), + self.toolchain, name, self.declaration, self.short_description, self.description) return xp