• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python apache.log_error函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mod_python.apache.log_error函数的典型用法代码示例。如果您正苦于以下问题:Python log_error函数的具体用法?Python log_error怎么用?Python log_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了log_error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: do_more_stuff

def do_more_stuff(req, links_str):
	links_with_depth = links_str.split("|||");
	links = []
	for each in links_with_depth:
		if each != "":
			each_link_and_depth = each.split("||")
			apache.log_error(str(each_link_and_depth))
			links.append(each_link_and_depth);
	apache.log_error(links_str);
	#apache.log_error(str(len(links_str)));
	#apache.log_error(str(links))
	result = dist_crawl.start_processing([], links, 0);
	map_res = result[0]
	result.pop(0);
	map_to_arr = []
	for each in map_res:
		map_to_arr.append([each] + map_res[each])
	result.insert(0, map_to_arr);
	more_results = result[0]
	ret_html = ""
	for res in more_results:
		ret_html = ret_html + "<tr>"
		for col in res:
			ret_html = ret_html + "<td>" + str(col) + "</td>"
		ret_html = ret_html + "</tr>"

	return ret_html
开发者ID:aashray,项目名称:dist_crawl,代码行数:27,代码来源:form.py


示例2: index

def index (req, repo=None, version="0.0.0", OS="None"):
	if not repo:
		repolist = ""
		desc = "Download " + " ".join ([repo["name"] for repo in lib.get_config ("Repositories","Downloads")])
		for repo in lib.get_config ("Repositories","Downloads"):
			try:
				repolist += _snippet_for_repo (None, repo)
			except Exception as e:
				apache.log_error (str(e))
		return lib.respond (req, "<div class='news'>"+repolist+"<br/><br/></div>", "Downloads", "Downloads", desc, module_info ())
	else:
		repository = None
		for entry in lib.get_config ("Repositories","Downloads"):
			if entry["repo"] == repo:
				repository = entry
				break
		else:
			return lib.e404 (req, "Could not find a matching repository.", module_info())
		try:
			ver = _latest_ver (repo=repository)
		except Exception as e:
			apache.log_error (traceback.format_exc())
			return lib.e404 (req, "Repository corrupt or wrong configuration, please contact the administrator.", module_info())
		if version == ver:
			return lib.respond (req, "You're already running the lastest version of %s." % repository["name"], "Downloads", "Downloads", "Updater", module_info())
		else:
			return lib.respond (req, _snippet_for_repo (repo=repository),"Downloads", "Downloads", "Download %s" % repository["name"], module_info())
开发者ID:creshal,项目名称:yakicms,代码行数:27,代码来源:index.py


示例3: handler

def handler(req):
    """HTTP request handler"""
    _options = req.get_options()
    _home = _options.get("TrackerHome")
    _lang = _options.get("TrackerLanguage")
    _timing = _options.get("TrackerTiming", "no")
    if _timing.lower() in ("no", "false"):
        _timing = ""
    _debug = _options.get("TrackerDebug", "no")
    _debug = _debug.lower() not in ("no", "false")
    if not (_home and os.path.isdir(_home)):
        apache.log_error(
            "PythonOption TrackerHome missing or invalid for %(uri)s"
            % {'uri': req.uri})
        return apache.HTTP_INTERNAL_SERVER_ERROR
    _tracker = roundup.instance.open(_home, not _debug)
    # create environment
    # Note: cookies are read from HTTP variables, so we need all HTTP vars
    req.add_common_vars()
    _env = dict(req.subprocess_env)
    # XXX classname must be the first item in PATH_INFO.  roundup.cgi does:
    #       path = string.split(os.environ.get('PATH_INFO', '/'), '/')
    #       os.environ['PATH_INFO'] = string.join(path[2:], '/')
    #   we just remove the first character ('/')
    _env["PATH_INFO"] = req.path_info[1:]
    if _timing:
        _env["CGI_SHOW_TIMING"] = _timing
    _form = cgi.FieldStorage(req, environ=_env)
    _client = _tracker.Client(_tracker, Request(req), _env, _form,
        translator=TranslationService.get_translation(_lang,
            tracker_home=_home))
    _client.main()
    return apache.OK
开发者ID:hemmecke,项目名称:roundup4071,代码行数:33,代码来源:apache.py


示例4: handler

