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