Monday, September 25, 2017

Re: Channels: Using `allowed_hosts_only` with `WebsocketDemultiplexer`

It's pretty tough right now to use the decorators with the classes (this is why things like http_user are built-in) - you have to wrap them around the handle method, if I remember correctly. 

I'm hoping to fix this with the design of Channels 2 by changing the way classes get called, but that's not going to be useable for a little while. 

Andrew

On Mon, Sep 25, 2017 at 11:20 AM, Michael Huang <mikhuang@gmail.com> wrote:
Hi there. I couldn't figure out how to use the allowed_hosts_only decorator with the connect method of WebsocketDemulitplexer. I ended up copying and pasting the relevant code into a mixin I could use directly with WebsocketDemultiplexer (removing __init__ and __call__, adding a connect method that performs what __call__ performed). This seems silly. Is there a way I could have used the decorator or is it possible that the methods in BaseOriginValidator should be altered so they can be used in mixins?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c7891571-70f6-481f-811c-3d78816314df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFwN1uoPib_iocdykiutL7JeCsvJ_Pqna6sY1M0yzsbWMNkBfg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment