mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-10-22 02:25:05 +00:00
21 lines
531 B
Python
21 lines
531 B
Python
|
from slugid import nice as 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]
|