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


Python muser.MUser类代码示例

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


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

示例1: AdminHandler

class AdminHandler(tornado.web.RequestHandler):
    def initialize(self):
        self.mpost = MPost()
        self.mcat = MCatalog()
        self.muser = MUser()
        self.mpage = MPage()
        self.mlink = MLink()
        if self.get_current_user():
            self.userinfo = self.muser.get_by_id(self.get_current_user())
        else:
            self.userinfo = None

    def get_current_user(self):
        return self.get_secure_cookie("user")

    def get(self, input=''):
        if input == '':
            self.index()
        else:
            self.render('html/404.html')

    @tornado.web.authenticated
    def index(self):
        self.render('admin/admin_index.html',
                    user_info=self.muser.get_by_id(self.get_current_user())
                    )
开发者ID:southwestjiaotongunivercity,项目名称:TorCMS,代码行数:26,代码来源:admin_handler.py

示例2: SimpleWidgetTestCase

class SimpleWidgetTestCase(unittest.TestCase):
    def setUp(self):
        self.muser = MUser()

        payload1 = {
            'user_name': 'giser1',
            'user_pass': '1234567',
        }
        self.r1 = requests.post('http://127.0.0.1:8088/user/regist', payload1)
        payload1 = {
            'user_name': 'giser1',
            'user_pass': '1234567',
            'user_email': 'sadf',
        }
        self.r2 = requests.post('http://127.0.0.1:8088/user/regist', payload1)

        payload3 = {
            'user_name': 'giser1',
            'user_pass': '1234567',
            'user_email': '[email protected]',
        }
        self.r3 = requests.post('http://127.0.0.1:8088/user/regist', payload3)
        # 相同用户名注册
        self.r55 = requests.post('http://127.0.0.1:8088/user/regist', payload3)

        self.r4 = requests.post('http://127.0.0.1:8088/user/login', payload3)

        payload4 = {
            'user_name': 'giser1',
            'user_pass': '7654321',
        }
        self.r5 = requests.post('http://127.0.0.1:8088/user/login', payload4)

    def tearDown(self):
        self.muser.delete_by_user_name('giser1')
开发者ID:hitrustnet,项目名称:TorCMS,代码行数:35,代码来源:testUserFunc.py

示例3: LabelHandler

class LabelHandler(BaseHandler):
    def initialize(self):
        self.init()
        self.muser = MUser()
        self.mequa = MPost()
        self.mtag = MLabel()
        self.mapp2tag = MPost2Label()
        if self.get_current_user():
            self.userinfo = self.muser.get_by_id(self.get_current_user())
        else:
            self.userinfo = None

    def get(self, url_str=''):
        url_arr = self.parse_url(url_str)

        if len(url_arr) == 1:
            self.list(url_str)
        elif len(url_arr) == 2:
            self.list(url_arr[0], url_arr[1])
        else:
            return False

    # def post(self, url_str=''):
    #     if len(url_str) > 0:
    #         url_arr = url_str.split('/')
    #     else:
    #         return False
    #
    #     if url_arr[0] == 'edit':
    #         self.edit(url_arr[1])

    def list(self, tag_slug, cur_p=''):
        '''
        根据 cat_handler.py 中的 def view_cat_new(self, cat_slug, cur_p = '')
        :param tag_slug:
        :return:
        '''
        if cur_p == '':
            current_page_number = 1
        else:
            current_page_number = int(cur_p)

        current_page_number = 1 if current_page_number < 1 else current_page_number

        pager_num = int(self.mapp2tag.total_number(tag_slug) / config.page_num)
        tag_name = ''
        kwd = {
            'tag_name': tag_name,
            'tag_slug': tag_slug,
            'title': tag_name,
        }

        self.render('{0}/label/list.html'.format(self.tmpl_name),
                    infos=self.mapp2tag.query_pager_by_slug(tag_slug, current_page_number),
                    unescape=tornado.escape.xhtml_unescape,
                    kwd=kwd,
                    userinfo=self.userinfo,
                    pager=tools.gen_pager_bootstrap_url('/label/{0}'.format(tag_slug), pager_num, current_page_number),
                    cfg = config.cfg,
                    )
开发者ID:vaveee,项目名称:TorCMS,代码行数:60,代码来源:label_handler.py

示例4: initialize

 def initialize(self):
     self.mjson = MJson()
     self.muser = MUser()
     if self.get_current_user():
         self.userinfo = self.muser.get_by_id(self.get_current_user())
     else:
         self.userinfo = None
