def retrieve(self, request, pk=None): try: schema = json.load(open(os.path.join(config["schema_path"], pk + ".json"))) if pk == "graph": schema["_id"] = metrilyx.new_uuid() return Response(schema) except Exception, e: return Response({"error": str(e)})
def retrieve(self, request, pk=None): try: schema = json.load(open(os.path.join(config['schema_path'], pk+".json" ))) if pk == 'graph': schema['_id'] = metrilyx.new_uuid() return Response(schema) except Exception,e: return Response({"error": str(e)})
def __sanitize_layout(self): for row in self.layout: for col in row: for pod in col: if pod.get('graphs'): for graph in pod['graphs']: if not graph.get('_id') or graph.get('_id') == "": graph['_id'] = metrilyx.new_uuid() if graph.get('series'): for s in graph['series']: if s.get('status'): del s['status'] if s.get('data'): del s['data']