Esempio n. 1
0
 def slug(self, slug):
     slugify_slug = slugify(slug) if slug else slugify(self.title)
     if not self._slug:
         self._slug = slugify_slug
         for x in itertools.count(1):
             if not db.session.query(
                     db.exists().where(Post.slug == self._slug)).scalar():
                 break
             self._slug = "{}-{}".format(slugify_slug, x)
         return
     self._slug = slugify_slug
Esempio n. 2
0
 def name(self, name):
     self._name = name.strip()
     if self.slug is None:
         self.slug = slugify(name)[:255]
Esempio n. 3
0
 def title(self, title):
     self._title = title.strip()
     if self.slug is None:
         self.slug = slugify(title)[:255]
Esempio n. 4
0
 def slug(self, slug):
     self._slug = slugify(slug) if slug else slugify(self.name)