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


Python util.ObjectDict类代码示例

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


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

示例1: get_current_user

 def get_current_user(self):
     session_opr = ObjectDict()
     session_opr.username = 'api'
     session_opr.ipaddr = self.request.remote_ip
     session_opr.opr_type = 0
     session_opr.login_time = utils.get_currtime()
     return session_opr
开发者ID:Kge38131,项目名称:ToughRADIUS,代码行数:7,代码来源:apibase.py

示例2: get_current_user

    def get_current_user(self):
        username = self.get_secure_cookie("portal_user")
        if not username: return None
        ipaddr = self.request.remote_ip

        rad_session_user = self.db.query(models.SlcRadOnline).filter_by(
            account_number = username,
            framed_ipaddr = ipaddr
        ).first()

        if not rad_session_user:
            return None

        print rad_session_user

        raduser = self.db.query(models.SlcRadAccount).filter_by(
            account_number = username
        ).first()


        print raduser

        user = ObjectDict()
        user.username = username
        user.ipaddr = rad_session_user.framed_ipaddr
        user.times = rad_session_user.billing_times
        user.balance = raduser.balance

        print repr(user)
        return user
开发者ID:Mark-Shine,项目名称:ToughRADIUS,代码行数:30,代码来源:base.py

示例3: set_session_user

 def set_session_user(self, username, ipaddr, login_time):
     session_user = ObjectDict()
     session_user.username = username
     session_user.ipaddr = ipaddr
     session_user.login_time = login_time
     self.session['session_user'] = session_user
     self.session.save()
开发者ID:lanyeit,项目名称:toughwlan,代码行数:7,代码来源:base.py

示例4: set_session_user

 def set_session_user(self, customer, ipaddr, login_time):
     session_user = ObjectDict()
     session_user.username = customer.customer_name
     session_user.cid = customer.customer_id
     session_user.ipaddr = ipaddr
     session_user.login_time = login_time
     self.session['session_user'] = session_user
     self.session.save()
开发者ID:leigf,项目名称:ToughRADIUS,代码行数:8,代码来源:base.py

示例5: test_object_dict

 def test_object_dict(self):
     od = ObjectDict()
     self.assertRaises(AttributeError, getattr, od, "something")
     od["foo"] = "bar"
     self.assertEqual(od['foo'], "bar")
     self.assertEqual(od.foo, "bar")
     od.rah = "meow"
     self.assertEqual(od['rah'], "meow")
开发者ID:VRGhost,项目名称:cyclone,代码行数:8,代码来源:test_utils.py

示例6: get_current_user

 def get_current_user(self):
     username = self.get_secure_cookie("portal_user")
     if not username: return None
     ipaddr = self.get_secure_cookie("portal_user_ip")
     user = ObjectDict()
     user.username = username
     user.ipaddr = ipaddr
     return user
开发者ID:simudream,项目名称:toughportal,代码行数:8,代码来源:base.py

示例7: set_session_user

 def set_session_user(self, username, ipaddr, opr_type, login_time):
     session_opr = ObjectDict()
     session_opr.username = username
     session_opr.ipaddr = ipaddr
     session_opr.opr_type = opr_type
     session_opr.login_time = login_time
     self.session['session_opr'] = session_opr
     self.session.save()
开发者ID:talkincode,项目名称:toughtester,代码行数:8,代码来源:base.py

示例8: get_current_user

    def get_current_user(self):
        return self.session.get("session_user")
        if not username: return None

        user = ObjectDict()
        user.username = username
        user.ipaddr = self.session.get("tr_login_ip")
        user.login_time = self.session.get("tr_login_time")
        return user
开发者ID:tsjly,项目名称:ToughRADIUS,代码行数:9,代码来源:base.py

示例9: get_current_user

    def get_current_user(self):
        username = self.get_secure_cookie("tra_user")
        if not username: return None
        ipaddr = self.get_secure_cookie("tra_login_ip")

        user = ObjectDict()
        user.username = username
        user.ipaddr = ipaddr
        user.opr_type = self.get_secure_cookie("tra_opr_type")
        user.login_time = self.get_secure_cookie("tra_login_time")
        return user
开发者ID:actcms,项目名称:toughwlan,代码行数:11,代码来源:base.py

