From 40b23486000ecd00334cbf1ae14e8651eea05170 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sat, 26 Mar 2016 15:28:11 -0700 Subject: [PATCH] Fixed #101: Obscure error when strings in routing list. --- channels/routing.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/channels/routing.py b/channels/routing.py index e3ff7c2..d25e09a 100644 --- a/channels/routing.py +++ b/channels/routing.py @@ -24,7 +24,11 @@ class Router(object): # Expand those entries recursively into a flat list of Routes self.routing = [] for entry in routing: - self.routing.extend(entry.expand_routes()) + try: + self.routing.extend(entry.expand_routes()) + except AttributeError: + # It's not a valid route + raise ValueError("Encountered %r in routing config, which is not a valid route() or include()" % entry) # Now go through that list and collect channel names into a set self.channels = { route.channel