changeset 921:136af52f374b

merged found bugs and fixed for stable release: - added force https option into ini files for easier https usage (no need to set server headers with this options) - small css updates - fixed #96 redirect loop on files view on repositories without changesets - fixed #97 unicode string passed into server header in special cases (mod_wsgi) and server crashed with errors - fixed large tooltips problems on main page - fixed #92 whoosh indexer is more error proof
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 06 Jan 2011 19:10:25 +0100
parents d00cbafcca40
children b2a70582bce3
files development.ini docs/changelog.rst docs/setup.rst production.ini rhodecode/config/deployment.ini_tmpl rhodecode/controllers/files.py rhodecode/lib/indexers/daemon.py rhodecode/lib/middleware/https_fixup.py rhodecode/lib/middleware/simplehg.py rhodecode/public/css/style.css rhodecode/templates/index.html test.ini
diffstat 12 files changed, 127 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/development.ini	Sat Dec 18 20:06:26 2010 +0100
+++ b/development.ini	Thu Jan 06 19:10:25 2011 +0100
@@ -46,6 +46,7 @@
 cache_dir = %(here)s/data
 index_dir = %(here)s/data/index
 cut_off_limit = 256000
+force_https = false
 
 ####################################
 ###        CELERY CONFIG        ####
--- a/docs/changelog.rst	Sat Dec 18 20:06:26 2010 +0100
+++ b/docs/changelog.rst	Thu Jan 06 19:10:25 2011 +0100
@@ -3,6 +3,25 @@
 Changelog
 =========
 
+1.1.1 (**2011-01-06**)
+----------------------
+ 
+news
+++++
+
+- added force https option into ini files for easier https usage (no need to
+  set server headers with this options)
+- small css updates
+
+fixes
+++++
+
+- fixed #96 redirect loop on files view on repositories without changesets
+- fixed #97 unicode string passed into server header in special cases (mod_wsgi)
+  and server crashed with errors
+- fixed large tooltips problems on main page
+- fixed #92 whoosh indexer is more error proof
+
 1.1.0 (**2010-12-18**)
 ----------------------
 
--- a/docs/setup.rst	Sat Dec 18 20:06:26 2010 +0100
+++ b/docs/setup.rst	Thu Jan 06 19:10:25 2011 +0100
@@ -157,6 +157,16 @@
  paster celeryd <configfile.ini>
 
 
+HTTPS support
+-------------
+
+There are two ways to enable https, first is to set HTTP_X_URL_SCHEME in
+Your http server headers, than rhodecode will recognise this headers and make
+proper https redirections, another way is to set `force_https = true` 
+in the ini cofiguration to force using https, no headers are needed than to
+enable https
+
+
 Nginx virtual host example
 --------------------------
 
@@ -210,9 +220,36 @@
 
 To not have the statics served by the application. And improve speed.
 
-Apache reverse proxy
---------------------
-Tutorial can be found here
+
+Apache virtual host example
+---------------------------
+
+Sample config for apache using proxy::
+
+<VirtualHost *:80>
+        ServerName hg.myserver.com
+        ServerAlias hg.myserver.com
+
+        <Proxy *>
+          Order allow,deny
+          Allow from all
+        </Proxy>
+
+        #important !
+        #Directive to properly generate url (clone url) for pylons
+        ProxyPreserveHost On
+
+        #rhodecode instance
+        ProxyPass / http://127.0.0.1:5000/
+        ProxyPassReverse / http://127.0.0.1:5000/
+        
+        #to enable https use line below
+        #SetEnvIf X-Url-Scheme https HTTPS=1
+        
+</VirtualHost> 
+
+
+Additional tutorial
 http://wiki.pylonshq.com/display/pylonscookbook/Apache+as+a+reverse+proxy+for+Pylons
 
 
--- a/production.ini	Sat Dec 18 20:06:26 2010 +0100
+++ b/production.ini	Thu Jan 06 19:10:25 2011 +0100
@@ -46,6 +46,7 @@
 cache_dir = %(here)s/data
 index_dir = %(here)s/data/index
 cut_off_limit = 256000
