mirror of
				https://github.com/cookiecutter/cookiecutter-django.git
				synced 2025-11-04 01:47:28 +03:00 
			
		
		
		
	Fixed linter check for #2506
This commit is contained in:
		
							parent
							
								
									c4eaf68982
								
							
						
					
					
						commit
						910ed86d11
					
				| 
						 | 
				
			
			@ -11,6 +11,7 @@ import sys
 | 
			
		|||
from pathlib import Path
 | 
			
		||||
 | 
			
		||||
from django.core.asgi import get_asgi_application
 | 
			
		||||
 | 
			
		||||
from .websocket import websocket_application
 | 
			
		||||
 | 
			
		||||
# This allows easy placement of apps within the interior
 | 
			
		||||
| 
						 | 
				
			
			@ -33,9 +34,9 @@ django_application = get_asgi_application()
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
async def application(scope, receive, send):
 | 
			
		||||
    if scope['type'] == 'http':
 | 
			
		||||
    if scope["type"] == "http":
 | 
			
		||||
        await django_application(scope, receive, send)
 | 
			
		||||
    elif scope['type'] == 'websocket':
 | 
			
		||||
    elif scope["type"] == "websocket":
 | 
			
		||||
        await websocket_application(scope, receive, send)
 | 
			
		||||
    else:
 | 
			
		||||
        raise NotImplementedError(f"Unknown scope type {scope['type']}")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,17 +2,12 @@ async def websocket_application(scope, receive, send):
 | 
			
		|||
    while True:
 | 
			
		||||
        event = await receive()
 | 
			
		||||
 | 
			
		||||
        if event['type'] == 'websocket.connect':
 | 
			
		||||
            await send({
 | 
			
		||||
                'type': 'websocket.accept'
 | 
			
		||||
            })
 | 
			
		||||
        if event["type"] == "websocket.connect":
 | 
			
		||||
            await send({"type": "websocket.accept"})
 | 
			
		||||
 | 
			
		||||
        if event['type'] == 'websocket.disconnect':
 | 
			
		||||
        if event["type"] == "websocket.disconnect":
 | 
			
		||||
            break
 | 
			
		||||
 | 
			
		||||
        if event['type'] == 'websocket.receive':
 | 
			
		||||
            if event['text'] == 'ping':
 | 
			
		||||
                await send({
 | 
			
		||||
                    'type': 'websocket.send',
 | 
			
		||||
                    'text': 'pong!'
 | 
			
		||||
                })
 | 
			
		||||
        if event["type"] == "websocket.receive":
 | 
			
		||||
            if event["text"] == "ping":
 | 
			
		||||
                await send({"type": "websocket.send", "text": "pong!"})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user