def handler(req):

    """
    Right now, index serves everything.

    Hitting this URL means we've already cleared authn/authz
    but we still need to use the token for all remote requests.
    """

    my_user = __get_user(req)
    my_uri = req.uri
    sess  = __get_session(req)

    if not sess.has_key('cobbler_token'):
       # using Kerberos instead of Python Auth handler? 
       # We need to get our own token for use with authn_passthru
       # which should also be configured in /etc/cobbler/modules.conf
       # if another auth mode is configured in modules.conf this will
       # most certaintly fail.
       try:
           if not os.path.exists("/var/lib/cobbler/web.ss"):
               apache.log_error("cannot load /var/lib/cobbler/web.ss")
               return apache.HTTP_UNAUTHORIZED
           fd = open("/var/lib/cobbler/web.ss")
           data = fd.read()
           my_pw = data
           fd.close()
           token = xmlrpc_server.login(my_user,my_pw)
       except Exception, e:
           apache.log_error(str(e))
           return apache.HTTP_UNAUTHORIZED
       sess['cobbler_token'] = token
开发者ID:77720616,项目名称:cobbler,代码行数:32,代码来源:index.py


示例5: _create_dispatcher

def _create_dispatcher():
    _LOGGER.info('Initializing Dispatcher')

    options = apache.main_server.get_options()

    handler_root = options.get(_PYOPT_HANDLER_ROOT, None)
    if not handler_root:
        raise Exception('PythonOption %s is not defined' % _PYOPT_HANDLER_ROOT,
                        apache.APLOG_ERR)

    handler_scan = options.get(_PYOPT_HANDLER_SCAN, handler_root)

    allow_handlers_outside_root = _parse_option(
        _PYOPT_ALLOW_HANDLERS_OUTSIDE_ROOT,
        options.get(_PYOPT_ALLOW_HANDLERS_OUTSIDE_ROOT),
        _PYOPT_ALLOW_HANDLERS_OUTSIDE_ROOT_DEFINITION)

    dispatcher = dispatch.Dispatcher(
        handler_root, handler_scan, allow_handlers_outside_root)

    for warning in dispatcher.source_warnings():
        apache.log_error(
            'mod_pywebsocket: Warning in source loading: %s' % warning,
            apache.APLOG_WARNING)

    return dispatcher
开发者ID:0X1A,项目名称:servo,代码行数:26,代码来源:headerparserhandler.py


示例6: handler

def handler(req):
    reload(sys) #set default encoding from ascii to utf-8
    sys.setdefaultencoding('utf-8')

    apache.log_error(req.args)

    params = {}
    for pair in req.args.split('&'):
        key, value = pair.split('=')
        params[key] = value
    ssid = params['ssid']
    password = params['passwd']
    req.content_type = "text/plain; charset=utf-8"
    req.write('开始连接wifi咯!')

    scripts_path = get_scripts_path()
    if scripts_path == '':
        apache.log_error('scripts_path resolv failed!')
    catkin_ws = scripts_path.split('src')[0]
    sys.path.append(catkin_ws+'devel/lib/python2.7/dist-packages')
    sys.path.append('/opt/ros/hydro/lib/python2.7/dist-packages')
    os.environ['ROS_MASTER_URI'] = 'http://localhost:11311'
    import rospy
    from qbo_config_manager.srv import *
    rospy.wait_for_service('/config_connect_user_wifi')
    proc = rospy.ServiceProxy('/config_connect_user_wifi', ConnectWifi)
    result = proc(ssid, 'p'+password)  #ROS 把'123456'理解成数字,而不是字符串,所以要在前面加字母占位符

    return apache.OK
开发者ID:ppp2006,项目名称:hotspot_manager,代码行数:29,代码来源:config.py


示例7: handler

def handler(req):
    reload(sys) #set default encoding from ascii to utf-8
    sys.setdefaultencoding('utf-8')

    apache.log_error(req.args)

    params = {}
    for pair in req.args.split('&'):
        key, value = pair.split('=')
        params[key] = value
    if params['service'] == 'get_sen':
        req.content_type = "text/plain; charset=utf-8"
        uid = params['uid']
        sen = getSen(uid)
        req.write(sen)
        return apache.OK
    elif params['service'] == 'put_sen':
        wav = req.read()
        uid = params['uid']
        sid = params['sid']
        result = putSen(uid, sid, wav)
        req.content_type = "text/plain; charset=utf-8"
        req.write(result)
        return apache.OK
    elif params['service'] == 'login':
        user_name = unquote(params['user_name']).decode('utf-8')
        result = login(user_name)
        req.content_type = "text/plain; charset=utf-8"
        req.write(result)
        return apache.OK