+force_https = false
 
 ####################################
 ###        CELERY CONFIG        ####
--- a/rhodecode/config/deployment.ini_tmpl	Sat Dec 18 20:06:26 2010 +0100
+++ b/rhodecode/config/deployment.ini_tmpl	Thu Jan 06 19:10:25 2011 +0100
@@ -47,6 +47,7 @@
 index_dir = %(here)s/data/index
 app_instance_uuid = ${app_instance_uuid}
 cut_off_limit = 256000
+force_https = false 
 
 ####################################
 ###        CELERY CONFIG        ####
--- a/rhodecode/controllers/files.py	Sat Dec 18 20:06:26 2010 +0100
+++ b/rhodecode/controllers/files.py	Thu Jan 06 19:10:25 2011 +0100
@@ -39,7 +39,8 @@
 from rhodecode.lib.utils import EmptyChangeset
 from rhodecode.model.scm import ScmModel
 
-from vcs.exceptions import RepositoryError, ChangesetError
+from vcs.exceptions import RepositoryError, ChangesetError, \
+    ChangesetDoesNotExistError, EmptyRepositoryError
 from vcs.nodes import FileNode
 from vcs.utils import diffs as differ
 
@@ -91,6 +92,10 @@
                 h.flash(str(e), category='warning')
                 redirect(h.url('files_home', repo_name=repo_name, revision=revision))
 
+        except EmptyRepositoryError, e:
+            h.flash(_('There are no files yet'), category='warning')
+            redirect(h.url('summary_home', repo_name=repo_name))
+
         except RepositoryError, e:
             h.flash(str(e), category='warning')
             redirect(h.url('files_home', repo_name=repo_name, revision='tip'))
