Here are the examples of the python api sys._debug_db_queries taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
2
Example 1
Project: zengine Source File: middlewares.py
def process_response(self, req, resp, resource):
"""
Serializes ``req.context['result']`` to resp.body as JSON.
If :attr:`~zengine.settings.DEBUG` is True,
``sys._debug_db_queries`` (set by pyoko) added to response.
"""
if 'result' not in req.context:
return
req.context['result']['is_login'] = 'user_id' in req.env['session']
if settings.DEBUG:
req.context['result']['_debug_queries'] = sys._debug_db_queries
sys._debug_db_queries = []
if resp.body is None and req.context['result']:
resp.body = json.dumps(req.context['result'])
try:
log.debug("RESPONSE: %s" % resp.body)
except:
log.exception("ERR: RESPONSE CANT BE LOGGED ")
0
Example 2
def __init__(self):
"""
Proxy object for both static and dynamic app settings
:return:
"""
self.DEBUG = bool(os.environ.get('DEBUG'))
self.DEBUG_LEVEL = int(os.environ.get('DEBUG_LEVEL', 0))
self.SEARCH_INDEXES = {}
self.CATALOG_DATA_MANAGER = "pyoko.lib.utils.simple_choices_manager"
self.FILE_MANAGER = "pyoko.lib.utils.SimpleRiakFileManager"
self.DATE_DEFAULT_FORMAT = ""
self.DATETIME_DEFAULT_FORMAT = ""
self.SETTINGS_MODULE = os.environ.get('PYOKO_SETTINGS')
self.MODELS_MODULE = '.'.join(
self.SETTINGS_MODULE.split('.')[:1]) + '.models'
try:
mod = importlib.import_module(self.SETTINGS_MODULE)
except ImportError as e:
raise ImportError(
"Could not import settings '%s' (Is it on sys.path? "
"Is there an import error in the settings file?): %s"
% (self.SETTINGS_MODULE, e)
)
for setting in dir(mod):
if setting.isupper():
setting_value = getattr(mod, setting)
setattr(self, setting, setting_value)
if self.DEBUG:
import sys
# Will be used to store solr query logs
sys._debug_db_queries = []