<s> from uliweb import Middleware <EOL> from uliweb . orm import begin_sql_monitor , close_sql_monitor <EOL> class SQLMonitorMiddle ( Middleware ) : <EOL> ORDER = <NUM_LIT> <EOL> def process_request ( self , request ) : <EOL> from uliweb import settings <EOL> if '<STR_LIT>' in request . GET or settings . ORM . SQL_MONITOR : <EOL> self . monitor = begin_sql_monitor ( settings . ORM . get ( '<STR_LIT>' , <NUM_LIT> ) , record_details = False ) <EOL> def process_response ( self , request , response ) : <EOL> from uliweb import settings <EOL> if '<STR_LIT>' in request . GET or settings . ORM . SQL_MONITOR : <EOL> self . monitor . print_ ( request . path ) <EOL> close_sql_monitor ( self . monitor ) <EOL> return response <EOL> def process_exception ( self , request , exception ) : <EOL> from uliweb import settings <EOL> if '<STR_LIT>' in request . GET or settings . ORM . SQL_MONITOR : <EOL> self . monitor . print_ ( request . path ) <EOL> close_sql_monitor ( self . monitor ) </s>
