##// END OF EJS Templates
validation: remove 0.4 report validators
ergo -
Show More
@@ -99,40 +99,11 b' def add_reports(resource_id, params, dataset, environ=None, **kwargs):'
99 99 es_report_docs = {}
100 100 es_report_group_docs = {}
101 101 resource = ApplicationService.by_id(resource_id)
102 reports = []
103
104 if proto_version.major < 1 and proto_version.minor < 5:
105 for report_data in dataset:
106 report_details = report_data.get('report_details', [])
107 for i, detail_data in enumerate(report_details):
108 report_data.update(detail_data)
109 report_data.pop('report_details')
110 traceback = report_data.get('traceback')
111 if traceback is None:
112 report_data['traceback'] = report_data.get('frameinfo')
113 # for 0.3 api
114 error = report_data.pop('error_type', '')
115 if error:
116 report_data['error'] = error
117 if proto_version.minor < 4:
118 # convert "Unknown" slow reports to
119 # '' (from older clients)
120 if (report_data['error'] and
121 report_data['http_status'] < 500):
122 report_data['error'] = ''
123 message = report_data.get('message')
124 if 'extra' not in report_data:
125 report_data['extra'] = []
126 if message:
127 report_data['extra'] = [('message', message), ]
128 reports.append(report_data)
129 else:
130 reports = dataset
131 102
132 103 tags = []
133 104 es_slow_calls_docs = {}
134 105 es_reports_stats_rows = {}
135 for report_data in reports:
106 for report_data in dataset:
136 107 # build report details for later
137 108 added_details = 0
138 109 report = Report()
@@ -360,25 +360,10 b' class ReportSchemaBase(colander.MappingSchema):'
360 360 tags = TagSchemaList()
361 361
362 362
363 class ReportSchema_0_4(ReportSchemaBase):
364 error_type = colander.SchemaNode(colander.String(),
365 preparer=[shortener_factory(512)],
366 missing='')
367 report_details = ReportDetailListSchema()
368
369
370 363 class ReportSchema_0_5(ReportSchemaBase, ReportDetailSchema_0_5):
371 364 pass
372 365
373 366
374 class ReportListSchema_0_4(colander.SequenceSchema):
375 """
376 Validates format of list of report groups
377 """
378 report = ReportSchema_0_4()
379 validator = colander.Length(1)
380
381
382 367 class ReportListSchema_0_5(colander.SequenceSchema):
383 368 """
384 369 Validates format of list of report groups
General Comments 0
You need to be logged in to leave comments. Login now