comparison patchablegraph.py @ 23:8d6ba6d372c8

add CORS support to graph responses
author drewp@bigasterisk.com
date Sat, 23 Apr 2022 23:45:45 -0700
parents 8ec07d997cd5
children e11d407c46f8
comparison
equal deleted inserted replaced
22:3ff5e739f4b1 23:8d6ba6d372c8
261 # long the latency to the client is to make a better rate choice 261 # long the latency to the client is to make a better rate choice
262 self.sendEvent(message=patchJson, event=b'patch') 262 self.sendEvent(message=patchJson, event=b'patch')
263 263
264 def unbind(self): 264 def unbind(self):
265 self.masterGraph.removeObserver(self.onPatch) 265 self.masterGraph.removeObserver(self.onPatch)
266
267 def flush(self):
268 if getattr(self.settings, 'allowOrigin'):
269 allow = self.settings.allowOrigin
270 if allow != b'*':
271 raise NotImplementedError()
272 self.set_header(b"Access-Control-Allow-Origin", allow)
273 return CycloneGraphEventsHandler.flush(self)