Пример #1
0
 def human_id(self):
     """Human-readable ID which can be used for bash completion.
     """
     if self.HUMAN_ID:
         name = getattr(self, self.NAME_ATTR, None)
         if name is not None:
             return strutils.to_slug(name)
     return None
Пример #2
0
 def human_id(self):
     """Human-readable ID which can be used for bash completion.
     """
     if self.HUMAN_ID:
         name = getattr(self, self.NAME_ATTR, None)
         if name is not None:
             return strutils.to_slug(name)
     return None
Пример #3
0
def slugify(value):
    """Converts a string usable in a url or filename.

    Normalizes string, converts to lowercase, removes non-alpha characters,
    and converts spaces to hyphens.

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

    Make use of strutils.to_slug from openstack common
    """
    return strutils.to_slug(value, incoming=None, errors="strict")