gecko-dev/testing/taskcluster/taskcluster_graph/slugidjar.py
jlal@mozilla.com 7cb9e2d0f9 Bug 1111980 - Part 6 Add slugjar to back the as_slugid functionality needed for decision tasks. r=garndt
--HG--
extra : rebase_source : a69885827a1b04b20bf90de973370b25558ee652
extra : source : 96f074457b2f003283e2fa3cbf523dea39beabba
2014-12-11 12:53:10 -08:00

21 lines
541 B
Python

from taskcluster_graph.slugid import slugid
class SlugidJar():
'''
Container of seen slugid's used to implement the as_slugid functionality
used in the task graph templates.
'''
def __init__(self):
self._names = {}
def __call__(self, name):
'''
So this object can easily be passed to mustache we allow it to be called
directly...
'''
if name in self._names:
return self._names[name];
self._names[name] = slugid()
return self._names[name]