make configuration queries more fault-tolerant

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3574 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2009-10-12 06:04:17 +00:00
parent 6eba456319
commit a9cf186875

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de # Copyright (c) 2009 Helmut Merz helmutm@cy55.de
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -37,7 +37,7 @@ class Options(AutoNamespace):
def __call__(self, key, default=None): def __call__(self, key, default=None):
value = self value = self
for part in key.split('.'): for part in key.split('.'):
value = getattr(value, part) value = getattr(value, part, None)
if isinstance(value, Element): if isinstance(value, Element):
value = default value = default
return value return value