def get(self, infoId, *args, **kwargs): gp, uid = is_loged(self) if gp == 't': self.clear_cookie('Iid') self.set_secure_cookie('Iid',infoId) info = get_info(infoId) content = info['detail'] title = info['title'] self.render('teacher_publish_notif.html', id=uid, active='dsh', active_slide='ntfc', n_title=title, content=content, act='edit') else: self.redirect('/404')
def post(self, infoId, *args, **kwargs): gp, uid = is_loged(self) if gp == 't': content = self.get_argument('content') title = self.get_argument('title') if len(title) > 50: self.render('error.html', title=None, content='标题过长<br>请重新输入', icon='ion-alert-circled', active='ntfc', id=uid) else: if not get_info(infoId): self.render('error.html', title=None, content='通知不存在', icon='ion-sad', active='dsh', id=uid) else: try: if not update_notif(infoId, content, title): self.render('error.html', title='通知更新成功', content='成功更新了一条课程通知', icon='ion-checkmark-circled', active='dsh', id=uid) else: print 'teacher not exist' except Exception as e: print e
def get(self, infoId, *args, **kwargs): gp, uid = is_loged(self) if gp == 't': info = get_info(infoId) content = html2Text(info['detail']) title = info['title'] self.render('teacher_publish_resource.html', id=uid, active='dsh', active_slide='ntfc', r_title=title, r_content=content, act='edit') else: self.redirect('/404')