本文整理匯總了Python中gluon.restricted.TicketStorage.load方法的典型用法代碼示例。如果您正苦於以下問題:Python TicketStorage.load方法的具體用法?Python TicketStorage.load怎麽用?Python TicketStorage.load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gluon.restricted.TicketStorage
的用法示例。
在下文中一共展示了TicketStorage.load方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: log_ticket
# 需要導入模塊: from gluon.restricted import TicketStorage [as 別名]
# 或者: from gluon.restricted.TicketStorage import load [as 別名]
def log_ticket(ticket, logger=LOG):
"""Log a ticket."""
if not ticket:
return
# Ticket may have have the app prepended, for example:
# zcomx/108.162.141.78.2016-06-20.14-36-01.3ac605e2-5ff9-47f1-872f-ab291cdb
if '/' in ticket:
parts = ticket.split(os.sep)
ticket_id = parts[-1]
else:
ticket_id = ticket
if not ticket_id:
return
request = current.request
ticket_storage = TicketStorage()
app = None # 'app' is an errors sub directory, not used
contents = ticket_storage.load(request, app, ticket_id)
traceback = contents.get('traceback')
if not traceback:
return
for line in traceback.split("\n"):
logger.error(line)