From 327fa92d3a054529d0392ee1e2a4fa57838cc7fa Mon Sep 17 00:00:00 2001 From: BJ Dierkes Date: Fri, 7 May 2010 16:04:02 -0500 Subject: [PATCH] Resolve GH#27 Remove unused app_basepath from config templates --- ChangeLog | 6 ++++-- .../templates/cementapp/+package+/core/config.py_tmpl | 1 - examples/helloworld/helloworld/bootstrap/example.py | 8 +++++++- examples/helloworld/helloworld/controllers/example.py | 4 ++++ examples/helloworld/helloworld/core/config.py | 1 - examples/helloworld/setup.py | 3 +++ tests/core/configuration_tests.py | 1 - 7 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 75aa8629..8caceeb1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,8 +9,10 @@ a command in the 'mynam' namespace, mynam.config['myoption'] is set as well as any other namespace that has that config key. + log.warn on OptionConflictError - - + - Don't render genshi output if --quiet is passed + - Resolve GH#6 Make plugin templates pass full version, required_cement_api, + etc when registering their namespace + 0.8 - Mar 24, 2010 ----------------------------------------------------------------------------- diff --git a/cement/paste/templates/cementapp/+package+/core/config.py_tmpl b/cement/paste/templates/cementapp/+package+/core/config.py_tmpl index 10e9d1af..dda26e40 100644 --- a/cement/paste/templates/cementapp/+package+/core/config.py_tmpl +++ b/cement/paste/templates/cementapp/+package+/core/config.py_tmpl @@ -20,7 +20,6 @@ dcf['config_source'] = ['defaults'] dcf['app_name'] = '{{package}}' # name for cli like /etc/ dcf['app_egg_name'] = '{{package}}' # name from setup.py dcf['app_module'] = '{{package}}' # name of the library dir -dcf['app_basepath'] = os.path.dirname(__file__) dcf['enabled_plugins'] = [] # no default plugins, add via the config file dcf['debug'] = False diff --git a/examples/helloworld/helloworld/bootstrap/example.py b/examples/helloworld/helloworld/bootstrap/example.py index 4199637f..eb2697c0 100644 --- a/examples/helloworld/helloworld/bootstrap/example.py +++ b/examples/helloworld/helloworld/bootstrap/example.py @@ -5,7 +5,13 @@ from cement.core.namespace import CementNamespace, register_namespace define_hook('my_example_hook') # Setup the 'example' namespace object -example = CementNamespace('example', controller='ExampleController') +example = CementNamespace( + label='example', + controller='ExampleController', + description='Example Plugin for helloworld', + version='0.1', + required_cement_api='0.7-0.8:20100210' + ) # Example namespace default configurations, overwritten by the [example] # section of the applications config file(s). Once registered, this dict is diff --git a/examples/helloworld/helloworld/controllers/example.py b/examples/helloworld/helloworld/controllers/example.py index e5ad2e82..21a5bf81 100644 --- a/examples/helloworld/helloworld/controllers/example.py +++ b/examples/helloworld/helloworld/controllers/example.py @@ -16,6 +16,10 @@ from helloworld.model.example import ExampleModel log = get_logger(__name__) class ExampleController(CementController): + @expose() + def test(self, *args, **kw): + config = get_config() + @expose(namespace='example') # no template def ex1(self, *args, **kw): """ diff --git a/examples/helloworld/helloworld/core/config.py b/examples/helloworld/helloworld/core/config.py index 1fc964f0..5254d9ee 100644 --- a/examples/helloworld/helloworld/core/config.py +++ b/examples/helloworld/helloworld/core/config.py @@ -20,7 +20,6 @@ dcf['config_source'] = ['defaults'] dcf['app_name'] = 'helloworld' # name for cli like /etc/ dcf['app_egg_name'] = 'helloworld' # name from setup.py dcf['app_module'] = 'helloworld' # name of the library dir -dcf['app_basepath'] = os.path.dirname(__file__) dcf['enabled_plugins'] = [] # no default plugins, add via the config file dcf['debug'] = False diff --git a/examples/helloworld/setup.py b/examples/helloworld/setup.py index 7d5e9109..5de044de 100644 --- a/examples/helloworld/setup.py +++ b/examples/helloworld/setup.py @@ -1,6 +1,9 @@ from setuptools import setup, find_packages import sys, os +# Note to distro packagers: This application requires Cement API +# version 0.7-0.8:20100210 + setup(name='helloworld', version='0.1', description='', diff --git a/tests/core/configuration_tests.py b/tests/core/configuration_tests.py index dbffce0c..af89682f 100644 --- a/tests/core/configuration_tests.py +++ b/tests/core/configuration_tests.py @@ -40,7 +40,6 @@ def test_validate_config(): dcf['app_name'] = 'helloworld' # name for cli like /etc/ dcf['app_egg_name'] = 'helloworld' # name from setup.py dcf['app_module'] = 'helloworld' # name of the library dir - dcf['app_basepath'] = os.path.dirname(__file__) dcf['enabled_plugins'] = [] # no default plugins, add via the config file dcf['debug'] = False