--- a/rhodecode/lib/indexers/daemon.py	Sat Dec 18 20:06:26 2010 +0100
+++ b/rhodecode/lib/indexers/daemon.py	Thu Jan 06 19:10:25 2011 +0100
@@ -116,10 +116,17 @@
         the instance of vcs backend"""
         node = self.get_node(repo, path)
 
-        #we just index the content of chosen files
-        if node.extension in INDEX_EXTENSIONS:
-            log.debug('    >> %s [WITH CONTENT]' % path)
+        #we just index the content of chosen files, and skip binary files
+        if node.extension in INDEX_EXTENSIONS and not node.is_binary:
+            
             u_content = node.content
+            if not isinstance(u_content, unicode):
+                log.warning('  >> %s Could not get this content as unicode '
+                          'replacing with empty content', path)
+                u_content = u''
+            else:
+                log.debug('    >> %s [WITH CONTENT]' % path)
+                
         else:
             log.debug('    >> %s' % path)
             #just index file name without it's content
--- a/rhodecode/lib/middleware/https_fixup.py	Sat Dec 18 20:06:26 2010 +0100
+++ b/rhodecode/lib/middleware/https_fixup.py	Thu Jan 06 19:10:25 2011 +0100
@@ -1,8 +1,15 @@
-#!/usr/bin/env python
-# encoding: utf-8
-# middleware to handle https correctly
-# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
- 
+# -*- coding: utf-8 -*-
+"""
+    rhodecode.lib.middleware.https_fixup
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    middleware to handle https correctly
+    
+    :created_on: May 23, 2010
+    :author: marcink
+    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>    
+    :license: GPLv3, see COPYING for more details.
+"""
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 # as published by the Free Software Foundation; version 2
@@ -18,28 +25,28 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
 
-"""
-Created on May 23, 2010
-
-@author: marcink
-"""
+from rhodecode.lib import str2bool
 
 class HttpsFixup(object):
-    def __init__(self, app):
+    def __init__(self, app, config):
         self.application = app
-    
+        self.config = config
+
     def __call__(self, environ, start_response):
         self.__fixup(environ)
         return self.application(environ, start_response)
-    
-    
+
+
     def __fixup(self, environ):
         """Function to fixup the environ as needed. In order to use this
         middleware you should set this header inside your 
         proxy ie. nginx, apache etc.
         """
         proto = environ.get('HTTP_X_URL_SCHEME')
-            
+
+        if str2bool(self.config.get('force_https')):
+            proto = 'https'
+
         if proto == 'https':
             environ['wsgi.url_scheme'] = proto
         else:
--- a/rhodecode/lib/middleware/simplehg.py	Sat Dec 18 20:06:26 2010 +0100
+++ b/rhodecode/lib/middleware/simplehg.py	Thu Jan 06 19:10:25 2011 +0100
@@ -69,6 +69,8 @@
         proxy_key = 'HTTP_X_REAL_IP'
         def_key = 'REMOTE_ADDR'
         self.ipaddr = environ.get(proxy_key, environ.get(def_key, '0.0.0.0'))
+        # skip passing error to error controller
+        environ['pylons.status_code_redirect'] = True
 
         #===================================================================
         # AUTHENTICATE THIS MERCURIAL REQUEST
@@ -76,7 +78,7 @@
         username = REMOTE_USER(environ)
 
         if not username:
-            self.authenticate.realm = self.config['rhodecode_realm']
+            self.authenticate.realm = str(self.config['rhodecode_realm'])
             result = self.authenticate(environ)
             if isinstance(result, str):
                 AUTH_TYPE.update(environ, 'basic')
--- a/rhodecode/public/css/style.css	Sat Dec 18 20:06:26 2010 +0100
+++ b/rhodecode/public/css/style.css	Thu Jan 06 19:10:25 2011 +0100
@@ -905,20 +905,6 @@
 padding:4px 8px;
 }
 
-#content div.box div.form div.fields div.field div.input a.ui-input-file {
-width:28px;
-height:28px;
-display:inline;
-position:absolute;
-overflow:hidden;
-cursor:pointer;
-background:#e5e3e3 url("../images/button_browse.png") no-repeat;
-border:none;
-text-decoration:none;
-margin:0 0 0 6px;
-padding:0;
-}
-
 #content div.box div.form div.fields div.field div.textarea {
 border-top:1px solid #b3b3b3;
 border-left:1px solid #b3b3b3;
@@ -978,15 +964,6 @@
 padding:5px 5px 5px 0;
 }
 
-#content div.box div.form div.fields div.field div.textarea table td table td a.mceButtonActive {
-background:#b1b1b1;
-}
-
-#content div.box div.form div.fields div.field div.select a.ui-selectmenu {
-color:#565656;
-text-decoration:none;
-}
-
 #content div.box div.form div.fields div.field input[type=text]:focus,#content div.box div.form div.fields div.field input[type=password]:focus,#content div.box div.form div.fields div.field input[type=file]:focus,#content div.box div.form div.fields div.field textarea:focus,#content div.box div.form div.fields div.field select:focus {
 background:#f6f6f6;
 border-color:#666;
@@ -997,7 +974,7 @@
 padding:0 0 0 8px;
 }
 
-div.form div.fields div.field div.highlight .ui-state-default {
+div.form div.fields div.field div.highlight .ui-button {
 background:#4e85bb url("../images/button_highlight.png") repeat-x;
 border-top:1px solid #5c91a4;
 border-left:1px solid #2a6f89;
@@ -1019,7 +996,7 @@
 padding:6px 12px;
 }
 
-#content div.box div.form div.fields div.buttons div.highlight input.ui-state-default {
+#content div.box div.form div.fields div.buttons div.highlight input.ui-button {
 background:#4e85bb url("../../images/button_highlight.png") repeat-x;
 border-top:1px solid #5c91a4;
 border-left:1px solid #2a6f89;
@@ -1408,7 +1385,7 @@
 padding:10px 0 0 150px;
 }
 
-#register div.form div.fields div.buttons div.highlight input.ui-state-default {
+#register div.form div.fields div.buttons div.highlight input.ui-button {
 background:url("../images/button_highlight.png") repeat-x scroll 0 0 #4E85BB;
 color:#FFF;
 border-color:#5C91A4 #2B7089 #1A6480 #2A6F89;
@@ -1614,10 +1591,18 @@
 }
 
 div.browserblock .browser-header {
-border-bottom:1px solid #CCC;
 background:#FFF;
-color:blue;
 padding:10px 0;
+float:left;
+}
+
+div.browserblock .browser-branch {
+background:#FFF;
+padding:20px 0 0 0;
+float:left;
+}
+div.browserblock .browser-branch label {
+color:#4A4A4A;	
 }
 
 div.browserblock .browser-header span {
@@ -1627,6 +1612,7 @@
 
 div.browserblock .browser-body {
 background:#EEE;
+border-top:1px solid #CCC;
 }
 
 table.code-browser {
@@ -1754,6 +1740,10 @@
 opacity:1px;
 padding:8px;
 white-space: pre;
+-webkit-border-radius: 8px 8px 8px 8px;
+-khtml-border-radius: 8px 8px 8px 8px; 
+-moz-border-radius: 8px 8px 8px 8px;
+border-radius: 8px 8px 8px 8px;
 }
 
 .ac {
@@ -2052,7 +2042,7 @@
 border:1px solid #316293;
 }
 
-#content div.box div.title div.search div.button input.ui-state-default {
+#content div.box div.title div.search div.button input.ui-button {
 background:#4e85bb url("../../images/button_highlight.png") repeat-x;
 border:1px solid #316293;
 border-left:none;
@@ -2066,7 +2056,7 @@
 color:#FFF;
 }
 
-#content div.box div.form div.fields div.field div.highlight .ui-state-default {
+#content div.box div.form div.fields div.field div.highlight .ui-button {
 background:#4e85bb url("../../images/button_highlight.png") repeat-x;
 border-top:1px solid #5c91a4;
 border-left:1px solid #2a6f89;
@@ -2211,7 +2201,7 @@
 margin:0;
 }
 
-div.form div.fields div.field div.button .ui-state-default,#content div.box div.form div.fields div.buttons input.ui-state-default {
+div.form div.fields div.field div.button .ui-button,#content div.box div.form div.fields div.buttons input.ui-button {
 background:#e5e3e3 url("../images/button.png") repeat-x;
 border-top:1px solid #DDD;
 border-left:1px solid #c6c6c6;
@@ -2259,7 +2249,7 @@
 padding:0;
 }
 
-#content div.box div.action div.button input.ui-state-default,#login div.form div.fields div.buttons input.ui-state-default,#register div.form div.fields div.buttons input.ui-state-default {
+#content div.box div.action div.button input.ui-button,#login div.form div.fields div.buttons input.ui-button,#register div.form div.fields div.buttons input.ui-button {
 background:#e5e3e3 url("../images/button.png") repeat-x;
 border-top:1px solid #DDD;
 border-left:1px solid #c6c6c6;
--- a/rhodecode/templates/index.html	Sat Dec 18 20:06:26 2010 +0100
+++ b/rhodecode/templates/index.html	Thu Jan 06 19:10:25 2011 +0100
@@ -87,7 +87,7 @@
 		            </div>
 		            </td>
 		            ##DESCRIPTION
-		            <td><span class="tooltip" tooltip_title="${repo['description']}">
+		            <td><span class="tooltip" tooltip_title="${h.tooltip(repo['description'])}">
 		               ${h.truncate(repo['description'],60)}</span>
 		            </td>
 		            ##LAST CHANGE
--- a/test.ini	Sat Dec 18 20:06:26 2010 +0100
+++ b/test.ini	Thu Jan 06 19:10:25 2011 +0100
@@ -45,6 +45,7 @@
 cache_dir = %(here)s/data
 index_dir = /tmp/index
 cut_off_limit = 256000
+force_https = false
 
 ####################################
 ###        CELERY CONFIG        ####