开发者ID:ppp2006,项目名称:speech_voice_recored,代码行数:30,代码来源:index.py


示例8: handler

def handler(req): 
    #req.content_type = 'text/plain' 
    #req.write("Hello World!") 

    if req.method == 'POST':
        kwargs = parse_qs(req.read())
    elif req.method == 'GET': 
        kwargs = parse_qs(req.args)
    
    #oldid = os.getuid()
    #os.setuid(501)

    try:
        method=str(kwargs['mode'][0])
        methodKWargs=kwargs.remove('mode')
        methodKWargs['req']=req
        
        myFilemanager.__dict__['method'](**methodKWargs)
        
        return apache.OK 


    except KeyError:
        return apache.HTTP_BAD_REQUEST   

    except Exception, (errno, strerror):
        apache.log_error(strerror, apache.APLOG_CRIT)
        return apache.HTTP_INTERNAL_SERVER_ERROR
开发者ID:brownbugzcombr,项目名称:cakephp_skeleton,代码行数:28,代码来源:filemanager_1.py


示例9: getClasses

def getClasses(req,buld=None,room=None):
	req.content_type="application/json"
	req.send_http_header()
	if buld is None or room is None:
		return "classypengins = null;"
	buld = re.sub("^[0 ]+","",buld)
	room = re.sub("^[0 ]+","",room)
	conn = sqlite3.connect(path+'/rota.db')
	c = conn.cursor()
	c.execute('''SELECT session, start, stop FROM class WHERE building=? AND room=? AND start > ? AND start < ?''',(
		buld,
		room,
		datetime.date.today() + offset,
		datetime.date.today() + offset + datetime.timedelta(days=1)
		))
	res = c.fetchall()
	sessions = []
	for r in res:
		apache.log_error(repr(r),apache.APLOG_DEBUG)
		c.execute('''SELECT offering FROM classCourse WHERE session=?''', (r[0],))
		offer = c.fetchall()
		c.execute('''SELECT course FROM courses WHERE offering=?''',
			(offer[0][0],))
		classname = c.fetchall()
		sessiondict={}
		sessiondict['class']=classname[0][0]
		sessiondict['start']=r[1]
		sessiondict['finish']=r[2]
		sessions.append(sessiondict)
	return simplejson.dumps(sessions)
开发者ID:emilevictor,项目名称:HCI-WhatsInThere,代码行数:30,代码来源:getBeaconLocation.py


示例10: headerparserhandler

def headerparserhandler(req):
    options = req.get_options()

    realm = None
    if options.has_key('Realm'):
        realm = options['Realm']
    else:
        apache.log_error('no realm specified')
        return apache.DECLINED

    # if the token is in the URL, extract it and send it to the login page
    token = None
    if req.args != None:
        try:
            dict = util.FieldStorage(req)
            if dict.has_key('token'):
                token = dict['token']
        except:
            pass

    sess = Session.Session(req, lock=0)
    sess.lock()
    sess.set_timeout(SESSION_TIMEOUT)

    username = session_user(sess, realm)

    if None == username and realm == 'Reports':
        username = session_user(sess, 'Administrator')

    if None == username and realm == 'SetupWizard':
        username = session_user(sess, 'Administrator')

    if None == username and realm == 'SetupWizard' and not wizard_password_required():
        username = 'setupwizard'
        save_session_user(sess, realm, username)

    if None == username and is_local_process_uid_authorized(req):
        username = 'localadmin'
        log_login(req, username, True, True, None)
        save_session_user(sess, realm, username)

    #if sess.has_key('apache_realms'):
    #    apache.log_error('DEBUG apache_realms: %s' % sess['apache_realms'])
    #    if sess['apache_realms'].has_key(realm):
    #        apache.log_error('DEBUG apache_realms[%s]: %s' % (realm, sess['apache_realms'][realm]))
    #else:
    #    apache.log_error('DEBUG apache_realms: %s' % None)

    sess.save()
    sess.unlock()

    if username != None:
        pw = base64.encodestring('%s' % username).strip()
        req.headers_in['Authorization'] = "BASIC % s" % pw
        req.notes['authorized'] = 'true'
        return apache.OK

    apache.log_error('Auth failure [Username not specified]. Redirecting to auth page. (realm: %s)' % realm)
    login_redirect(req, realm, token)