开发者ID:ironhot,项目名称:maplet,代码行数:7,代码来源:geojson.py

示例5: AppIndexHandler

class AppIndexHandler(BaseHandler):
    def initialize(self):
        self.mpost = MPost()
        self.mcat = MCatalog()
        self.muser = MUser()
        if self.get_current_user():
            self.userinfo = self.muser.get_by_id(self.get_current_user())
        else:
            self.userinfo = None
        self.tmpl_sig = app_template_name

    def get(self, input=''):
        if input == '':
            self.index()
        else:
            self.render('html/404.html')

    def index(self):
        cstr = tools.get_uuid()
        self.set_cookie('user_pass', cstr)
        kwd = {
            'cookie_str': cstr
        }
        self.render('{0}/index/index.html'.format(self.tmpl_sig),
                    kwd=kwd,
                    userinfo=self.userinfo,
                    catalog_info=self.mcat.query_all(by_order=True)
                    )
开发者ID:shiweihappy,项目名称:maplet,代码行数:28,代码来源:index_app.py

示例6: initialize

 def initialize(self):
     self.mapplication = MApp()
     self.muser = MUser()
     if self.get_current_user():
         self.userinfo = self.muser.get_by_id(self.get_current_user())
     else:
         self.userinfo = None
开发者ID:ironhot,项目名称:maplet,代码行数:7,代码来源:overlay_handler.py

示例7: setUp

    def setUp(self):
        self.muser = MUser()

        payload1 = {
            'user_name': 'giser1',
            'user_pass': '1234567',
        }
        self.r1 = requests.post('http://127.0.0.1:8088/user/regist', payload1)
        payload1 = {
            'user_name': 'giser1',
            'user_pass': '1234567',
            'user_email': 'sadf',
        }
        self.r2 = requests.post('http://127.0.0.1:8088/user/regist', payload1)

        payload3 = {
            'user_name': 'giser1',
            'user_pass': '1234567',
            'user_email': '[email protected]',
        }
        self.r3 = requests.post('http://127.0.0.1:8088/user/regist', payload3)
        # 相同用户名注册
        self.r55 = requests.post('http://127.0.0.1:8088/user/regist', payload3)

        self.r4 = requests.post('http://127.0.0.1:8088/user/login', payload3)

        payload4 = {
            'user_name': 'giser1',
            'user_pass': '7654321',
        }
        self.r5 = requests.post('http://127.0.0.1:8088/user/login', payload4)
开发者ID:hitrustnet,项目名称:TorCMS,代码行数:31,代码来源:testUserFunc.py

示例8: IndexHandler

class IndexHandler(BaseHandler):
    def initialize(self):
        self.mpost = MPost()
        self.mcat = MCatalog()
        self.muser = MUser()
        self.mpage = MPage()
        self.mlink = MLink()
        if self.get_current_user():
            self.userinfo = self.muser.get_by_id(self.get_current_user())
        else:
            self.userinfo = None

    def get_current_user(self):
        return self.get_secure_cookie("user")

    def get(self, input=''):
        if input == '':
            self.index()
        else:
            self.render('html/404.html')

    def index(self):
        cstr = tools.get_uuid()
        self.set_cookie('user_pass', cstr)
        kwd = {
            'cookie_str': cstr
        }
        self.render('index/index.html',
                    userinfo=self.userinfo,
                    catalog_info=self.mcat.query_all(by_order=True),
                    link= self.mlink.query_all(),
                    unescape=tornado.escape.xhtml_unescape,
                    cfg = config.cfg,
                    kwd=kwd,)
开发者ID:vaveee,项目名称:TorCMS,代码行数:34,代码来源:index.py

示例9: PycateBaseHandler

class PycateBaseHandler(tornado.web.RequestHandler):
    def init_condition(self):
        self.muser = MUser()

        userid = self.get_secure_cookie('user')
        if userid is None:
            self.user_name = ''
        else:
            self.user_name = userid.decode('utf-8')




        self.city_name = 'changchun'


        self.minfo = MInfo(self.city_name)
        self.mcity = MCity()
        # self.muser_info = MUserInfo(self.user_name)

        if self.get_current_user():
            self.userinfo = self.muser.get_by_id(self.get_current_user())
        else:
            self.userinfo = None



    def get_current_user(self):
        return self.get_secure_cookie("user")
