(self)
Generates possible slugs

        The consumer can can consume until it get's an unused one
Generates possible slugs
Generates possible slugs
def __iter__(self):
        """Generates possible slugs

        The consumer can can consume until it get's an unused one"""

        if self.obj.slug:
            # The object already has a slug
            raise StopIteration

        if not self.base_slug:
            raise StopIteration

        # first we try with the base slug
        yield str(self.base_slug)

        for n in count(1):
            tmp_slug = "%s-%d" % (self.base_slug, n)
            # slugify returns SafeUnicode, we need a plain string
            yield str(tmp_slug)
def __iter__ ( self ) : if self . obj . slug : # The object already has a slug raise StopIteration if not self . base_slug : raise StopIteration # first we try with the base slug yield str ( self . base_slug ) for n in count ( 1 ) : tmp_slug = "%s-%d" % ( self . base_slug , n ) # slugify returns SafeUnicode, we need a plain string yield str ( tmp_slug )