mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-12 00:19:48 +00:00
Format Python code with black
This commit is contained in:
@@ -6,24 +6,25 @@ from channels.generic.websocket import WebsocketConsumer
|
||||
|
||||
|
||||
class StatusConsumer(WebsocketConsumer):
|
||||
|
||||
def _authenticated(self):
|
||||
return 'user' in self.scope and self.scope['user'].is_authenticated
|
||||
return "user" in self.scope and self.scope["user"].is_authenticated
|
||||
|
||||
def connect(self):
|
||||
if not self._authenticated():
|
||||
raise DenyConnection()
|
||||
else:
|
||||
async_to_sync(self.channel_layer.group_add)(
|
||||
'status_updates', self.channel_name)
|
||||
"status_updates", self.channel_name
|
||||
)
|
||||
raise AcceptConnection()
|
||||
|
||||
def disconnect(self, close_code):
|
||||
async_to_sync(self.channel_layer.group_discard)(
|
||||
'status_updates', self.channel_name)
|
||||
"status_updates", self.channel_name
|
||||
)
|
||||
|
||||
def status_update(self, event):
|
||||
if not self._authenticated():
|
||||
self.close()
|
||||
else:
|
||||
self.send(json.dumps(event['data']))
|
||||
self.send(json.dumps(event["data"]))
|
||||
|
Reference in New Issue
Block a user