开发者ID:untangle,项目名称:ngfw_src,代码行数:59,代码来源:uvm_login.py


示例11: phase_status_8

def phase_status_8(req):
    apache.log_error("phase_status_8")
    apache.log_error("phases = %s" % req.phases)
    if req.phases != [1, 2, 5, 6, 7]:
        req.write("test failed")
    else:
        req.write("test ok")
    return apache.OK
开发者ID:tianyanhui,项目名称:mod_python,代码行数:8,代码来源:tests.py


示例12: log

 def log(self, msg):
     if self.logger.error_log is self.__error_log:
         try:
             self.__apache_request.log_error(msg)
         except AttributeError:
             apache.log_error(msg)
     else:
         Publisher.log(self, msg)
开发者ID:pganti,项目名称:micheles,代码行数:8,代码来源:mod_python_handler.py


示例13: _log

 def _log(msg, level):
     newlevel = apache.APLOG_ERR
     if logging.DEBUG >= level:
         newlevel = apache.APLOG_DEBUG
     elif logging.INFO >= level:
         newlevel = apache.APLOG_INFO
     elif logging.WARNING >= level:
         newlevel = apache.APLOG_WARNING
     apache.log_error(msg, newlevel, req.server)
开发者ID:Pluckyduck,项目名称:eve,代码行数:9,代码来源:_cpmodpy.py


示例14: send_login_event

def send_login_event(client_addr, login, local, succeeded, reason):
    # localadmin is used for local machine API calls
    # these are not logged
    if login == "localadmin":
        return
    try:
        uvmContext = uvm.Uvm().getUvmContext()
        uvmContext.adminManager().logAdminLoginEvent( str(login), local, str(client_addr), succeeded, reason )
    except Exception, e:
        apache.log_error('error: %s' % repr(e))
开发者ID:untangle,项目名称:ngfw_src,代码行数:10,代码来源:uvm_login.py


示例15: _create_dispatcher

def _create_dispatcher():
    _HANDLER_ROOT = apache.main_server.get_options().get(
            _PYOPT_HANDLER_ROOT, None)
    if not _HANDLER_ROOT:
        raise Exception('PythonOption %s is not defined' % _PYOPT_HANDLER_ROOT,
                        apache.APLOG_ERR)
    dispatcher = dispatch.Dispatcher(_HANDLER_ROOT)
    for warning in dispatcher.source_warnings():
        apache.log_error('mod_pywebsocket: %s' % warning, apache.APLOG_WARNING)
    return dispatcher
开发者ID:dzip,项目名称:webkit,代码行数:10,代码来源:headerparserhandler.py


示例16: emit

 def emit(self, record):
     level = self.apache_level(record)
     """
     Set MODPYTHON mp_server object so that vhost logs to its own error_log.
     """
     try:
         server = record.__dict__['server']
         apache.log_error(record.getMessage(), level, server)
     except KeyError:
         apache.log_error(record.getMessage(), level)
开发者ID:Ashmita89,项目名称:attic,代码行数:10,代码来源:modpython_logging.py


示例17: login

def login(user_name):
    db_conn = getDbConn()
    c = db_conn.cursor()
    apache.log_error("user_name = %s!"%user_name, apache.APLOG_WARNING)
    c.execute('select user_id from userDB where user_name = "%s" limit 1;'%user_name)
    rec = c.fetchall()
    if len(rec) == 0:
        apache.log_error("user_name not found!", apache.APLOG_WARNING)
	return '0'
    else:
        return str(rec[0][0]) #record 0 field 0, then convert from int to str
开发者ID:ppp2006,项目名称:speech_voice_recored,代码行数:11,代码来源:index.py


示例18: setup_gettext

def setup_gettext():
    lang = get_uvm_language()
    try:
        trans = gettext.translation('untangle-apache2-config',
                                    languages=[lang],
                                    fallback=True)
        trans.install()
    except Exception, e:
        apache.log_error('could not install language: %s lang. %s' % (lang, e))
        import __builtin__
        __builtin__.__dict__['_'] = unicode
开发者ID:rjt,项目名称:untangle,代码行数:11,代码来源:uvmlogin.py


