def get_queue_item(self): """ Return a QueueItem if this object is in a queue, otherwise raise an exception """ if not self.is_queued(): raise UnknownQueueItem() return QueueItem(self.jenkins, **self._data['queueItem'])
def get_queue_item(self): """ Return a QueueItem if this object is in a queue, otherwise raise an exception """ if not self.is_queued(): raise UnknownQueueItem() q_item = self.poll(tree='queueItem[url]') qi_url = urlparse.urljoin(self.jenkins.baseurl, q_item['queueItem']['url']) return QueueItem(qi_url, self.jenkins)
def __getitem__(self, item_id): self_as_dict = dict(self.iteritems()) if item_id in self_as_dict: return self_as_dict[item_id] else: raise UnknownQueueItem(item_id)