def main(): check_config() if web.config.get('error_email_recipients'): app.internalerror = web.emailerrors( web.config.error_email_recipients, app.internalerror, web.config.get('from_address')) app.run()
def main(): FORMAT = "%(asctime)s [%(name)s] [%(levelname)s] %(message)s" logging.basicConfig(format=FORMAT, level=logging.INFO) webapp.check_config() if web.config.get('error_email_recipients'): app.internalerror = web.emailerrors( web.config.error_email_recipients, app.internalerror, web.config.get('error_from_address')) logger = logging.getLogger(__name__) logger.info("starting the signup app") app.run()
def check_config(): if "--config" in sys.argv: index = sys.argv.index("--config") configfile = sys.argv[index+1] sys.argv = sys.argv[:index] + sys.argv[index+2:] load_config(configfile) web.config.configfile = configfile if web.config.get('error_email_recipients'): app.internalerror = web.emailerrors( web.config.error_email_recipients, app.internalerror, web.config.get('error_from_address'))
def _setup(): #if config.db_parameters is None: # raise Exception('infogami.config.db_parameters is not specified') if config.site is None: raise Exception('infogami.config.site is not specified') if config.bugfixer: web.webapi.internalerror = web.emailerrors(config.bugfixer, web.debugerror) web.internalerror = web.webapi.internalerror web.config.db_parameters = config.db_parameters web.config.db_printing = config.db_printing from infogami.utils import delegate delegate._load() # setup context etc. delegate.fakeload()
def _setup(): #if config.db_parameters is None: # raise Exception('infogami.config.db_parameters is not specified') if config.site is None: raise Exception('infogami.config.site is not specified') if config.bugfixer: web.webapi.internalerror = web.emailerrors(config.bugfixer, web.debugerror) web.internalerror = web.webapi.internalerror web.config.db_parameters = config.db_parameters web.config.db_printing = config.db_printing if config.get("debug", None) is not None: web.config.debug = config.debug from infogami.utils import delegate delegate._load() # setup context etc. delegate.fakeload()
def email_exceptions(): if config.bugfixer: web.emailerrors(config.bugfixer, lambda: None)()
) except Exception: pass return None # Log error message. default log to sys.stderr. def log_error(*args): for s in args: try: print >> sys.stderr, web.safestr(s) except Exception, e: print >> sys.stderr, e # Load hooks app.add_processor(web.loadhook(hook_lang)) # Mail 500 error to webmaster. if settings.MAIL_ERROR_TO_WEBMASTER: app.internalerror = web.emailerrors(settings.webmaster, web.webapi._InternalError) # Store objects in 'web' module. web.app = app web.render = render_template web.logger = log_into_sql web.log_error = log_error web.session.SessionExpired = SessionExpired
# Logger. Logging into SQL database. def logIntoSQL(msg, admin='', domain='', username='', event='', loglevel='info',): try: if admin == '': admin = session.get('username', '') db_iredadmin.insert( 'log', admin=str(admin), domain=str(domain), username=str(username), loglevel=str(loglevel), event=str(event), msg=str(msg), ip=str(session.ip), ) except Exception, e: pass app.add_processor(web.loadhook(hook_lang)) # Mail 500 error to webmaster. if cfg.general.get('mail_error_to_webmaster', 'False').lower() == 'true': app.internalerror = web.emailerrors(webmaster, web.webapi._InternalError,) # Store objects in 'web' module. web.app = app web.render = render_template web.logger = logIntoSQL web.session.SessionExpired = sessionExpired
if not r_safeproperty.match(what): raise web.notfound inp = web.input(point=None) points = db.select(table, what=what, order=what+' asc', where=what+' is not null') points = [x[what] for x in points.list()] web.header('Content-Type', 'image/png') return simplegraphs.sparkline(points, inp.point) class staticdata: def GET(self, path): if not web.config.debug: raise web.notfound assert '..' not in path, 'security' return file('data/' + path).read() app = web.application(urls, globals()) def notfound(): web.ctx.status = '404 Not Found' return getattr(render, '404')() def internalerror(): return file('templates/500.html').read() app.notfound = notfound if production_mode: app.internalerror = web.emailerrors(config.send_errors_to, internalerror) if __name__ == "__main__": app.run()
'/guideline', 'app.controllers.pages.guideline', '/privacy', 'app.controllers.pages.privacy', '/blog', 'app.controllers.pages.blog', '/api', 'app.controllers.api.index', #help '/help/feedback', 'app.controllers.help.feedback', # '/api', 'app.controllers.api.index', ) app = web.application(urls, globals()) if web.config.email_errors: app.internalerror = web.emailerrors(web.config.email_errors, web.webapi._InternalError) web.config.session_parameters['cookie_name'] = 'testsss' # ==============Online Product:============== #web.config.session_parameters['cookie_domain'] = '.biubiubiubiu.com' # ==============Product Dev:============== #web.config.session_parameters['cookie_domain'] = '.biu.com' #==============Local Dev:============== web.config.session_parameters['cookie_domain'] = None web.config.session_parameters['timeout'] = 86400*30 #24 * 60 * 60, # 24 hours in seconds web.config.session_parameters['ignore_expiry'] = True web.config.session_parameters['ignore_change_ip'] = True web.config.session_parameters['secret_key'] = 'fLjUfxqXtfNoIldA0A0J' web.config.session_parameters['expired_message'] = 'session expired'
ip=str(session.ip), timestamp=iredutils.get_gmttime(), ) except Exception: pass return None # Log error message. default log to sys.stderr. def log_error(*args): for s in args: try: print >> sys.stderr, web.safestr(s) except Exception, e: print >> sys.stderr, e # Load hooks app.add_processor(web.loadhook(hook_lang)) # Mail 500 error to webmaster. if settings.MAIL_ERROR_TO_WEBMASTER: app.internalerror = web.emailerrors(settings.webmaster, web.webapi._InternalError) # Store objects in 'web' module. web.app = app web.render = render_template web.logger = log_into_sql web.log_error = log_error web.session.SessionExpired = SessionExpired
def setup_error_emails(app): if "smtp_server" in web.config and "bug_master" in web.config: app.internalerror = web.emailerrors( web.config.bug_master, app.internalerror, web.config.from_address)
def add(app): app.notfound = notfound app.internalerror = web.config.debug and web.debugerror or internalerror if web.config.email_errors: app.internalerror = web.emailerrors(web.config.email_errors, app.internalerror)
def setup_error_emaling(app): app.internalerror = web.emailerrors(config.email_errors, app.internalerror) # was web.webapi._InternalError
def setup_error_emails(app): if "smtp_server" in web.config and "bug_master" in web.config: app.internalerror = web.emailerrors(web.config.bug_master, app.internalerror, web.config.from_address)
def email_errors(): if web.config.email_errors: web.emailerrors(web.config.email_errors, djangoerror())
def GET(self): session.username = '' session.userid = 0 session.session_id = '' return render.index() # Set a custom internal error message def internalerror(): msg = """ An internal server error occurred. Please try your request again by hitting back on your web browser. You can also <a href="/"> go back to the main page.</a> """ return web.internalerror(msg) app.add_processor(web.loadhook(session_hook)) # Setup the application's error handler app.internalerror = web.debugerror if web.config.debug else internalerror if config.email_errors.to_address: app.internalerror = web.emailerrors(config.email_errors.to_address, app.internalerror, config.email_errors.from_address) # Adds a wsgi callable for uwsgi application = app.wsgifunc() if __name__ == "__main__": app.run()
class Index: def GET(self): flash("success", """Welcome! Application code lives in app.py, models in model.py, tests in test.py, and seed data in seed.py.""") return render.index() # Set a custom internal error message def internalerror(): msg = """ An internal server error occurred. Please try your request again by hitting back on your web browser. You can also <a href="/"> go back to the main page.</a> """ return web.internalerror(msg) # Setup the application's error handler app.internalerror = web.debugerror if web.config.debug else internalerror if config.email_errors.to_address: app.internalerror = web.emailerrors(config.email_errors.to_address, app.internalerror, config.email_errors.from_address) # Adds a wsgi callable for uwsgi application = app.wsgifunc() if __name__ == "__main__": app.run()
#!/usr/bin/env python # Author: Alex Ksikes import web import config import app.controllers urls = ( '/', 'app.controllers.handle_templates.index', '/send', 'app.controllers.handle_templates.send', '/recipients', 'app.controllers.preview_recipients.browse', '/(?:img|js|css)/.*', 'app.controllers.public.public', ) app = web.application(urls, globals()) if web.config.email_errors: app.internalerror = web.emailerrors(web.config.email_errors, web.webapi._InternalError) if __name__ == "__main__": app.run()
def email_excetpions(): if config.bugfixer: web.emailerrors(config.bugfixer, lambda: None)()