mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Added registry.split.
This commit is contained in:
parent
191fe6e96b
commit
3f08089a32
@ -56,7 +56,7 @@ class InvalidRegistryName(callbacks.Error):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def getWrapper(name):
|
def getWrapper(name):
|
||||||
parts = name.split('.')
|
parts = registry.split(name)
|
||||||
if not parts or parts[0] not in ('supybot', 'users'):
|
if not parts or parts[0] not in ('supybot', 'users'):
|
||||||
raise InvalidRegistryName, name
|
raise InvalidRegistryName, name
|
||||||
group = getattr(conf, parts.pop(0))
|
group = getattr(conf, parts.pop(0))
|
||||||
@ -69,7 +69,7 @@ def getWrapper(name):
|
|||||||
|
|
||||||
def getCapability(name):
|
def getCapability(name):
|
||||||
capability = 'owner' # Default to requiring the owner capability.
|
capability = 'owner' # Default to requiring the owner capability.
|
||||||
parts = name.split('.')
|
parts = registry.split(name)
|
||||||
while parts:
|
while parts:
|
||||||
part = parts.pop()
|
part = parts.pop()
|
||||||
if ircutils.isChannel(part):
|
if ircutils.isChannel(part):
|
||||||
|
@ -190,7 +190,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
for (name, s) in registry._cache.iteritems():
|
for (name, s) in registry._cache.iteritems():
|
||||||
if name.startswith('supybot.plugins'):
|
if name.startswith('supybot.plugins'):
|
||||||
try:
|
try:
|
||||||
(_, _, name) = name.split('.')
|
(_, _, name) = registry.split(name)
|
||||||
except ValueError: # unpack list of wrong size.
|
except ValueError: # unpack list of wrong size.
|
||||||
continue
|
continue
|
||||||
if name == name.lower(): # This can't be right.
|
if name == name.lower(): # This can't be right.
|
||||||
@ -198,7 +198,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
conf.registerPlugin(name)
|
conf.registerPlugin(name)
|
||||||
if name.startswith('supybot.commands.defaultPlugins'):
|
if name.startswith('supybot.commands.defaultPlugins'):
|
||||||
try:
|
try:
|
||||||
(_, _, _, name) = name.split('.')
|
(_, _, _, name) = registry.split(name)
|
||||||
except ValueError: # unpack list of wrong size.
|
except ValueError: # unpack list of wrong size.
|
||||||
continue
|
continue
|
||||||
registerDefaultPlugin(name, s)
|
registerDefaultPlugin(name, s)
|
||||||
|
@ -109,6 +109,10 @@ def close(registry, filename, annotated=True, helpOnceOnly=False):
|
|||||||
def isValidRegistryName(name):
|
def isValidRegistryName(name):
|
||||||
return '.' not in name and ':' not in name and len(name.split()) == 1
|
return '.' not in name and ':' not in name and len(name.split()) == 1
|
||||||
|
|
||||||
|
def split(name):
|
||||||
|
# XXX: This should eventually handle escapes.
|
||||||
|
return name.split('.')
|
||||||
|
|
||||||
class Group(object):
|
class Group(object):
|
||||||
def __init__(self, supplyDefault=False):
|
def __init__(self, supplyDefault=False):
|
||||||
self.name = 'unset'
|
self.name = 'unset'
|
||||||
|
Loading…
Reference in New Issue
Block a user