示例19: test

	def test(self, req):
		req.content_type = "text/plain"
	
		apache.log_error("request!", apache.APLOG_NOTICE)
		req.write("\nParsed URI:\n-------------\n")
		req.write(dump.dump(req.parsed_uri))
		req.write("\nModPython Options:\n-------------\n")
		req.write(dump.dump(req.get_options()))
		req.write("\nModPython Config:\n-------------\n")
		req.write(dump.dump(req.get_config()))
		
		req.write("\nOS Env:\n-------------\n")
		req.write(dump.dump(os.environ))
	
		req.write("\nProcess Env:\n-------------\n")
		req.add_common_vars()
		req.write(dump.dump(req.subprocess_env))
		
		req.write("\n")
		req.write("server_root=" + apache.server_root() + "\n")
		req.write("document_root=" + req.document_root() + "\n")
		req.write("loglevel=" + dump.dump(req.server.loglevel))
		req.write("is_virtual=" + dump.dump(req.server.is_virtual))
		req.write("phase=" + dump.dump(req.phase))
		req.write("handler=" + dump.dump(req.handler))
		req.write("uri=" + dump.dump(req.uri))
		req.write("filename=" + dump.dump(req.filename))
		req.write("py interpreter=" + dump.dump(req.interpreter))
		
		req.write("\n")
		req.write("__file__=" + __file__ + "\n")
		req.write("dir=" + os.path.dirname(__file__) + "\n")
		
		req.write("\n")
		if apache.mpm_query(apache.AP_MPMQ_IS_THREADED):
			req.write("mpm is threaded\n")
		else:
			req.write("mpm is NOT threaded\n")
		if apache.mpm_query(apache.AP_MPMQ_IS_FORKED):
			req.write("mpm is forked\n")
		else:
			req.write("mpm is NOT forked\n")
		
		req.write("\n")
		req.write("sys.path: %s\n" % sys.path)
		req.write("\n")
		req.write("POST form data:\n")    
		req.write("content length: " + dump.dump(req.clength))
		req.write(dump.dump(req.read()))
		#req.write(dump.dump(apache.config_tree()))
		
		return apache.OK
开发者ID:BackupTheBerlios,项目名称:konfidi-svn,代码行数:52,代码来源:frontend.py


示例20: handler

def handler(req):
    """HTTP request handler"""
    _options = req.get_options()
    _home = _options.get("TrackerHome")
    _lang = _options.get("TrackerLanguage")
    _timing = _options.get("TrackerTiming", "no")
    if _timing.lower() in ("no", "false"):
        _timing = ""
    _debug = _options.get("TrackerDebug", "no")
    _debug = _debug.lower() not in ("no", "false")

    # We do not need to take a lock here (the fast path) because reads
    # from dictionaries are atomic.
    if not _debug and _home in __tracker_cache:
        _tracker = __tracker_cache[_home]
    else:
        if not (_home and os.path.isdir(_home)):
            apache.log_error(
                "PythonOption TrackerHome missing or invalid for %(uri)s"
                % {'uri': req.uri})
            return apache.HTTP_INTERNAL_SERVER_ERROR
        if _debug:
            _tracker = roundup.instance.open(_home, optimize=0)
        else:
            __tracker_cache_lock.acquire()
            try:
                # The tracker may have been added while we were acquiring
                # the lock.
                if _home in __tracker_cache:
                    _tracker = __tracker_cache[home]
                else:
                    _tracker = roundup.instance.open(_home, optimize=1)
                    __tracker_cache[_home] = _tracker
            finally:
                __tracker_cache_lock.release()
    # create environment
    # Note: cookies are read from HTTP variables, so we need all HTTP vars
    req.add_common_vars()
    _env = dict(req.subprocess_env)
    # XXX classname must be the first item in PATH_INFO.  roundup.cgi does:
    #       path = string.split(os.environ.get('PATH_INFO', '/'), '/')
    #       os.environ['PATH_INFO'] = string.join(path[2:], '/')
    #   we just remove the first character ('/')
    _env["PATH_INFO"] = req.path_info[1:]
    if _timing:
        _env["CGI_SHOW_TIMING"] = _timing
    _form = cgi.FieldStorage(req, environ=_env)
    _client = _tracker.Client(_tracker, Request(req), _env, _form,
        translator=TranslationService.get_translation(_lang,
            tracker_home=_home))
    _client.main()
    return apache.OK
开发者ID:AnishShah,项目名称:roundup,代码行数:52,代码来源:apache.py



注:本文中的mod_python.apache.log_error函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.parse_qsl函数代码示例发布时间:2022-05-27
下一篇:
Python mod_python.Cookie类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap