I have implemented a very basic and by-the-tutorial Pusher triggers in my django app.
At first it worked great, but after a few commits I ran into the following exception:
"object of type 'NoneType' has no len()"
Out of the second of the following lines:
p = pusher.Pusher()
p[page_key].trigger('page_update', {'msgid' : message.id})
Different or an empty dict produced same result, same as changing page_key to string instead of unicode – nothing.
Also note that type() of p and p.trigger gives logical results, and they’re definitely not None.
This line WORKS IN SOME CASES (which I have no clue what so special about them) and has worked in the past as I’ve mentioned, yet I can’t figure out what am I doing wrong.
It seems that none of the last commits have anything to do with Pusher, so I’m helpless. Searching the web for this exception wasn’t fruitful at all and in general there’s not enough documentation regarding to django + Pusher.
It is probably something else that I’m doing wrong but I have no clue where to start looking.
Any help will be most appreciated.
Traceback:
79. p[page_key].trigger('page_update', {'msgid' : message.id})
File "/usr/local/lib/python2.7/dist-packages/pusher/__init__.py" in trigger
41. status = self.send_request(self.signed_query(event, json_data, socket_id), json_data)
File "/usr/local/lib/python2.7/dist-packages/pusher/__init__.py" in signed_query
54. signature = hmac.new(self.pusher.secret, string_to_sign, hashlib.sha256).hexdigest()
File "/usr/lib/python2.7/hmac.py" in new
133. return HMAC(key, msg, digestmod)
File "/usr/lib/python2.7/hmac.py" in __init__
68. if len(key) > blocksize:
Exception Type: TypeError at /sphere/comment
Exception Value: object of type 'NoneType' has no len()
self.pusher.secret is None there instead of a string. Are your settings for pusher not getting picked up?