Esempio n. 1
0
	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)
Esempio n. 2
0
	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')
Esempio n. 3
0
	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')
Esempio n. 4
0
	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')
Esempio n. 5
0
	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')
Esempio n. 6
0
	def home(self):
		return render('home.mako')
Esempio n. 7
0
	def serverinfo(self):
		return render('/serverinfo.mako') 
Esempio n. 8
0
	def index(self):
		# Return a rendered template
		#	return render('/template.mako')
		# or, Return a response
		return render('hello.mako')
Esempio n. 9
0
	def index(self):
		return render('profile.mako')
Esempio n. 10
0
	def moderators(self):
		return render('moderators.mako')
Esempio n. 11
0
	def members(self):
		return render('member.mako')