Added registry.split.

This commit is contained in:
Jeremy Fincher 2004-07-24 21:40:47 +00:00
parent 191fe6e96b
commit 3f08089a32
3 changed files with 8 additions and 4 deletions

View File

@ -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):

View File

@ -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)

View File

@ -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'