Next / Previous / Contents / TCC Help System / NM Tech homepage

12.5. FormPhotoSet.buildPage(): Build the XHTML page for one form

This method is the driver for the construction of the XHTML page representing the forms in this FormPhotoSet.

catweb
# - - -   F o r m P h o t o S e t . b u i l d P a g e

    def buildPage(self):
        '''Builds the XHTML page for self.
        '''

For the URL of the stylesheet, see Section 9.2, “CSS_STYLESHEET: Stylesheet name”.

catweb
        #-- 1
        # [ page  :=  a new, generic XHTML page with self's title
        #   body  :=  the body element of that page ]
        titleText  = ("Shipman's bird photo index: {0}".format(
                        self.birdId.engComma()))
        page, body = webPage(titleText, CSS_STYLESHEET)

The body of the page is mainly a table. See Section 12.6, “formSet._buildTable(): Build the image table”.

catweb
        #-- 2
        # [ body  :=  body with a table added containing
        #       thumbnails and catalog data from self ]
        self._buildTable(body)

The page is now complete. Create the file and serialize the page to it.

catweb
        #-- 3
        # [ if self's page can be created new ->
        #     pagePath  :=  path to self's file
        #     pageFile  :=  a new, empty file ]
        pagePath = self.pathName()
        pageFile = open(pagePath, "w")

        #-- 4
        # [ pageFile  +:=  page, serialized ]
        page.write(pageFile, pretty_print=True)
        pageFile.close()