# along with this program. If not, see <http://www.gnu.org/licenses/>.
import cherrypy
+import logging
from ipsilon.util.page import Page
from ipsilon.util.page import admin_protect
from ipsilon.util.endpoint import allow_iframe
aname = '%s_%s' % (name, a)
if aname in kwargs:
value.append(a)
- elif type(option) is pconfig.ComplexList:
- value = get_complex_list_value(name,
+ elif isinstance(option, pconfig.MappingList):
+ value = get_mapping_list_value(name,
option.get_value(),
**kwargs)
if value is None:
continue
- elif type(option) is pconfig.MappingList:
- value = get_mapping_list_value(name,
+ elif isinstance(option, pconfig.ComplexList):
+ value = get_complex_list_value(name,
option.get_value(),
**kwargs)
if value is None:
if value != option.get_value():
cherrypy.log.error("Storing [%s]: %s = %s" %
- (self._po.name, name, value))
+ (self._po.name, name, value),
+ severity=logging.DEBUG)
option.set_value(value)
new_db_values[name] = option.export_value()
self.order = None
parent.add_subtree(name, self)
+ if self._site[facility] is None:
+ return
+
for plugin in self._site[facility].available:
- cherrypy.log.error('Admin info plugin: %s' % plugin)
+ cherrypy.log.error('Admin info plugin: %s' % plugin,
+ severity=logging.DEBUG)
obj = self._site[facility].available[plugin]
page = AdminPluginConfig(obj, self._site, self)
if hasattr(obj, 'admin'):
targs['order_name'] = '%s_order_form' % self.name
targs['order_action'] = self.order.url
- # pylint: disable=star-args
return self._template(self.template, **targs)
def root(self, *args, **kwargs):
except AdminError, e:
return self.root_with_msg(str(e), ADMIN_STATUS_WARN)
if not obj.is_enabled:
- obj.enable()
+ try:
+ obj.enable()
+ except Exception as e: # pylint: disable=broad-except
+ return self.root_with_msg(str(e), ADMIN_STATUS_WARN)
obj.save_enabled_state()
msg = "Plugin %s enabled" % obj.name
return self.root_with_msg(msg, ADMIN_STATUS_OK,
except AdminError, e:
return self.root_with_msg(str(e), ADMIN_STATUS_WARN)
if obj.is_enabled:
- obj.disable()
+ try:
+ obj.disable()
+ except Exception as e: # pylint: disable=broad-except
+ return self.root_with_msg(str(e), ADMIN_STATUS_WARN)
obj.save_enabled_state()
msg = "Plugin %s disabled" % obj.name
return self.root_with_msg(msg, ADMIN_STATUS_OK,
def scheme(self):
cherrypy.response.headers.update({'Content-Type': 'image/svg+xml'})
urls = self.get_menu_urls()
- # pylint: disable=star-args
return str(self._template('admin/ipsilon-scheme.svg', **urls))
scheme.public_function = True