def news(self): f = open("./soycorn/public/articles/links", "r") c.location = "" c.title = "news" c.article = [] for l in f.readlines(): s = l.split(";") c.article.append(s) return render('newshome.mako')
def show(self, title): dir = os.path.join("./soycorn/public/static", title) if os.path.exists(dir): c.title = title c.location = "" c.pic = self.pic f = open(dir, "r") c.content = f.read() return render('show.mako') abort(404)
def article(self, title): dir = os.path.join("./soycorn/public/articles", title) if os.path.exists(dir): c.title = title c.location = "../" c.pic = self.pic f = open(dir, "r") c.date = f.readline() c.header = f.readline() c.content = f.read() return render('article.mako') abort(404)
def photo(self, title, dif=9, picStart=75): c.title = title c.location = "../" pagenum = int(title) if(pagenum == 1): c.back = 1 c.forward = 2 elif(pagenum == 15): c.back = 14 c.forward = 15 else: c.back = pagenum - 1 c.forward = pagenum + 1 start = picStart+(pagenum-1)*dif c.range = [] row = -1 col = 0 counter = 0 captions = self.getCaptions() #Sine I may be skiping values, need to increment and not do a range while counter < dif: curCaption = captions[str(start)] if curCaption == "NONE\n": start += 1 continue if curCaption =="END": break if col % 3 == 0: row += 1 c.range.append([]) s = str(start) if(start < 100): s = "0"+s val = (s, curCaption) c.range[row].append(val) col += 1 start += 1 counter += 1 return render('photo.mako')
def photo(self, title, dif=9, picStart=75): c.title = title c.location = "../" pagenum = int(title) if (pagenum == 1): c.back = 1 c.forward = 2 elif (pagenum == 15): c.back = 14 c.forward = 15 else: c.back = pagenum - 1 c.forward = pagenum + 1 start = picStart + (pagenum - 1) * dif c.range = [] row = -1 col = 0 counter = 0 captions = self.getCaptions() #Sine I may be skiping values, need to increment and not do a range while counter < dif: curCaption = captions[str(start)] if curCaption == "NONE\n": start += 1 continue if curCaption == "END": break if col % 3 == 0: row += 1 c.range.append([]) s = str(start) if (start < 100): s = "0" + s val = (s, curCaption) c.range[row].append(val) col += 1 start += 1 counter += 1 return render('photo.mako')
def index(self): f = open("./soycorn/public/static/index", "r") g = open("./soycorn/public/articles/links", "r") c.content = f.read() c.location = "" c.title = "index" #c.pic = self.pic c.firstlink = [] c.article = [] count = 0 firstcheck = True for l in g.readlines(): s = l.split(";") if len(s) < 2: continue if firstcheck: c.firstlink.append(s) firstcheck = False continue c.article.append(s) count += 1 if count > 8: break return render('index.mako')
def photo3(self, title, dif=9, picStart=210): c = self.photo(title, 'photo3', 9, 1, 'photo3', 28) c.jpg_caps = "JPG" return render('photo.mako')
def new_photo(self, title, dif=9, picStart=210): c = self.photo(title, 'newimages', 9, 210, 'newcaptions', 25) c.jpg_caps = "JPG" return render('photo.mako')
def old_photo(self, title): c = self.photo(title, 'images', 9, 75, 'photocaptions', 14) c.jpg_caps = "jpg" return render('photo.mako')