本文整理匯總了Python中twisted.conch.avatar.ConchUser.channelLookup['session']方法的典型用法代碼示例。如果您正苦於以下問題:Python ConchUser.channelLookup['session']方法的具體用法?Python ConchUser.channelLookup['session']怎麽用?Python ConchUser.channelLookup['session']使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類twisted.conch.avatar.ConchUser
的用法示例。
在下文中一共展示了ConchUser.channelLookup['session']方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: requestAvatar
# 需要導入模塊: from twisted.conch.avatar import ConchUser [as 別名]
# 或者: from twisted.conch.avatar.ConchUser import channelLookup['session'] [as 別名]
def requestAvatar(self, username, mind, *interfaces):
""""
The connection has already been authenticated at this point. Our job
is to return some objects representing the logged in user.
`username' is also known as the Avatar ID in `twisted.cred' terminology.
"""
try:
# treat username as an OTP and attempt
transport, protocol = self.tickets.pop(username)
# reset routing ticket since it is one-time only.
ticket = tickets.newTicket()
self.tickets[ticket] = (transport, protocol)
log.msg("Reset routing ticket from %s to %s" % (username, ticket,))
u = ConchUser()
# Add a custom field to indicate that this connection
# is going to be connected (routed) using this ticket.
u._connectTo = (transport, protocol)
u.factory = self.factory
u.options = self.factory.options
return IConchUser, u, lambda:None
except KeyError:
log.msg('Username %r not recognized as access ticket. Connecting to public AMP subsystem only!' % (username,))
# logged in user gets access to AMP subsystem only. No shells.
u = ConchUser()
u.factory = self.factory
u.options = self.factory.options
u.channelLookup['session'] = AMPSession
return IConchUser, u, lambda:None
示例2: requestAvatar
# 需要導入模塊: from twisted.conch.avatar import ConchUser [as 別名]
# 或者: from twisted.conch.avatar.ConchUser import channelLookup['session'] [as 別名]
def requestAvatar(self, avatarId, mind, *interfaces):
print "running requestAvatar"
if IConchUser in interfaces:
print "if statement"
user = ConchUser()
user.channelLookup['session'] = SimpleSession
return IConchUser, user, nothing
else:
raise NotImplementedError("No supported interfaces found.")
示例3: requestAvatar
# 需要導入模塊: from twisted.conch.avatar import ConchUser [as 別名]
# 或者: from twisted.conch.avatar.ConchUser import channelLookup['session'] [as 別名]
def requestAvatar(self, avatarId, mind, *interfaces):
user = ConchUser()
user.channelLookup['session'] = SimpleSession
return IConchUser, user, nothing