예제 #1
0
 def pages_from_model(model, name, path=None, now=None):
     now = now or datetime.datetime.now()
     lc = Build.lifecycle(dict(model.metadata))
     data = Site.multidict(model.metadata)
     for n, (scene, shots) in enumerate(
             itertools.groupby(model.shots,
                               key=operator.attrgetter("scene"))):
         yield Site.Page(
             (lc.view_at or lc.made_at or now, name, n),
             None,
             Theme.slug(name),
             Theme.slug(scene),
             lc,
             scene,
             model,
             text=None,
             html=None,
             path=path,
             feeds=frozenset(Site.feeds_from_script(model) or ["all"]),
             tags=frozenset(v.lower() for k, v in model.metadata
                            if k.lower() == "tag"))
예제 #2
0
 def test_slug(self):
     text = "ABab234$%^&*-_ "
     rv = Theme.slug(text)
     self.assertEqual("abab234-_-", rv)