Esempio n. 1
0
  def __init__(self, subAlbum, picName, control, start_response):
    templateLines = open(Setup.pathToTemplate)
    writer = start_response('200 OK',[('Content-type','text/html; charset=utf-8')])
    self.writer = writer
    self.start_response = start_response
    currDir = os.path.join(Setup.albumLoc,subAlbum)
    album = Album(currDir,start_response)
    if (control == ''):
      if (picName != ''):
        pic = Pic(start_response,os.path.join(currDir,picName))
      else:
        pic = Pic(start_response,'')
    else:
      if (control == 'first'):
      	pic = Pic(start_response,os.path.join(currDir,album.getFirstPic()))
      if (control == 'previous'):
      	pic = Pic(start_response,os.path.join(currDir,album.getPreviousPic(picName)))
      if (control == 'next'):
      	pic = Pic(start_response,os.path.join(currDir,album.getNextPic(picName)))
      if (control == 'last'):
      	pic = Pic(start_response,os.path.join(currDir,album.getLastPic()))

    #self.printMetaData(currDir, pic, control)

    line = ''.join(templateLines)
    line = line.replace('@path@',       Setup.webPathToStatic)
    line = line.replace('@breadcrumb@', self.formatBreadCrumb(album, pic )) 
    line = line.replace('@title@',      self.formatTitle(     album, pic ))
    line = line.replace('@albums@',     self.formatAlbums(    album      ))
    line = line.replace('@pics@',       self.formatPics(      album, pic ))
    line = line.replace('@meta@', '')
#    line = line.replace('@meta@',       self.formatMeta(      album      ))
    line = line.replace('@control@',    self.formatControl(   album, pic ))
    line = self.formatContent(line, album, currDir, pic)
    self.content = line.encode('utf-8')