示例10: get_current_user

    def get_current_user(self):
        username = self.get_secure_cookie("opr_name")
        if not username: return None
        ipaddr = self.get_secure_cookie("opr_login_ip")
        opr_type = int(self.get_secure_cookie("opr_type"))
        login_time = self.get_secure_cookie("opr_login_time")

        user = ObjectDict()
        user.username = username
        user.ipaddr = ipaddr
        user.opr_type = opr_type
        user.login_time = login_time
        return user
开发者ID:lxyjyy,项目名称:ToughNMS,代码行数:13,代码来源:base.py

示例11: get_wlannotify

 def get_wlannotify():
     articles =[]
     article1=ObjectDict()
     article1.title=u"无线上网"
     article1.description=u"当您已经连接Wi-Fi信号时,点击即可免费联入网络。"
     article1.url = "%s/mplogin?mp_openid=%s&product_id=%s&node_id=%s" % (
         config.get('mps','server_base'),
         msg.fromuser,
         config.get('mps','wlan_product_id'),
         config.get('mps','wlan_node_id')
     )
     article1.picurl = '%s/static/img/wlan.jpg' % config.get('mps','server_base')
     articles.append(article1)
     return articles
开发者ID:Mark-Shine,项目名称:ToughRADIUS,代码行数:14,代码来源:subscribe.py

示例12: respond

def respond(data, msg=None,db=None,config=None,mpsapi=None,**kwargs):
    products = db.query(models.SlcRadProduct).filter(
        models.SlcRadProduct.mps_flag == 1,
        models.SlcRadProduct.product_status == 0
    ).limit(7)

    articles =[]
    for item in products:
        article=ObjectDict()
        article.title= item.product_name
        article.description = ''
        article.url = "%s/order?openid=%s&product_id=%s" % (
            config.get('mps','server_base'),
            msg.fromuser,
            item.id
        )
        article.picurl = '%s/static/img/mps/order_online.jpg' % config.get('mps','server_base')
        articles.append(article)
    return articles
开发者ID:Mark-Shine,项目名称:ToughRADIUS,代码行数:19,代码来源:product_order.py

示例13: respond

def respond(data, msg=None,db=None,config=None,mpsapi=None,**kwargs):
    member = db.query(models.SlcMember).filter(
        models.SlcMember.weixin_id==msg.fromuser).first()

    if not member:
        return u"您当前还未绑定账号"


    articles =[]
    article=ObjectDict()
    article.title= u"我的工单"
    article.description = ''
    article.url = "%s/issues?openid=%s&member_id=%s" % (
        config.get('mps','server_base'),
        msg.fromuser,
        member.member_id
    )
    article.picurl = '%s/static/img/mps/issues_query.jpg' % config.get('mps','server_base')
    articles.append(article)
    return articles
开发者ID:Mark-Shine,项目名称:ToughRADIUS,代码行数:20,代码来源:issues_query.py

示例14: set_session_user

 def set_session_user(self, username, ipaddr, opr_type, login_time):
     session_opr = ObjectDict()
     session_opr.username = username
     session_opr.ipaddr = ipaddr
     session_opr.opr_type = opr_type
     session_opr.login_time = login_time
     session_opr.resources = [r.rule_path for r in self.db.query(models.TrOperatorRule).filter_by(operator_name=username)]
     self.session['session_opr'] = session_opr
     self.session.save()
开发者ID:Smallthing,项目名称:ToughRADIUS,代码行数:9,代码来源:base.py

示例15: fetch_docs

    def fetch_docs(self, query, categories=()):
        page = self.get_arg('page', self.page)
        try:
            self.page = int(page)
        except ValueError:
            self.page = 1

        offset = self.limit * (self.page - 1)
        try:
            data = yield self.client.search(query, categories,
                                            offset=offset, limit=self.limit)
        except Exception as e:
            self.logerr('error while retrieveing results for {!r}'.format(query))
            self.render_error()
            defer.returnValue(None)

        if 'error' in data:
            self.logerr('error from search search: {!r}'.format(data))
            self.render_error()
            defer.returnValue(None)

        results = []
        for ret in data['docs']:
            info = self.corpus_db.get(ret['id'])
            if not info:
                self.log('document key without record {!r}'.format(ret))
                continue
            if any(f not in info for f in ('headline', 'body', 'url')):
                self.log("Document with missing fields: {!r}".format(info))
                break
            doc = ObjectDict((k,v) for (k,v) in ret.items()
                             if not k.startswith('_'))
            doc.update(info)
            results.append(doc)

        defer.returnValue((data['total'], results))
开发者ID:rolando-archive,项目名称:yatiri,代码行数:36,代码来源:web.py


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