Skip to content
Snippets Groups Projects
Commit 45aea013 authored by Matthias Stefan Bodenbenner's avatar Matthias Stefan Bodenbenner
Browse files

changed initalization procedure, made it much more easy

parent 71609a1c
No related branches found
No related tags found
No related merge requests found
[![Build](https://git-ce.rwth-aachen.de/wzl-mq-ms/forschung-lehre/lava/unified-device-interface/python/badges/master/pipeline.svg)](https://git-ce.rwth-aachen.de/wzl-mq-ms/forschung-lehre/lava/unified-device-interface/python/commits/master)
# Python Unified Device Interface
Current stable version: 8.0.0
Current stable version: 8.0.1
Stable legacy version: 5.2.7 **SHOULD NOT BE USED ANYMORE!**
## Installation
......@@ -65,6 +65,10 @@ Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation)
## Recent changes
**8.0.1** - 2023-03-14
- bug fixes
- fixed DELETE endpoint for dynamic components
**8.0.0** - 2023-03-11
- changed initialization routine
- the mapping via a dictionary of encapsulated sensor logic to HTTP-Endpoints is not needed anymore
......
......
from setuptools import setup, find_packages
setup(name='wzl-udi',
version='8.0.0',
version='8.0.1',
url='https://git-ce.rwth-aachen.de/wzl-mq-public/soil/python',
author='Matthias Bodenbenner',
author_email='m.bodenbenner@wzl.mq.rwth-aachen.de',
......
......
......@@ -192,9 +192,8 @@ class HTTPServer(object):
return self.prepare_response(response, item, status=status)
async def delete(self, request):
logger.info("PUT Request from {}".format(request.url))
logger.info("DELETE Request from {}".format(request.url))
logger.debug('Request: {}'.format(request))
data = await request.json()
uuids = HTTPServer.parse_uuids(request)
try:
......@@ -208,9 +207,7 @@ class HTTPServer(object):
if not isinstance(item, Component):
return self.prepare_response({}, None, status=405)
try:
component_name = await self.loop.run_in_executor(None,
functools.partial(item.remove, uuids[-1], *data['args'],
**data['kwargs']))
component_name = await self.loop.run_in_executor(None, functools.partial(item.remove, uuids[-1]))
if self._scheduler is not None:
self._scheduler.remove_jobs('/'.join(uuids))
......
......
......@@ -342,11 +342,11 @@ class Component(Element):
else:
raise UserException('UUID {} is not of the UUID of an component.'.format(uuid))
def remove(self, uuid: str, *args, **kwargs) -> str:
def remove(self, uuid: str) -> str:
for o in self._components:
if o.uuid == uuid:
try:
getattr(self._implementation, 'remove')(*args, **kwargs)
getattr(self._implementation, 'remove')(uuid)
except Exception as e:
raise DeviceException(str(e), predecessor=e)
self._components.remove(o)
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment