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


Python MUser.get_by_keyword方法代码示例

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


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

示例1: UserHandler

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

#.........这里部分代码省略.........
                'info': '密码验证出错,请<a href="/user/login">重新登陆</a>。'
            }
            self.render('html/404.html',
                        cfg = config.cfg,
                        kwd=kwd)
        elif result == -1:
            self.set_status(401)
            kwd = {
                'info': '没有这个用户'
            }
            self.render('html/404.html',
                        cfg = config.cfg,
                        kwd=kwd)
        else:
            self.set_status(305)
            self.redirect("{0}".format(next_url))

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

    def p_to_find(self, ):

        kwd = {
            'pager': '',

        }
        self.render('{0}/{1}/find_list.html'.format(self.tmpl_name, self.tmpl_router),
                    kwd=kwd,
                    view=self.muser.get_by_keyword(""),
                    cfg = config.cfg,
                        )

    def find(self, keyword):
        kwd = {
            'pager': '',
            'unescape': tornado.escape.xhtml_unescape,
            'title': '查找结果',
        }
        if self.tmpl_router == "user":
            self.render('{0}/{1}/find_list.html'.format(self.tmpl_name, self.tmpl_router),
                        kwd=kwd,
                        view=self.muser.get_by_keyword(keyword),
                        cfg = config.cfg,
                        )
        else:
            result=self.muser.get_by_keyword(keyword)
            if result:
                output = {
                    'find': result
                }
            else:
                output = {
                    'find': 0,
                }

            return json.dump(output, self)

    def delete(self, del_id):

        if self.tmpl_router == "user":
开发者ID:vaveee,项目名称:TorCMS,代码行数:69,代码来源:user_handler.py

示例2: UserHandler

# 需要导入模块: from torlite.model.muser import MUser [as 别名]
# 或者: from torlite.model.muser.MUser import get_by_keyword [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


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