Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed ResultBundleResult Djangoauthorization to models.Result, some…

… clean ups

    - for ResultBundle add, update, delete the Django access rights of the
      Result model is used
    - commented out some stuff that will be required maybe in future features

Change-Id: If38a5230bf04137f823e8d7884fa29d41ea202ae
  • Loading branch information...
commit 5480f20477492145f50b1a05f5fb2855a818a5a2 1 parent 5441385
@a8 a8 authored
Showing with 16 additions and 7 deletions.
  1. +16 −7 codespeed/api.py
View
23 codespeed/api.py
@@ -134,6 +134,10 @@ class Meta:
class ResultResource(ModelResource):
"""Resource for Result()"""
+ revision = fields.ToOneField(RevisionResource, 'revision')
+ executable = fields.ToOneField(ExecutableResource, 'executable')
+ benchmark = fields.ToOneField(BenchmarkResource, 'benchmark')
+ environment = fields.ToOneField(EnvironmentResource, 'environment')
class Meta:
queryset = Result.objects.all()
@@ -274,7 +278,7 @@ def _populate_by_obj(self):
# TODO (a8): add user to models
setattr(self.obj, 'user', User.objects.get(pk=1))
#setattr(self.obj, 'user', None)
- setattr(self.obj, 'notify', None)
+ #setattr(self.obj, 'notify', None)
def _check_data(self):
"""See if all mandatory data is there"""
@@ -362,7 +366,7 @@ class ResultBundleResource(Resource):
not mandatory data
'notify' - Send notification to registered user if result varies from
- previous results
+ previous results, currently not implemented
"""
revision = fields.ToOneField(RevisionResource, 'revision')
@@ -372,13 +376,15 @@ class ResultBundleResource(Resource):
benchmark = fields.ToOneField(BenchmarkResource, 'benchmark')
environment = fields.ToOneField(EnvironmentResource, 'environment')
result = fields.ToOneField(ResultResource, 'result')
- user = fields.ToOneField(UserResource, 'user', null=True)
- notify = fields.CharField(attribute='notify', null=True)
+ #user = fields.ToOneField(UserResource, 'user', null=True)
+ #notify = fields.CharField(attribute='notify', null=True)
class Meta:
resource_name = 'benchmark-result'
+ object_class = Result
authorization = DjangoAuthorization()
- authentication = MultiAuthentication(ApiKeyAuthentication(), Authentication())
+ authentication = MultiAuthentication(ApiKeyAuthentication(),
+ Authentication())
allowed_methods = ['get', 'post', 'put', 'delete']
def get_resource_uri(self, bundle_or_obj):
@@ -415,12 +421,12 @@ def obj_get(self, request=None, **kwargs):
setattr(result, 'result', result)
# TODO (a8): add user to models
#setattr(result, 'user', User.objects.get(pk=1))
- setattr(result, 'user', None)
+ #setattr(result, 'user', None)
#setattr(result, 'notify', None)
return result
def obj_create(self, bundle, request=None, **kwargs):
- # FIXME (a8): Make full_hydrate work
+ # not calling hydrate here since bundle.save() has that functionality
#bundle = self.full_hydrate(bundle)
bundle.save()
return bundle
@@ -468,3 +474,6 @@ def obj_delete(self, request=None, **kwargs):
def rollback(self, bundles):
pass
+
+ def detail_uri_kwargs(self):
+ pass
Please sign in to comment.
Something went wrong with that request. Please try again.