def more(self, id=None): # id will be something like d_ping_[ping.id] # so, I want to get a ping where id > that one. pid = id.split('_')[-1] try: pid = int(pid) except: log.debug("couldn't identify the ping %s "%id) return "" c.username = session.get('user') c.fl_mod = session.get('mod',False) for ping in PseudoPing.query().filter( PseudoPing.fl_decided==False).filter(PseudoPing.id>pid).order_by(PseudoPing.id): img = ping.Image_fromPing() if img.in_pool(): c.ping=ping c.image=ping.image c.atts = img.all_atts() return render('one_ping.mako') else: ping.fl_decided=True ping.commit() #Guess what. We're empty. get to bottom, go back to top. But this time, we need # to send back the newest image, rather than the next oldest one. if not self._reload(): return return self.more(id)
def index(self): c.results=[] c.username = session.get('user') c.fl_mod = session.get('mod',False) images = {} flSave = False for ping in PseudoPing.query().filter(PseudoPing.fl_decided==False).order_by(PseudoPing.id): if not images.get(ping.image): img = ping.Image_fromPing() if img.in_pool(): images[ping.image] = True c.results.append(ping) if len(c.results) >= 2: break else: flSave=True ping.fl_decided=True if not len(c.results): if self.reload(): return self.index() if flSave: ping.commit() return render('ping.mako')
def view(self, id=None): if id == None: return "Image id required" img = self._requireImg(id) if not img: return "Image not found" c.atts = img.all_atts() return render('image_view.mako')
def bookmarklet(self): # logged in... c.username = session['user'] user= model.User.get_byName(c.username) if user: c.secret=user.secret else: c.secret = 'SECRET' c.url=os.path.join(config['base_uri'], 'p') c.nsid = user.nsid return render('bookmarklet.mako')
def logout(self): """ Logout the user and display a confirmation message """ if 'user' in session: del(session['user']) if 'token' in session: del(session['token']) session.save() return render('logout.mako')
def home(self): return render('home.mako')
def serverinfo(self): return render('/serverinfo.mako')
def index(self): # Return a rendered template # return render('/template.mako') # or, Return a response return render('hello.mako')
def index(self): return render('profile.mako')
def moderators(self): return render('moderators.mako')
def members(self): return render('member.mako')