[#5980] Added / fixed support for bool and int ConfigOptions

Signed-off-by: Cory Johns <johnsca@geek.net>
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index d691bf2..9965aa2 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -5,6 +5,7 @@
 from tg import expose, redirect, flash
 from tg.decorators import without_trailing_slash
 from pylons import request, app_globals as g, tmpl_context as c
+from paste.deploy.converters import asbool
 from bson import ObjectId
 
 from ming.orm import session, state
@@ -21,9 +22,9 @@
 
 class ConfigOption(object):
 
-    def __init__(self, name, ming_type, default):
-        self.name, self.ming_type, self._default = (
-            name, ming_type, default)
+    def __init__(self, name, ming_type, default, label=None):
+        self.name, self.ming_type, self._default, self.label = (
+            name, ming_type, default, label or name)
 
     @property
     def default(self):
@@ -383,8 +384,15 @@
                     redirect('.')
                 c.project.uninstall_app(self.app.config.options.mount_point)
                 redirect('..')
-            for k,v in kw.iteritems():
-                self.app.config.options[k] = v
+            for opt in self.app.config_options:
+                if opt in Application.config_options:
+                    continue  # skip base options (mount_point, mount_label, ordinal)
+                val = kw.get(opt.name, '')
+                if opt.ming_type == bool:
+                    val = asbool(val or False)
+                elif opt.ming_type == int:
+                    val = asint(val or 0)
+                self.app.config.options[opt.name] = val
             if is_admin:
                 # possibly moving admin mount point
                 redirect('/'
diff --git a/Allura/allura/templates/app_admin_options.html b/Allura/allura/templates/app_admin_options.html
index 53e10ba..67b954a 100644
--- a/Allura/allura/templates/app_admin_options.html
+++ b/Allura/allura/templates/app_admin_options.html
@@ -1,13 +1,17 @@
 <!DOCTYPE html>
 <form method="post" action="{{c.project.url()}}admin/{{app.config.options.mount_point}}/configure">
   {% for o in app.config_options if o.name not in ['mount_point', 'mount_label', 'ordinal'] %}
-    <label for="{{o.name}}" class="grid-4">{{o.name}}</label>
+    <label for="{{o.name}}" class="grid-4">{{o.label}}</label>
     <div class="grid-9">
       {% if not allow_config %}
            {{app.config.options.get(o.name, o.default)}}
       {% else%}
-        <input id="{{o.name}}" name="{{o.name}}" value="{{app.config.options.get(o.name, o.default)}}">
-      {% endif %}  
+        {% if o.ming_type.__name__ == 'bool' %}
+            <input id="{{o.name}}" name="{{o.name}}" type="checkbox"{{ ' checked="checked"' if app.config.options.get(o.name, o.default)}}>
+        {% else %}
+            <input id="{{o.name}}" name="{{o.name}}" value="{{app.config.options.get(o.name, o.default)}}">
+        {% endif %}
+      {% endif %}
     </div>
   {% else %}
     <p>No options to administer for {{app.config.options.mount_point}}.</p>