开发者ID:jiaxiaolei,项目名称:pycate,代码行数:29,代码来源:base_handler.py

示例10: IndexHandler

class IndexHandler(tornado.web.RequestHandler):
    def initialize(self):
        self.mpost = MPost()
        self.mcat = MCatalog()
        self.muser = MUser()
        if self.get_current_user():
            self.userinfo = self.muser.get_by_id(self.get_current_user())
        else:
            self.userinfo = None

    def get_current_user(self):
        return self.get_secure_cookie("user")

    def get(self, input=''):
        if input == '':
            self.index()
        else:
            self.render('html/404.html')

    def index(self):
        cstr = tools.get_uuid()
        self.set_cookie('user_pass', cstr)
        kwd = {
            'cookie_str': cstr
        }
        self.render('tplite/index/index.html',
                    kwd = kwd,
                    userinfo=self.userinfo,
                    catalog_info  = self.mcat.query_all( by_order=True)
                    )
开发者ID:Ryan007,项目名称:TorCMS,代码行数:30,代码来源:index.py

示例11: ReplyHandler

class ReplyHandler(BaseHandler):
    def initialize(self):
        self.init()
        self.muser = MUser()
        self.mreply = MReply()
        self.mreply2user = MReply2User()
        self.mpost2reply = MPost2Reply()

        if self.get_current_user():
            self.userinfo = self.muser.get_by_id(self.get_current_user())
        else:
            self.userinfo = None

    def get(self, url_str=''):
        url_arr = self.parse_url(url_str)

        if url_arr[0] == 'get':
            self.get_by_id(url_arr[1])

    def get_by_id(self, reply_id):
        reply = self.mreply.get_reply_by_uid(reply_id)
        self.render('{0}/reply/show_reply.html'.format(self.tmpl_name),
                    cnt=reply.cnt_html,
                    username=reply.user_name,
                    date=reply.date,
                    vote=reply.vote,
                    uid=reply.uid,
                    userinfo=self.userinfo,
                    unescape=tornado.escape.xhtml_unescape,
                    )
开发者ID:vaveee,项目名称:TorCMS,代码行数:30,代码来源:reply_handler.py

示例12: init

 def init(self):
     self.tmpl_name= config.torlite_template_name
     self.muser = MUser()
     if self.get_current_user():
         self.userinfo = self.muser.get_by_id(self.get_current_user())
     else:
         self.userinfo = None
开发者ID:hitrustnet,项目名称:TorCMS,代码行数:7,代码来源:base_handler.py

示例13: BaseHandler

class BaseHandler(tornado.web.RequestHandler, TemplateRendring):

    def init(self):
        self.tmpl_name= config.torlite_template_name
        self.muser = MUser()
        if self.get_current_user():
            self.userinfo = self.muser.get_by_id(self.get_current_user())
        else:
            self.userinfo = None

    def parse_url(self, url_str):
        url_str = url_str.strip()
        url_arr = [] if len(url_str) == 0 else url_str.split('/')
        return url_arr
    def get_current_user(self):
        return self.get_secure_cookie("user")

    def editable(self):
        # Deprecated.
        if self.get_current_user():
            return 1
        else:
            return 0

    def render_jinja2(self, template_name, **kwargs):
        kwargs.update({
            'settings': self.settings,
            'STATIC_URL': self.settings.get('static_url_prefix', '/static/'),
            'request': self.request,
            'current_user': self.current_user,
            'xsrf_token': self.xsrf_token,
            'xsrf_form_html': self.xsrf_form_html,
        })
        content = self.render_template(template_name, **kwargs)
        self.write(content)
开发者ID:hitrustnet,项目名称:TorCMS,代码行数:35,代码来源:base_handler.py

示例14: initialize

 def initialize(self):
     self.init()
     self.muser = MUser()
     self.mlink = MLink()
     if self.get_current_user():
         self.userinfo = self.muser.get_by_id(self.get_current_user())
     else:
         self.userinfo = None
开发者ID:nanpian,项目名称:TorCMS,代码行数:8,代码来源:link_handler.py

示例15: initialize

 def initialize(self):
     self.mequa = MApp()
     self.musage = MUsage()
     self.muser = MUser()
     if self.get_current_user():
         self.userinfo = self.muser.get_by_id(self.get_current_user())
     else:
         self.userinfo = None
开发者ID:ironhot,项目名称:maplet,代码行数:8,代码来源:list_handler.py


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