James Tocknell  committed 2f1f9e5

Added songs to handlers.rst

  • Participants
  • Parent commits 86412ce
  • Branches default

Comments (0)

Files changed (4)

File docs/handlers.rst

 Handlers must be an object which specifies a ``layout`` method which takes a
 theme object, which must have a ``templates`` attribute. If none of the required
 templates are given in the ``templates`` attribute, then the handler should
 .. automodule:: shinypress.handler
+Documentation for specific handlers follows:
+This handler is for songs/lyrics.
+.. automodule:: shinypress.songs
+    :members:

File shinypress/

         raise NotImplemented
+class CannotRender(Exception):
+    """
+    Generic error for handlers to raise.
+    """
+    pass

File shinypress/songs/

 from itertools import groupby
 import json
-import ..handler.Handler as BaseHandler
-from ..handler import CannotRender
+from shinypress.handler import Handler as BaseHandler
+from shinypress.handler import CannotRender
-from .old_format import parse as old_parse
-from .old_format import dumps as old_dumps
-from .old_format import Verse
-from .utils import flatten, uniqc
+from shinypress.songs.old_format import parse as old_parse
+from shinypress.songs.old_format import dumps as old_dumps
+from shinypress.songs.old_format import Verse
+from shinypress.songs.utils import flatten, uniqc
 class Song(BaseHandler):
     A representation of a song.
     info = {}
     verses = {}
     ordering = {}
     def to_old_format(self, f, ordering_name=""):
-        f.write(old_dumps(, Verse(
+        f.write(old_dumps(, (Verse(
-            ) for verse in uniqc(flatten(self.ordering[ordering_name]))))
+            ) for verse in uniqc(flatten(self.ordering[ordering_name])))))

File shinypress/songs/

 # -*- coding: utf-8 -*-
-from ..text.mulitple import GreedyDualSize
-from . import Song
+from shinypress.songs import Song
 def old_to_new(old_song_file, new_json_file):