本文整理汇总了Python中cyclone.util.ObjectDict.title方法的典型用法代码示例。如果您正苦于以下问题:Python ObjectDict.title方法的具体用法?Python ObjectDict.title怎么用?Python ObjectDict.title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cyclone.util.ObjectDict
的用法示例。
在下文中一共展示了ObjectDict.title方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_wlannotify
# 需要导入模块: from cyclone.util import ObjectDict [as 别名]
# 或者: from cyclone.util.ObjectDict import title [as 别名]
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
示例2: parse_msg
# 需要导入模块: from cyclone.util import ObjectDict [as 别名]
# 或者: from cyclone.util.ObjectDict import title [as 别名]
def parse_msg(xml):
if not xml:
return None
parser = ElementTree.fromstring(xml)
msg_id = parse_node(parser, 'MsgId', get_uuid())
msg_type = parse_node(parser, 'MsgType')
touser = parse_node(parser, 'ToUserName')
fromuser = parse_node(parser, 'FromUserName')
create_at = int(parse_node(parser, 'CreateTime', 0))
msg = ObjectDict(
mid=msg_id,
type=msg_type,
touser=touser,
fromuser=fromuser,
time=create_at
)
if msg_type == MSG_TYPE_TEXT:
msg.content = parse_node(parser, 'Content')
elif msg_type == MSG_TYPE_LOCATION:
msg.location_x = parse_node(parser, 'Location_X')
msg.location_y = parse_node(parser, 'Location_Y')
msg.scale = int(parse_node(parser, 'Scale'))
msg.label = parse_node(parser, 'Label')
elif msg_type == MSG_TYPE_IMAGE:
msg.picurl = parse_node(parser, 'PicUrl')
elif msg_type == MSG_TYPE_VOICE:
msg.media_id = parse_node(parser, 'MediaId')
msg.format = parse_node(parser, 'Format')
elif msg_type == MSG_TYPE_VIDEO:
msg.media_id = parse_node(parser, 'MediaId')
msg.thumb = parse_node(parser, 'ThumbMediaId')
elif msg_type == MSG_TYPE_LINK:
msg.title = parse_node(parser, 'Title')
msg.description = decode(parser.find('Description').text)
msg.url = parse_node(parser, 'Url')
elif msg_type == MSG_TYPE_EVENT:
msg.event = parse_node(parser, 'Event')
msg.event_key = parse_node(parser, 'EventKey')
msg.ticket = parse_node(parser, 'Ticket')
if msg.event == u'LOCATION':
msg.latitude = parse_node(parser, 'Latitude')
msg.longitude = parse_node(parser, 'Longitude')
msg.precision = parse_node(parser, 'Precision')
return msg
示例3: respond
# 需要导入模块: from cyclone.util import ObjectDict [as 别名]
# 或者: from cyclone.util.ObjectDict import title [as 别名]
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
示例4: respond
# 需要导入模块: from cyclone.util import ObjectDict [as 别名]
# 或者: from cyclone.util.ObjectDict import title [as 别名]
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