def post(self, *args): title = self.get_argument('title') desc = self.get_argument('desc') try: Gallary.add(title, desc) except Exception as e: print str(e)
def post(self, *args): files = self.request.files['qqfile'] gid = self.get_argument('gid') for i in files: try: url = Gallary.up_to_upyun('gallary', i) if url: Gallary.save_photo(gid, url, i.get('filename')) self.write(json.dumps({'success': 'true'})) else: self.write(json.dumps({'success': 'false'})) except Exception as e: print str(e)
def post(self, *args): data = self.request.files['userfile'] try: url = Gallary.up_to_upyun('diary', data[0]) self.write('![](%s)' % str(url)) except Exception as e: print str(e)
def get(self, *args): try: albums = Gallary.get_all() profile = Account.get() except Exception as e: self.send_error(404) send_error_email('Gallary get Error', str(e)) self.render('Gallary/index.html', albums=albums, profile=profile)
def get(self, _id): try: photos = Gallary.get_detail(_id) self.render('Admin/Gallary/detail.html', photos=photos, gid=_id) except Exception as e: print str(e)
def get(self): gallaries = Gallary.get_all() self.render('Admin/Gallary/index.html', gallaries=gallaries)