Here are the examples of the python api twisted.words.ewords.NoSuchGroup taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
8 Examples
3
Example 1
Project: SubliminalCollaborator Source File: service.py
def _getTopic(self, channel):
#<< TOPIC #python
#>> :benford.openprojects.net 332 glyph #python :<churchr> I really did. I sprained all my toes.
#>> :benford.openprojects.net 333 glyph #python itamar|nyc 994713482
def ebGroup(err):
err.trap(ewords.NoSuchGroup)
self.sendMessage(
irc.ERR_NOSUCHCHANNEL, '=', channel,
":That channel doesn't exist.")
self.realm.lookupGroup(channel).addCallbacks(self._sendTopic, ebGroup)
3
Example 2
def lookupGroup(self, name):
assert isinstance(name, unicode)
name = name.lower()
try:
group = self.groups[name]
except KeyError:
return defer.fail(failure.Failure(ewords.NoSuchGroup(name)))
else:
return defer.succeed(group)
3
Example 3
Project: SubliminalCollaborator Source File: test_service.py
def testGroupRetrieval(self):
realm = service.InMemoryWordsRealm("realmname")
d = wFD(realm.createGroup(u"testgroup"))
yield d
group = d.getResult()
d = wFD(realm.getGroup(u"testgroup"))
yield d
retrieved = d.getResult()
self.assertIdentical(group, retrieved)
d = wFD(realm.getGroup(u"nosuchgroup"))
yield d
self.assertRaises(ewords.NoSuchGroup, d.getResult)
0
Example 4
Project: SubliminalCollaborator Source File: service.py
def irc_MODE(self, prefix, params):
"""User mode message
Parameters: <nickname>
*( ( "+" / "-" ) *( "i" / "w" / "o" / "O" / "r" ) )
"""
try:
channelOrUser = params[0].decode(self.encoding)
except UnicodeDecodeError:
self.sendMessage(
irc.ERR_NOSUCHNICK, params[0],
":No such nickname (could not decode your unicode!)")
return
if channelOrUser.startswith('#'):
def ebGroup(err):
err.trap(ewords.NoSuchGroup)
self.sendMessage(
irc.ERR_NOSUCHCHANNEL, params[0],
":That channel doesn't exist.")
d = self.realm.lookupGroup(channelOrUser[1:])
d.addCallbacks(
self._channelMode,
ebGroup,
callbackArgs=tuple(params[1:]))
else:
def ebUser(err):
self.sendMessage(
irc.ERR_NOSUCHNICK,
":No such nickname.")
d = self.realm.lookupUser(channelOrUser)
d.addCallbacks(
self._userMode,
ebUser,
callbackArgs=tuple(params[1:]))
0
Example 5
Project: SubliminalCollaborator Source File: service.py
def irc_PART(self, prefix, params):
"""Part message
Parameters: <channel> *( "," <channel> ) [ <Part Message> ]
"""
try:
groupName = params[0].decode(self.encoding)
except UnicodeDecodeError:
self.sendMessage(
irc.ERR_NOTONCHANNEL, params[0],
":Could not decode your unicode!")
return
if groupName.startswith('#'):
groupName = groupName[1:]
if len(params) > 1:
reason = params[1].decode('utf-8')
else:
reason = None
def cbGroup(group):
def cbLeave(result):
self.userLeft(group, self, reason)
return self.avatar.leave(group, reason).addCallback(cbLeave)
def ebGroup(err):
err.trap(ewords.NoSuchGroup)
self.sendMessage(
irc.ERR_NOTONCHANNEL,
'#' + groupName,
":" + err.getErrorMessage())
self.realm.lookupGroup(groupName).addCallbacks(cbGroup, ebGroup)
0
Example 6
Project: SubliminalCollaborator Source File: service.py
def irc_NAMES(self, prefix, params):
"""Names message
Parameters: [ <channel> *( "," <channel> ) [ <target> ] ]
"""
#<< NAMES #python
#>> :benford.openprojects.net 353 glyph = #python :Orban ... @glyph ... Zymurgy skreech
#>> :benford.openprojects.net 366 glyph #python :End of /NAMES list.
try:
channel = params[-1].decode(self.encoding)
except UnicodeDecodeError:
self.sendMessage(
irc.ERR_NOSUCHCHANNEL, params[-1],
":No such channel (could not decode your unicode!)")
return
if channel.startswith('#'):
channel = channel[1:]
def cbGroup(group):
self.names(
self.name,
'#' + group.name,
[user.name for user in group.iterusers()])
def ebGroup(err):
err.trap(ewords.NoSuchGroup)
# No group? Fine, no names!
self.names(
self.name,
'#' + channel,
[])
self.realm.lookupGroup(channel).addCallbacks(cbGroup, ebGroup)
0
Example 7
def _setTopic(self, channel, topic):
#<< TOPIC #divunal :foo
#>> :[email protected] TOPIC #divunal :foo
def cbGroup(group):
newMeta = group.meta.copy()
newMeta['topic'] = topic
newMeta['topic_author'] = self.name
newMeta['topic_date'] = int(time())
def ebSet(err):
self.sendMessage(
irc.ERR_CHANOPRIVSNEEDED,
"#" + group.name,
":You need to be a channel operator to do that.")
return group.setMetadata(newMeta).addErrback(ebSet)
def ebGroup(err):
err.trap(ewords.NoSuchGroup)
self.sendMessage(
irc.ERR_NOSUCHCHANNEL, '=', channel,
":That channel doesn't exist.")
self.realm.lookupGroup(channel).addCallbacks(cbGroup, ebGroup)
0
Example 8
Project: SubliminalCollaborator Source File: service.py
def irc_WHO(self, prefix, params):
"""Who query
Parameters: [ <mask> [ "o" ] ]
"""
#<< who #python
#>> :x.opn 352 glyph #python aquarius pc-62-31-193-114-du.blueyonder.co.uk y.opn Aquarius H :3 Aquarius
# ...
#>> :x.opn 352 glyph #python foobar europa.tranquility.net z.opn skreech H :0 skreech
#>> :x.opn 315 glyph #python :End of /WHO list.
### also
#<< who glyph
#>> :x.opn 352 glyph #python glyph adsl-64-123-27-108.dsl.austtx.swbell.net x.opn glyph H :0 glyph
#>> :x.opn 315 glyph glyph :End of /WHO list.
if not params:
self.sendMessage(irc.RPL_ENDOFWHO, ":/WHO not supported.")
return
try:
channelOrUser = params[0].decode(self.encoding)
except UnicodeDecodeError:
self.sendMessage(
irc.RPL_ENDOFWHO, params[0],
":End of /WHO list (could not decode your unicode!)")
return
if channelOrUser.startswith('#'):
def ebGroup(err):
err.trap(ewords.NoSuchGroup)
self.sendMessage(
irc.RPL_ENDOFWHO, channelOrUser,
":End of /WHO list.")
d = self.realm.lookupGroup(channelOrUser[1:])
d.addCallbacks(self._channelWho, ebGroup)
else:
def ebUser(err):
err.trap(ewords.NoSuchUser)
self.sendMessage(
irc.RPL_ENDOFWHO, channelOrUser,
":End of /WHO list.")
d = self.realm.lookupUser(channelOrUser)
d.addCallbacks(self._userWho, ebUser)