-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from ml-learning/channels-2
Compatibility for django-channels v2.4
- Loading branch information
Showing
17 changed files
with
326 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ dist/ | |
build/ | ||
docs/_build | ||
*.egg-info | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
from __future__ import unicode_literals | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django.apps import AppConfig | ||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
from __future__ import unicode_literals | ||
|
||
import functools | ||
|
||
from channels_presence.models import Presence | ||
|
||
|
||
def touch_presence(func): | ||
@functools.wraps(func) | ||
def inner(message, *args, **kwargs): | ||
Presence.objects.touch(message.reply_channel.name) | ||
if message.content.get('text') == '"heartbeat"': | ||
def inner(consumer, text_data, *args, **kwargs): | ||
Presence.objects.touch(consumer.channel_name) | ||
if text_data == '"heartbeat"': | ||
return | ||
return func(message, *args, **kwargs) | ||
return func(consumer, text_data, *args, **kwargs) | ||
|
||
return inner | ||
|
||
|
||
def remove_presence(func): | ||
@functools.wraps(func) | ||
def inner(message, *args, **kwargs): | ||
Presence.objects.leave_all(message.reply_channel.name) | ||
return func(message, *args, **kwargs) | ||
def inner(consumer, *args, **kwargs): | ||
Presence.objects.leave_all(consumer.channel_name) | ||
return func(consumer, *args, **kwargs) | ||
|
||
return inner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django import dispatch | ||
|
||
presence_changed = dispatch.Signal(providing_args=[ | ||
"room", "added", "removed", "bulk_change" | ||
]) | ||
|
||
presence_changed = dispatch.Signal( | ||
providing_args=["room", "added", "removed", "bulk_change"] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django.shortcuts import render | ||
|
||
# Create your views here. |
Oops, something went wrong.