def get(self, content_id): databaseOperations.connectToDatabase('astrodb') if self.current_user: sessionUserID = databaseOperations.getIDFromUser(self.get_secure_cookie("user"))[0] else: sessionUserID = -1 code=databaseOperations.fetchCode(content_id) if code: path = '../code/' + str(code[0]) codeFile = open(path, 'r+') codeContent = codeFile.read() codeFile.close() else: codeContent = None self.render("../showcode.html", userName=self.get_secure_cookie("user"), code=code, codeContent = codeContent, sessionUserID = sessionUserID, isAdmin=databaseOperations.isAdmin(self.get_secure_cookie("user")), commentNum=databaseOperations.fetchCommentNum(content_id), comments=databaseOperations.fetchComments(content_id), contentID=content_id) databaseOperations.closeConnectionToDatabase()
def get(self, content_id): databaseOperations.connectToDatabase('astrodb') if self.current_user: sessionUserID = databaseOperations.getIDFromUser(self.get_secure_cookie("user"))[0] else: sessionUserID = -1 news = databaseOperations.fetchNews(content_id) if news: path = '../news/' + str(news[0]) newsFile = open(path, 'r+') newsContent = newsFile.read() newsFile.close() else: newsContent = None self.render("../shownews.html", userName=self.get_secure_cookie("user"), news=news, newsContent = newsContent, sessionUserID = sessionUserID, isAdmin=databaseOperations.isAdmin(self.get_secure_cookie("user")), commentNum=databaseOperations.fetchCommentNum(content_id), comments=databaseOperations.fetchComments(content_id), contentID=content_id ) databaseOperations.closeConnectionToDatabase()
def get(self, content_id): databaseOperations.connectToDatabase('astrodb') if self.current_user: sessionUserID = databaseOperations.getIDFromUser(self.get_secure_cookie("user"))[0] else: sessionUserID = -1 self.render("../showart.html", userName=self.get_secure_cookie("user"), art=databaseOperations.fetchArt(content_id), sessionUserID = sessionUserID, isAdmin=databaseOperations.isAdmin(self.get_secure_cookie("user")), commentNum=databaseOperations.fetchCommentNum(content_id), comments=databaseOperations.fetchComments(content_id), contentID=content_id) databaseOperations.closeConnectionToDatabase()