[asterisk-scf-commits] asterisk-scf/integration/configurator.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Sun Mar 20 09:06:55 CDT 2011
branch "master" has been updated
via 99764b169d9f01c407605797b7e1903a5007699c (commit)
from a9710935203651fdbe13bd2bd147bdc3c5df3a4f (commit)
Summary of changes:
Configurator.py | 33 +++++++++++++++++++++++++--------
1 files changed, 25 insertions(+), 8 deletions(-)
- Log -----------------------------------------------------------------
commit 99764b169d9f01c407605797b7e1903a5007699c
Author: Joshua Colp <jcolp at digium.com>
Date: Sun Mar 20 11:08:47 2011 -0300
Incorporate even more code review feedback.
diff --git a/Configurator.py b/Configurator.py
index 84a45a4..4c3d2fc 100755
--- a/Configurator.py
+++ b/Configurator.py
@@ -1,5 +1,21 @@
#!/usr/bin/env python
+#
+# Asterisk SCF -- An open-source communications framework.
+#
+# Copyright (C) 2010, Digium, Inc.
+#
+# See http://www.asterisk.org for more information about
+# the Asterisk SCF project. Please do not directly contact
+# any of the maintainers of this project for assistance;
+# the project provides a web site, mailing lists and IRC
+# channels for your use.
+#
+# This program is free software, distributed under the terms of
+# the GNU General Public License Version 2. See the LICENSE.txt file
+# at the top of the source tree.
+#
+
# Asterisk SCF Configurator Module
import ConfigParser, os, Ice, getopt, sys
@@ -45,18 +61,19 @@ class OptionMapper():
def map(self, option, object, item, item_name, method, default = None):
setattr(object, item, default)
- self.options[option] = [ object, item, item_name, method, default ]
+ self.options[option] = { 'object': object, 'item': item, 'item_name': item_name, 'method': method, 'default': default }
def execute(self, group, section, option):
"""Map options to configuration items based on options set"""
try:
- object = self.options[option][0]
+ object = self.options[option]['object']
except:
return
- item = self.options[option][1]
- item_name = self.options[option][2]
- method = self.options[option][3]
- default = self.options[option][4]
+
+ item = self.options[option]['item']
+ item_name = self.options[option]['item_name']
+ method = self.options[option]['method']
+ default = self.options[option]['default']
try:
setattr(object, item, method(section, option))
@@ -77,8 +94,8 @@ class OptionMapper():
def finish(self, group):
"""Finish mapping options by finding ones that should have a value but do not"""
for option in self.options:
- item = self.options[option][1]
- default = self.options[option][4]
+ item = self.options[option]['item']
+ default = self.options[option]['default']
if default == None:
if item == None:
print "Option '" + option + "' requires a value to be set and no default value exists."
-----------------------------------------------------------------------
--
asterisk-scf/integration/configurator.git
More information about the asterisk-scf-commits
mailing list