binarymatt / pyres

a resque clone in python
http://github.com/binarydud/pyres
MIT License
955 stars 130 forks source link

TypeError: 'int' object is unsubscriptable in resweb/views.py line 228 #92

Closed salimane closed 12 years ago

salimane commented 12 years ago

In resweb/views.py line 228, 229

        item['payload_args'] = str(job['payload']['args'])[:1024]
        item['payload_class'] = job['payload']['class']

job['payload'] may not be a sequence type (List, string, tuple etc...) so a check could be made to avoid an application error . something like this :

        item['payload_args'] = str(job['payload']['args'])[:1024] if isinstance(job['payload'], dict) else ''
        item['payload_class'] = job['payload']['class'] if isinstance(job['payload'], dict) else ''

Thanks

binarymatt commented 12 years ago

how are these jobs being populated into the queue?

The payload is typically supposed to be a dictionary.

salimane commented 12 years ago

i'm using php-resque https://github.com/chrisboulton/php-resque to populate the queue. and yes they normally are dict but seems there was something wrong so the payload wasn't a dict

binarymatt commented 12 years ago

if this is still a problem, please report it at http://github.com/Pyres/resweb