Esempio n. 1
0
def slugify(value):
    """
    Normalizes string, converts to lowercase, removes non-alpha characters,
    and converts spaces to hyphens.

    From Django's "django/template/defaultfilters.py".

    Make use strutils.to_slug from openstack common
    """
    return strutils.to_slug(value, incoming=None, errors="strict")
Esempio n. 2
0
 def human_id(self):
     """Human-readable ID which can be used for bash completion.
     """
     if self.NAME_ATTR in self.__dict__ and self.HUMAN_ID:
         return strutils.to_slug(getattr(self, self.NAME_ATTR))
     return None