Use last channels & co versions

- Use last official releases of channels, asgiref, daphne and
  asgi-redis packages.
- Customization of JsonWebsocketConsumer is now in kfet app through a
  custom class (and so, doesn't require anymore a forked version of channels).
- Clean kfet consumers code.
This commit is contained in:
Aurélien Delobelle 2017-04-09 15:47:16 +02:00
parent 15861824b6
commit 1e18c4043e
2 changed files with 15 additions and 20 deletions

View file

@ -1,26 +1,21 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from django.core.serializers.json import json, DjangoJSONEncoder
from channels import Group
from channels.generic.websockets import JsonWebsocketConsumer
class KPsul(JsonWebsocketConsumer):
# Set to True if you want them, else leave out
strict_ordering = False
slight_ordering = False
class DjangoJsonWebsocketConsumer(JsonWebsocketConsumer):
"""Custom Json Websocket Consumer.
def connection_groups(self, **kwargs):
return ['kfet.kpsul']
Encode to JSON with DjangoJSONEncoder.
def connect(self, message, **kwargs):
pass
"""
def receive(self, content, **kwargs):
pass
@classmethod
def encode_json(cls, content):
return json.dumps(content, cls=DjangoJSONEncoder)
def disconnect(self, message, **kwargs):
pass
class KPsul(DjangoJsonWebsocketConsumer):
groups = ['kfet.kpsul']

View file

@ -11,13 +11,13 @@ six==1.10.0
unicodecsv==0.14.1
icalendar==3.10
django-bootstrap-form==3.2.1
asgiref==0.14.0
daphne==0.14.3
asgi-redis==0.14.0
asgiref==1.1.1
daphne==1.2.0
asgi-redis==1.3.0
statistics==1.0.3.5
future==0.15.2
django-widget-tweaks==1.4.1
git+https://git.eleves.ens.fr/cof-geek/django_custommail.git#egg=django_custommail
ldap3
git+https://github.com/Aureplop/channels.git#egg=channels
channels==1.1.3
python-dateutil