diff options
author | Zygmunt Krynicki <zygmunt.krynicki@linaro.org> | 2010-09-17 10:10:57 +0200 |
---|---|---|
committer | Zygmunt Krynicki <zygmunt.krynicki@linaro.org> | 2010-09-17 10:10:57 +0200 |
commit | 17b36373580b25b7e5df8cec03e9dcbde10cc87d (patch) | |
tree | 92a38dddb5825466e6a5e74a34426721e76e485d /dashboard_app/xmlrpc.py | |
parent | 0309db2023daa3d02e22ff0a4d85df3e4172558a (diff) |
Add new deserialize() method for testing period during which deserializer is not really working very well
Diffstat (limited to 'dashboard_app/xmlrpc.py')
-rw-r--r-- | dashboard_app/xmlrpc.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/dashboard_app/xmlrpc.py b/dashboard_app/xmlrpc.py index 46c0ece8a..8af40d6a4 100644 --- a/dashboard_app/xmlrpc.py +++ b/dashboard_app/xmlrpc.py @@ -314,3 +314,47 @@ class DashboardAPI(object): 'content_sha1': bundle.content_sha1, 'is_deserialized': bundle.is_deserialized } for bundle in bundle_stream.bundles.all()] + + + def deserialize(self, content_sha1): + """ + Name + ---- + `deserialize` (`content_sha1`) + + Description + ----------- + Deserialize bundle on the server + + Arguments + --------- + `content_sha1`: string + SHA1 hash of the content of the bundle to download. This + *MUST* designate an bundle or ``Fault(404, "...")`` is raised. + + Return value + ------------ + True - deserialization okay + False - deserialization not needed + + Exceptions raised + ----------------- + 404 + Bundle not found + 409 + Bundle import failed + """ + user = None + try: + bundle = Bundle.objects.get(content_sha1=content_sha1) + except Bundle.DoesNotExist: + raise xmlrpclib.Fault(errors.NOT_FOUND, + "Bundle not found") + if bundle.is_deserialized: + return False + bundle.deserialize() + if bundle.is_deserialized is False: + raise xmlrpclib.Fault( + errors.CONFLICT, + bundle.deserialization_error.error_message) + return True |