malthe / pq

A PostgreSQL job queueing system
376 stars 41 forks source link

Fix bug when instantiating PQ with no queue_class #32

Closed bram2000 closed 5 years ago

bram2000 commented 5 years ago

Fix to the following issue that prevents pq working with default queue class.

>>> pq = PQ(conn)
>>> pq.create()
Traceback (most recent call last):
  File "/Users/<USER>/.local/share/virtualenvs/eg2-o6qwgJzB/lib/python3.6/site-packages/pq/__init__.py", line 46, in __getitem__
    return self.queues[name]
  File "/Users/<USER>/.local/share/virtualenvs/eg2-o6qwgJzB/lib/python3.6/weakref.py", line 137, in __getitem__
    o = self.data[key]()
KeyError: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/<USER>/.local/share/virtualenvs/eg2-o6qwgJzB/lib/python3.6/site-packages/pq/__init__.py", line 59, in create
    queue = self['']
  File "/Users/<USER>/.local/share/virtualenvs/eg2-o6qwgJzB/lib/python3.6/site-packages/pq/__init__.py", line 52, in __getitem__
    name, self.queue_class(name, *self.params[0], **self.params[1])
TypeError: 'NoneType' object is not callable
malthe commented 5 years ago

Released as 1.6.1.

Sorry! :-)