當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。