changeset 2490:7a5eeafb1a9a beta

better path extraction method. fixed error document old html
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 20 Jun 2012 00:01:06 +0200
parents a0adf8db1416
children 9fad28af93bd
files rhodecode/lib/base.py rhodecode/templates/errors/error_document.html
diffstat 2 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/base.py	Tue Jun 19 23:07:23 2012 +0200
+++ b/rhodecode/lib/base.py	Wed Jun 20 00:01:06 2012 +0200
@@ -48,6 +48,14 @@
     return ip
 
 
+def _get_access_path(environ):
+    path = environ.get('PATH_INFO')
+    org_req = environ.get('pylons.original_request')
+    if org_req:
+        path = org_req.environ.get('PATH_INFO')
+    return path
+
+
 class BasicAuth(AuthBasicAuthenticator):
 
     def __init__(self, realm, authfunc, auth_http_code=None):
@@ -187,13 +195,13 @@
                     cookie_store.get('is_authenticated')
                 )
             log.info('IP: %s User: %s accessed %s' % (
-               self.ip_addr, auth_user, safe_unicode(environ.get('PATH_INFO')))
+               self.ip_addr, auth_user, safe_unicode(_get_access_path(environ)))
             )
             return WSGIController.__call__(self, environ, start_response)
         finally:
             log.info('IP: %s Request to %s time: %.3fs' % (
                 _get_ip_addr(environ),
-                safe_unicode(environ.get('PATH_INFO')), time.time() - start)
+                safe_unicode(_get_access_path(environ)), time.time() - start)
             )
             meta.Session.remove()
 
--- a/rhodecode/templates/errors/error_document.html	Tue Jun 19 23:07:23 2012 +0200
+++ b/rhodecode/templates/errors/error_document.html	Wed Jun 20 00:01:06 2012 +0200
@@ -1,14 +1,16 @@
 ## -*- coding: utf-8 -*-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
         <title>Error - ${c.error_message}</title>
         <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
+        <meta name="robots" content="index, nofollow"/>
+        <link rel="icon" href="${h.url('/images/icons/database_gear.png')}" type="image/png" />
+                
+        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 	    %if c.redirect_time:
 	        <meta http-equiv="refresh" content="${c.redirect_time}; url=${c.url_redirect}"/>
 	    %endif
-        <link rel="icon" href="${h.url("/images/hgicon.png")}" type="image/png" />
-        <meta name="robots" content="index, nofollow"/>
 
         <!-- stylesheets -->
         <link rel="stylesheet" type="text/css" href="${h.url('/css/style.css')}" media="screen" />