No longer pass *args and **kwargs to controller methods (they weren't

being passed anything anyhow).
This commit is contained in:
BJ Dierkes 2010-07-02 18:59:44 -05:00
parent d2c3907488
commit a4568f27cf
7 changed files with 27 additions and 9 deletions

View File

@ -5,7 +5,9 @@
- Added a fix for logging. Previously, an application using a shared
plugin (such as from Rosendale) would be unable to log because there
were no handlers setup for the providers module name space.
- No longer pass *args and **kwargs to controller methods (they weren't
being passed anything anyhow).
0.8.6 - Jun 11, 2010
-----------------------------------------------------------------------------

View File

@ -1,6 +1,7 @@
The MIT License:
Copyright (c) 2009 BJ Dierkes
Copyright (c) 2009-2010 BJ Dierkes
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -38,7 +38,8 @@ def run_command(cmd_name=None):
raise CementArgumentError, \
"'%s' is a namespace*, not a command. See '%s --help' instead." % \
(namespace, namespace)
# Parse cli options and arguments
(cli_opts, cli_args) = parse_options(namespace=namespace)
@ -65,6 +66,7 @@ def run_command(cmd_name=None):
log.debug("executing command '%s'" % actual_cmd)
run_controller_command(cmd['controller_namespace'], cmd['func'],
cli_opts=cli_opts, cli_args=cli_args)
else:
raise CementArgumentError, "Unknown command '%s', see --help?" % actual_cmd

View File

@ -59,7 +59,8 @@ def run_controller_command(namespace, func, *args, **kw):
set_config_opts_per_cli_opts(nam, cli_opts)
controller = namespaces[namespace].controller(cli_opts, cli_args)
func = getattr(controller, func)(*args, **kw)
#func = getattr(controller, func)(*args, **kw)
func = getattr(controller, func)()
class expose(object):

View File

@ -16,9 +16,12 @@ def setup_logging_for_plugin_provider(provider):
"""
config = namespaces['root'].config
provider_log = logging.getLogger(provider)
for handler in logging.getLogger(config['app_module']).handlers:
cement_log = logging.getLogger('cement')
for handler in logging.getLogger('cement').handlers:
provider_log.addHandler(handler)
provider_log.level = cement_log.level
def setup_logging(clear_loggers=True, level=None, to_console=True):
"""
Primary Cement method to setup logging.

View File

@ -109,7 +109,16 @@ def parse_options(namespace='root', ignore_conflicts=False):
if line != ' ':
nam_txt += "%s\n" % line
namespaces[namespace].options.usage = """ %s [COMMAND] --(OPTIONS)
if nam_txt == "":
namespaces[namespace].options.usage = """ %s [COMMAND] --(OPTIONS)
Commands:
%s
Help? try '[COMMAND]-help' OR '[NAMESPACE] --help'""" % \
(script, cmd_txt)
else:
namespaces[namespace].options.usage = """ %s [COMMAND] --(OPTIONS)
Commands:
%s

View File

@ -64,6 +64,7 @@ def get_enabled_plugins():
setup_logging_for_plugin_provider(provider)
plugin = "%s.plugin.%s" % (provider, sect)
enabled_plugins.append(plugin)
return enabled_plugins
def load_plugin(plugin):
@ -101,8 +102,7 @@ def load_plugin(plugin):
getattr(plugin_module, plugin)
if namespaces.has_key(plugin):
loaded = True
log.debug("loaded '%s' plugin from %s.plugin.%s" % \
(plugin, provider, plugin))
log.debug("loaded '%s' plugin" % plugin)
except AttributeError, e:
log.debug('AttributeError => %s' % e)