mirror of https://github.com/peter4431/rq.git
Factor out a Queue object.
It might be useful to add some methods to that object, later.main
parent
834a79814e
commit
5eadd5ef52
@ -0,0 +1,17 @@
|
||||
def to_queue_key(queue_name):
|
||||
return 'rq:%s' % (queue_name,)
|
||||
|
||||
|
||||
class Queue(object):
|
||||
def __init__(self, friendly_name):
|
||||
if not friendly_name:
|
||||
raise ValueError("Please specify a valid queue name (Got '%s')." % friendly_name)
|
||||
self.name = friendly_name
|
||||
self._key = to_queue_key(friendly_name)
|
||||
|
||||
@property
|
||||
def key(self):
|
||||
return self._key
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
Loading…
Reference in New Issue