Fix 500 on procedure api
[2020-05-28T12:06:31 +0000] | prozorro_sale.procedure.errors | ERROR - Unknown error caught in API - ContractPrepaymentDetails Model has no role public on export | X-Request-ID: d6313c65-af5a-4268-b36c-64400e8072e5
Traceback (most recent call last):
File "/procedure/prozorro_sale/procedure/errors.py", line 81, in request_errors_middleware
return await handler(request)
File "/usr/local/lib/python3.8/site-packages/prozorro_sale/auth/__init__.py", line 67, in context_middleware
return await handler(request)
File "/usr/local/lib/python3.8/site-packages/prozorro_sale/auth/__init__.py", line 73, in access_middleware
return await handler(request)
File "/procedure/prozorro_sale/procedure/utils.py", line 124, in accept_language_middleware
return await handler(request)
File "/procedure/prozorro_sale/procedure/errors.py", line 116, in retry_on_concurrency_error_middleware
return await handler(request)
File "/procedure/prozorro_sale/procedure/utils.py", line 98, in request_unpack_params
return await handler(request, **request.match_info)
File "/procedure/prozorro_sale/procedure/api.py", line 76, in get_procedure
procedure.to_primitive(
File "/procedure/prozorro_sale/procedure/models/base.py", line 681, in to_primitive
return super().to_primitive(role, app_data, **kwargs)
File "/procedure/prozorro_sale/procedure/models/base.py", line 31, in to_primitive
return super().to_primitive(role, app_data, **kwargs)
File "/usr/local/lib/python3.8/site-packages/schematics/models.py", line 162, in to_primitive
return to_primitive(self.__class__, self, role=role, app_data=app_data, export_level=NOT_NONE, **kwargs)
File "/usr/local/lib/python3.8/site-packages/schematics/transforms.py", line 469, in to_primitive
return export_loop(cls, instance_or_dict, to_primitive_converter, **kwargs)
File "/usr/local/lib/python3.8/site-packages/schematics/transforms.py", line 310, in export_loop
value = _field_converter(field, value, context)
File "/usr/local/lib/python3.8/site-packages/schematics/transforms.py", line 388, in __call__
return self.func(*args)
File "/usr/local/lib/python3.8/site-packages/schematics/transforms.py", line 403, in to_primitive_converter
return field.export(value, PRIMITIVE, context)
File "/usr/local/lib/python3.8/site-packages/schematics/types/compound.py", line 58, in export
return self._export(value, format, context)
File "/procedure/prozorro_sale/procedure/models/types.py", line 153, in _export
data = super()._export(dict_instance, format, context)
File "/usr/local/lib/python3.8/site-packages/schematics/types/compound.py", line 325, in _export
shaped = self.field.export(value, format, context)
File "/usr/local/lib/python3.8/site-packages/schematics/types/compound.py", line 58, in export
return self._export(value, format, context)
File "/usr/local/lib/python3.8/site-packages/schematics/types/compound.py", line 169, in _export
return export_loop(model_class, value, context=context)
File "/usr/local/lib/python3.8/site-packages/schematics/transforms.py", line 310, in export_loop
value = _field_converter(field, value, context)
File "/usr/local/lib/python3.8/site-packages/schematics/transforms.py", line 388, in __call__
return self.func(*args)
File "/usr/local/lib/python3.8/site-packages/schematics/transforms.py", line 403, in to_primitive_converter
return field.export(value, PRIMITIVE, context)
File "/usr/local/lib/python3.8/site-packages/schematics/types/compound.py", line 58, in export
return self._export(value, format, context)
File "/usr/local/lib/python3.8/site-packages/schematics/types/compound.py", line 169, in _export
return export_loop(model_class, value, context=context)
File "/usr/local/lib/python3.8/site-packages/schematics/transforms.py", line 289, in export_loop
filter_func = get_role_func(schema, context)
File "/usr/local/lib/python3.8/site-packages/schematics/transforms.py", line 32, in get_role_func
raise ValueError(
ValueError: ContractPrepaymentDetails Model has no role public on export
[2020-05-28T12:06:31 +0000] | aiohttp.access | INFO - "178.150.90.134 GET /api/procedures/5ece403198e5ddb6d76d9311 HTTP/1.1 500 264 - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36 0.005542 " | X-Request-ID: d6313c65-af5a-4268-b36c-64400e8072e5
Edited by Ghost User