def _run_simple_filters(self, filters, callback, m2message, *filter_args): for f in filters: try: self.log.debug("Calling {0} filter".format(f.__class__.__name__)) callback(f, m2message, *filter_args) except Exception as e: from wsgid.core import log log.exception(e)
def _run_post_filters(self, filters, callback, m2message, *filter_args): status, headers, body = filter_args for f in filters: try: self.log.debug("Calling {0} filter".format(f.__class__.__name__)) status, headers, body = callback(f, m2message, status, headers, body) except Exception as e: from wsgid.core import log log.exception(e) return (status, headers, body)
def _load_django_extra_options(self, path): parsed = {} conf_file = os.path.join(path, 'django.json') log.debug("Reading {0}".format(conf_file)) if os.path.exists(conf_file): try: parsed = simplejson.load(open(conf_file)) except: log.exception("Error parsing {file}".format(file=conf_file)) return parsed