Patches from Gerd v. Egidy (slightly reworked)

This commit is contained in:
Lars Immisch 2013-08-23 17:52:41 +02:00
parent 1410b36fe5
commit d36c789423
2 changed files with 4 additions and 3 deletions

View File

@ -99,14 +99,14 @@ PythonScript::run() throw (ApplicationError)
if ( !(py_traceback=cStringIO->cgetvalue(catch_stderr)) )
throw ApplicationError("unable to get traceback","PythonScript::run()");
int length;
Py_ssize_t length;
char *traceback;
if (PyString_AsStringAndSize(py_traceback, &traceback, &length))
throw ApplicationError("unable to convert traceback to char*","PythonScript::run()");
error << prefix() << "A python error occured. See traceback below." << endl;
error << prefix(false) << "Python traceback: ";
for (int i=0;i<length-1;i++) {
for (Py_ssize_t i=0;i<length-1;i++) {
error << traceback[i];
if (traceback[i]=='\n')
error << prefix(false) << "Traceback: ";

View File

@ -92,6 +92,7 @@ class CSConfigParser(ConfigParser):
Returns the value for this option or None if it's not found
"""
retval = None
if self.has_option(user, option):
retval = self.get(user, option)
elif self.has_option('GLOBAL', option):
@ -99,7 +100,7 @@ class CSConfigParser(ConfigParser):
elif fail:
raise NoOptionError(user, option)
# don't return empty values
if retval:
if not retval is None:
return retval
return default