示例#1
0
文件: main.py 项目: xavdid/tumblradv
	def get(self):
		if self.request.get('person'):
			tg=self.request.get('person')
		else:
			tg='itsallabeautifullie'
		t=''
		params={'num':49}
		postar=tumblrlib.get_posts(tg,t,params)
		page=tumblrlib.make_html_header('QR Page')
		page+='<a href="/"> Go Back </a><br>'
		k=0
		l=0
		for p in postar:
			if l==3 and k==3:
				page+="<img src='https://chart.googleapis.com/chart?cht=qr&chs=120x120&chl=http://%s.tumblr.com'></img>" %tg
				l+=1
				k+=1
				continue
			else:
				page+="<img src='https://chart.googleapis.com/chart?cht=qr&chs=120x120&chl=%s'></img>" % p.url
				k+=1
			if k==7:
				page+='<br>'
				k=0
				l+=1
		page += tumblrlib.make_html_footer()
		self.response.out.write(page)
示例#2
0
文件: main.py 项目: xavdid/tumblradv
    def get(self):
    	if self.request.get('person'):
    		tg=self.request.get('person')
    	else:
    		tg='itsallabeautifullie'
    	if self.request.get('tagzor'):
    		t=self.request.get('tagzor')
    	else:
    		t=''
    	if self.request.get('sorter')=='answer':
    		params={}
    	elif self.request.get('sorter') and self.request.get('sorter')!='answer':
    		s=self.request.get('sorter')
    		params={'type':s}
    	else:
    		params={}
    	if t=='':
    		tt='noting in particular'
    	else:
    		tt=t
    	postses=tumblrlib.get_posts(tg,t,params)

    	t1 = template.Template('You are searching the tumblr {{ tum_name }} for {{search_kind}}')
    	c1 = template.Context({"tum_name": tg, "search_kind": tt})
    	output = t1.render(c1)

    
    	
    	if self.request.get('sorter')=='answer':
    		page = tumblrlib.make_html_header(output)
    		page+=self.genForm()
    		page+='Want to see this blog as a <a href="/qrpage.html?person=%s">QR</a> page?' % tg
    		if p.what_sort=='answer':
    				page += p.makeHTML()
    		page += tumblrlib.make_html_footer()
    	else:
    		try:	
    			page = tumblrlib.make_html_header(output)
    			page+=self.genForm()  
    			page+='Want to see this blog as a <a href="/qrpage.html?person=%s">QR</a> page?' % tg
    			for p in postses:
    				page += p.makeHTML()
    			page += tumblrlib.make_html_footer()
    		except:
    			page= '\n\n\n\n<br><br>Hey, something isn\'t working... It\'s tumblr\'s fault though! Try again soon.\n\n\n'
    	self.response.out.write(page)