示例#1
0
    def post(self, *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:
                idInfo = generateInfoid()

                try:
                    publish_res(uid, idInfo, content, title)
                    self.render('error.html', title='资源发布成功', content='成功发布了一条课程资源', icon='ion-checkmark-circled',
                                active='ntfc', id=uid)
                except Exception as e:
                    print e
示例#2
0
    def post(self, *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:
                from postingInfo import infoIdState
                idInfo = infoIdState(self)

                try:
                    publish_res(uid, idInfo, content, title)
                    self.render('error.html', title='资源发布成功', content='成功发布了一条课程资源', icon='ion-checkmark-circled',
                                active='ntfc', id=uid)
                    self.clear_cookie('Iid')
                except Exception as e:
                    self.clear_cookie('Iid')
                    print e