当前位置: 首页>>代码示例>>Python>>正文


Python MUser.insert_data方法代码示例

本文整理汇总了Python中torlite.model.muser.MUser.insert_data方法的典型用法代码示例。如果您正苦于以下问题:Python MUser.insert_data方法的具体用法?Python MUser.insert_data怎么用?Python MUser.insert_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在torlite.model.muser.MUser的用法示例。


在下文中一共展示了MUser.insert_data方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: UserHandler

# 需要导入模块: from torlite.model.muser import MUser [as 别名]
# 或者: from torlite.model.muser.MUser import insert_data [as 别名]

#.........这里部分代码省略.........
    @tornado.web.authenticated
    def logout(self):
        self.clear_all_cookies()
        self.redirect('/')

    @tornado.web.authenticated
    def changepass(self):
        self.render('tplite/user/changepass.html',
                    user_info=self.muser.get_by_id(self.user_name))

    @tornado.web.authenticated
    def change_info(self):
        self.render('tplite/user/changeinfo.html',
                    user_info=self.muser.get_by_id(self.user_name))

    @tornado.web.authenticated
    def change_privilege(self, xg_username):
        self.render('tplite/user/changeprivilege.html',

                    user_info=self.muser.get_by_id(xg_username))

    @tornado.web.authenticated
    def show_info(self):
        self.render('tplite/user/info.html',
                    user_info=self.muser.get_by_id(self.user_name))

    def to_login(self):
        if self.get_current_user():
            self.redirect('/')
        else:
            kwd = {
                'pager': '',
            }
            self.render('tplite/user/login.html', kwd=kwd)

    def register(self):
        post_data = {}
        for key in self.request.arguments:
            post_data[key] = self.get_arguments(key)
        form = SumForm(self.request.arguments)

        if form.validate():
            if self.muser.insert_data(post_data) == True:
                self.redirect('/user/login')
            else:
                self.render('html/404.html')
                self.set_status(400)

    def __to_register__(self):
        kwd = {
            'pager': '',
        }
        self.render('tplite/user/regist.html', kwd=kwd)

    def login(self):
        post_data = {}
        for key in self.request.arguments:
            post_data[key] = self.get_arguments(key)
        if 'next' in post_data:
            next_url = post_data['next'][0]
        else:
            next_url = '/'
        u_name = post_data['user_name'][0]
        u_pass = post_data['user_pass'][0]

        kwd = {
            'pager': '',
        }
        result = self.muser.check_user(u_name, u_pass)
        if result == 1:
            self.set_secure_cookie("user", u_name)
            self.redirect("{0}".format(next_url))
        elif result == -1:
            kwd = {
                'info': '没有这个用户'
            }
            self.render('html/404.html', kwd=kwd)
        else:
            self.redirect("{0}".format(next_url))

    def to_find(self, ):
        kwd = {
            'pager': '',
        }
        self.render('tplite/user/find.html', topmenu='', kwd=kwd)

    def find(self, keyword):
        kwd = {
            'pager': '',
            'unescape': tornado.escape.xhtml_unescape,
            'title': '查找结果',
        }
        self.render('tplite/user/find_list.html'.format(input),
                    kwd=kwd,
                    view=self.muser.get_by_keyword(keyword),
                    )

    def post_find(self):
        keyword = self.get_argument('keyword')
        self.find(keyword)
开发者ID:Geoion,项目名称:TorCMS,代码行数:104,代码来源:user_handler.py

示例2: UserHandler

# 需要导入模块: from torlite.model.muser import MUser [as 别名]
# 或者: from torlite.model.muser.MUser import insert_data [as 别名]

