Patches from Gerd v. Egidy (slightly reworked)
This commit is contained in:
parent
1410b36fe5
commit
d36c789423
|
@ -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: ";
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue