本文整理汇总了Python中mailpile.urlmap.UrlMap.ui_url方法的典型用法代码示例。如果您正苦于以下问题:Python UrlMap.ui_url方法的具体用法?Python UrlMap.ui_url怎么用?Python UrlMap.ui_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mailpile.urlmap.UrlMap
的用法示例。
在下文中一共展示了UrlMap.ui_url方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: as_dict
# 需要导入模块: from mailpile.urlmap import UrlMap [as 别名]
# 或者: from mailpile.urlmap.UrlMap import ui_url [as 别名]
def as_dict(self):
from mailpile.urlmap import UrlMap
um = UrlMap(self.session)
rv = {
"command": self.command_name,
"state": {
"command_url": um.ui_url(self.command_obj),
"context_url": um.context_url(self.command_obj),
"query_args": self.command_obj.state_as_query_args(),
"cache_id": self.command_obj.cache_id(),
"context": self.command_obj.context or "",
},
"status": self.status,
"message": self.message,
"result": self.result,
"event_id": self.command_obj.event.event_id,
"elapsed": "%.3f" % self.session.ui.time_elapsed,
}
csrf_token = self.session.ui.html_variables.get("csrf_token")
if csrf_token:
rv["state"]["csrf_token"] = csrf_token
if self.error_info:
rv["error"] = self.error_info
for ui_key in [k for k in self.command_obj.data.keys() if k.startswith("ui_")]:
rv[ui_key] = self.command_obj.data[ui_key][0]
ev = self.command_obj.event
if ev and ev.data.get("password_needed"):
rv["password_needed"] = ev.private_data["password_needed"]
return rv
示例2: as_dict
# 需要导入模块: from mailpile.urlmap import UrlMap [as 别名]
# 或者: from mailpile.urlmap.UrlMap import ui_url [as 别名]
def as_dict(self):
from mailpile.urlmap import UrlMap
um = UrlMap(self.session)
rv = {
'command': self.command_name,
'state': {
'command_url': um.ui_url(self.command_obj),
'context_url': um.context_url(self.command_obj),
'query_args': self.command_obj.state_as_query_args(),
'cache_id': self.command_obj.cache_id(),
'context': self.command_obj.context or ''
},
'status': self.status,
'message': self.message,
'result': self.result,
'event_id': self.command_obj.event.event_id,
'elapsed': '%.3f' % self.session.ui.time_elapsed,
}
csrf_token = self.session.ui.html_variables.get('csrf_token')
if csrf_token:
rv['state']['csrf_token'] = csrf_token
if self.error_info:
rv['error'] = self.error_info
for ui_key in [k for k in self.command_obj.data.keys()
if k.startswith('ui_')]:
rv[ui_key] = self.command_obj.data[ui_key][0]
ev = self.command_obj.event
if ev and ev.data.get('password_needed'):
rv['password_needed'] = ev.private_data['password_needed']
return rv
示例3: as_dict
# 需要导入模块: from mailpile.urlmap import UrlMap [as 别名]
# 或者: from mailpile.urlmap.UrlMap import ui_url [as 别名]
def as_dict(self):
from mailpile.urlmap import UrlMap
rv = {
"command": self.command_name,
"state": {
"command_url": UrlMap.ui_url(self.command_obj),
"context_url": UrlMap.context_url(self.command_obj),
"query_args": self.command_obj.state_as_query_args(),
},
"status": self.status,
"message": self.message,
"result": self.result,
"elapsed": "%.3f" % self.session.ui.time_elapsed,
}
if self.error_info:
rv["error"] = self.error_info
for ui_key in [k for k in self.kwargs.keys() if k.startswith("ui_")]:
rv[ui_key] = self.kwargs[ui_key]
return rv