#.........这里部分代码省略.........
    @tornado.web.authenticated
    def change_privilege(self, xg_username):
        self.render('{0}/{1}/changeprivilege.html'.format(self.tmpl_name, self.tmpl_router),

                    user_info=self.muser.get_by_id(xg_username))

    @tornado.web.authenticated
    def show_info(self):
        self.render('{0}/{1}/info.html'.format(self.tmpl_name, self.tmpl_router),
                    user_info=self.muser.get_by_id(self.user_name),
                    userinfo=self.muser.get_by_id(self.user_name), )

    def to_reset_password(self):
        self.render('{0}/{1}/reset_password.html'.format(self.tmpl_name, self.tmpl_router))

    def to_login(self):
        if self.get_current_user():
            self.redirect('/')
        else:
            kwd = {
                'pager': '',
            }
            self.render('{0}/{1}/login.html'.format(self.tmpl_name, self.tmpl_router), kwd=kwd)

    def register(self):
        post_data = {}

        for key in self.request.arguments:
            post_data[key] = self.get_arguments(key)

        form = SumForm(self.request.arguments)

        if form.validate():
            if self.muser.insert_data(post_data):
                self.redirect('/user/login')
            else:
                kwd = {
                    'info': '注册不成功',
                }
                self.set_status(400)
                self.render('html/404.html',
                            cfg = config.cfg,
                            kwd=kwd)

        else:
            kwd = {
                    'info': '注册不成功',
                }
            self.set_status(400)
            self.render('html/404.html',
                        cfg = config.cfg,
                        kwd=kwd)

    def __to_register__(self):
        kwd = {
            'pager': '',
        }
        self.render('{0}/{1}/regist.html'.format(self.tmpl_name, self.tmpl_router),
                    cfg = config.cfg,
                    kwd=kwd)

    def login(self):
        post_data = {}
        for key in self.request.arguments:
            post_data[key] = self.get_arguments(key)
        if 'next' in post_data:
开发者ID:vaveee,项目名称:TorCMS,代码行数:70,代码来源:user_handler.py

示例3: UserHandler

# 需要导入模块: from torlite.model.muser import MUser [as 别名]
# 或者: from torlite.model.muser.MUser import insert_data [as 别名]
class UserHandler(BaseHandler):
    def initialize(self):
        self.muser = MUser()
        self.user_name = self.get_current_user()

    def get(self, url_str):
        url_arr = url_str.split('/')
        if url_str == 'regist':
            if self.get_current_user():
                self.redirect('/')
            else:
                self.__to_register__()
        elif url_str == 'login':
            self.to_login()
        elif url_str == 'info':
            self.show_info()
        elif url_str == 'logout':
            self.logout()
    def post(self, url_str):
        url_arr = url_str.split('/')
        if url_str == 'regist':
            self.register()
        elif url_str == 'login':
            self.login()
        elif url_str == 'changepass':
            self.changepassword()



    @tornado.web.authenticated
    def changepassword(self):
        post_data = {}
        for key in self.request.arguments:
            post_data[key] = self.get_arguments(key)

        uu = self.muser.check_user(self.user_name, post_data['rawpass'][0])
        print(uu)
        if uu == 1:
            self.muser.update_pass(self.user_name, post_data['user_pass'][0])
            self.redirect(('/user/info'))
        else:
            return False



    @tornado.web.authenticated
    def logout(self):
        self.clear_all_cookies()
        self.redirect('/')

    @tornado.web.authenticated
    def show_info(self):
        self.render('tplite/user/info.html',
                    user_info = self.muser.get_by_id(self.user_name))




    def to_login(self):
        if self.get_current_user():
            self.redirect('/')
        else:
            kwd = {
                'pager': '',
            }
            self.render('tplite/user/login.html', kwd=kwd)

    def register(self):
        post_data = {}
        for key in self.request.arguments:
            post_data[key] = self.get_arguments(key)
        form = SumForm(self.request.arguments)

        if form.validate():
            if self.muser.insert_data(post_data) == True:
                self.redirect('/user/login')
            else:
                self.render('html/404.html')
                self.set_status(400)

    def __to_register__(self):
        kwd = {
            'pager': '',
        }
        self.render('tplite/user/regist.html', kwd=kwd)


    def login(self):

        post_data = {}
        for key in self.request.arguments:
            post_data[key] = self.get_arguments(key)

        if 'next' in post_data:
            next_url = post_data['next'][0]
        else:
            next_url = ''
        u_name = post_data['user_name'][0]
        u_pass = post_data['user_pass'][0]

#.........这里部分代码省略.........
开发者ID:jiajie999,项目名称:TorCMS,代码行数:103,代码来源:user_handler.py


注:本文中的torlite.model.muser.MUser.insert_data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。