def post(self): g = self.request.get("th") i=int(g) c=Theme.get_by_id(i) o=ThemeTwo.all().get() if o is not None: o.link=c.link o.name=c.name o.author=c.author o.put() else: m=ThemeTwo() m.link=c.link m.name=c.name m.author=c.author m.put() self.redirect(self.request.referer)
def get(self,idc): g =int(idc) photo=Theme.get_by_id(g) self.response.headers['Content-Type'] = 'image/jpeg' self.response.out.write(photo.avatar)
def post(self): g = self.request.get("th") o=ThemeTwo.all().get() if o is not None: if g=="white": o.link=db.Link("http://www.v2ex.com/") o.name="white" o.author="livid" o.put() elif g=="purple": o.link=db.Link("http://www.v2ex.com/") o.name="purple" o.author="livid" o.put() elif g=="orange": o.link=db.Link("http://www.v2ex.com/") o.name="orange" o.author="livid" o.put() elif g=="night": o.link=db.Link("http://www.v2ex.com/") o.name="night" o.author="livid" o.put() elif g=="dust": o.link=db.Link("http://www.v2ex.com/") o.name="dust" o.author="livid" o.put() elif g=="mour": o.link=db.Link("http://blog.kf25.cn/romoo") o.name="mour" o.author="Romoo" o.put() elif g=="light": o.link=db.Link("http://www.v2ex.com/") o.name="light" o.author="livid" o.put() elif g=="grid": o.link=db.Link("http://www.singrun.com/") o.name="grid" o.author="singrun" o.put() elif g=="cloud": o.link=db.Link("http://www.saicn.com/") o.name="cloud" o.author="sai" o.put() elif g=="flamingo": o.link=db.Link("http://www.ccdjh.com/") o.name="flamingo" o.author="livid" o.put() elif g=="tropical": o.link=db.Link("http://www.ccdjh.com/") o.name="tropical" o.author="ccdjh" o.put() elif g=="ivory": o.link=db.Link("http://www.ccdjh.com/") o.name="ivory" o.author="ccdjh" o.put() elif g=="cerulean": o.link=db.Link("http://www.ccdjh.com/") o.name="cerulean" o.author="ccdjh" o.put() elif g=="cobalt": o.link=db.Link("http://www.ccdjh.com/") o.name="cobalt" o.author="ccdjh" o.put() elif g=="coffee": o.link=db.Link("http://www.ccdjh.com/") o.name="coffee" o.author="ccdjh" o.put() elif g=="redstar": o.link=db.Link("http://www.ccdjh.com/") o.name="redstar" o.author="ccdjh" o.put() else: i=int(g) c=Theme.get_by_id(i) o.link=c.link o.name=c.name o.author=c.author o.put() else: m=ThemeTwo() if g=="white": m.link=db.Link("http://www.v2ex.com/") m.name="white" m.author="livid" m.put() elif g=="purple": m.link=db.Link("http://www.v2ex.com/") m.name="purple" m.author="livid" m.put() elif g=="orange": m.link=db.Link("http://www.v2ex.com/") m.name="orange" m.author="livid" m.put() elif g=="night": m.link=db.Link("http://www.v2ex.com/") m.name="night" m.author="livid" m.put() elif g=="dust": m.link=db.Link("http://www.v2ex.com/") m.name="dust" m.author="livid" m.put() elif g=="mour": m.link=db.Link("http://blog.kf25.cn/romoo") m.name="mour" m.author="romoo" m.put() elif g=="light": m.link=db.Link("http://www.v2ex.com/") m.name="light" m.author="livid" m.put() elif g=="grid": m.link=db.Link("http://www.singrun.com/") m.name="grid" m.author="singrun" m.put() elif g=="cloud": m.link=db.Link("http://www.saicn.com/") m.name="cloud" m.author="sai" m.put() elif g=="flamingo": m.link=db.Link("http://www.ccdjh.com/") m.name="flamingo" m.author="ccdjh" m.put() elif g=="tropical": m.link=db.Link("http://www.ccdjh.com/") m.name="tropical" m.author="ccdjh" m.put() elif g=="ivory": m.link=db.Link("http://www.ccdjh.com/") m.name="ivory" m.author="ccdjh" m.put() elif g=="cerulean": m.link=db.Link("http://www.ccdjh.com/") m.name="cerulean" m.author="ccdjh" m.put() elif g=="cobalt": m.link=db.Link("http://www.ccdjh.com/") m.name="cobalt" m.author="ccdjh" m.put() elif g=="coffee": m.link=db.Link("http://www.ccdjh.com/") m.name="coffee" m.author="ccdjh" m.put() elif g=="redstar": m.link=db.Link("http://www.ccdjh.com/") m.name="redstar" m.author="ccdjh" m.put() else: i=int(g) c=Theme.get_by_id(i) m.link=c.link m.name=c.name m.author=c.author m.put() self.redirect(self.request.referer)