crs4 / hl7apy

Python library to parse, create and handle HL7 v2 messages.
http://crs4.github.io/hl7apy/
MIT License
224 stars 88 forks source link

Make request handler class overrideable and unprivatize MLLPRequestHandler #63

Closed sloria closed 4 years ago

sloria commented 4 years ago

My use case is that my MLLP server needs to read some header data from the request before processing the HL7 data. Without a way to overrideMLLPServer's request handler, I have to override MLLPServer.__init__, passing in my custom RequestHandler class to the TCPServer.__init__(self, (host, port), RequestHandler) call, which isn't ideal.

This exposes a way to more easily customize the behavior of the request handler.

from hl7apy import mllp

class MyRequestHandler(mllp.MLLPRequestHandler):
     def handle(self):
         # ... do some processing
         super().handle()

# ...
server = mllp.MLLPServer('localhost', 1234, handlers, MyRequestHandler)
coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 95.28% when pulling fbc0ee1e5ed89378d5ae045d4d8e1b2ebb0a9cb9 on sloria:overrideable-request-handler into 53da4f90aa5826e0f01943fdcfb5da2dc70ca159 on crs4:develop.

svituz commented 4 years ago

That's fine, but what about adding it as an init keyword argument?

sloria commented 4 years ago

That's fine, but what about adding it as an init keyword argument?

Done. Anything else?

sloria commented 4 years ago

🎉 Thanks for merging. Are there any blockers to cutting a release? If so, is there any way I can assist?

svituz commented 4 years ago

There are no blockers, but I need to check if I can include some bug fixes in the next release. I can't release until next week, I'm sorry. Thanks for the offer, but the release is something we have to take care of by ourselves.

sloria commented 4 years ago

No worries, thanks for the update