Changeset - 136af52f374b
[Not reviewed]
default
0 12 0
Marcin Kuzminski - 15 years ago 2011-01-06 19:10:25
marcin@python-works.com
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
12 files changed with 122 insertions and 51 deletions:
0 comments (0 inline, 0 general)
development.ini
Show inline comments
 
@@ -43,12 +43,13 @@ use = egg:rhodecode
 
full_stack = true
 
static_files = true
 
lang=en
 
cache_dir = %(here)s/data
 
index_dir = %(here)s/data/index
 
cut_off_limit = 256000
 
force_https = false
 

	
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 
use_celery = false
 
broker.host = localhost
docs/changelog.rst
Show inline comments
 
.. _changelog:
 

	
 
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**)
 
----------------------
 

	
 
news
 
++++
 

	
docs/setup.rst
Show inline comments
 
@@ -154,12 +154,22 @@ so for example setting `BROKER_HOST` in 
 
the config file.
 

	
 
In order to make start using celery run::
 
 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
 
--------------------------
 

	
 
Sample config for nginx using proxy::
 

	
 
 server {
 
@@ -207,15 +217,42 @@ in production.ini file::
 
    static_files = false
 
    lang=en
 
    cache_dir = %(here)s/data
 

	
 
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
 

	
 

	
 
Apache's example FCGI config
 
----------------------------
 

	
production.ini
Show inline comments
 
@@ -43,12 +43,13 @@ use = egg:rhodecode
 
full_stack = true
 
static_files = false
 
lang=en
 
cache_dir = %(here)s/data
 
index_dir = %(here)s/data/index
 
cut_off_limit = 256000
 
force_https = false
 

	
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 
use_celery = false
 
broker.host = localhost
rhodecode/config/deployment.ini_tmpl
Show inline comments
 
@@ -44,12 +44,13 @@ full_stack = true
 
static_files = true
 
lang=en
 
cache_dir = %(here)s/data
 
index_dir = %(here)s/data/index
 
app_instance_uuid = ${app_instance_uuid}
 
cut_off_limit = 256000
 
force_https = false 
 

	
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 
use_celery = false
 
broker.host = localhost
rhodecode/controllers/files.py
Show inline comments
 
@@ -36,13 +36,14 @@ from pylons.controllers.util import redi
 

	
 
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
 
from rhodecode.lib.base import BaseController, render
 
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
 

	
 
log = logging.getLogger(__name__)
 

	
 
class FilesController(BaseController):
 
@@ -88,12 +89,16 @@ class FilesController(BaseController):
 
                c.files_list = c.changeset.get_node(f_path)
 
                c.file_history = self._get_history(c.repo, c.files_list, f_path)
 
            except RepositoryError, e:
 
                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'))
 

	
 

	
 

	
rhodecode/lib/indexers/daemon.py
Show inline comments
 
@@ -113,16 +113,23 @@ class WhooshIndexingDaemon(object):
 

	
 
    def add_doc(self, writer, path, repo):
 
        """Adding doc to writer this function itself fetches data from
 
        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:
 
        #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)
 
            u_content = node.content
 
                
 
        else:
 
            log.debug('    >> %s' % path)
 
            #just index file name without it's content
 
            u_content = u''
 

	
 
        writer.add_document(owner=unicode(repo.contact),
rhodecode/lib/middleware/https_fixup.py
Show inline comments
 
#!/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
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
# This program is distributed in the hope that it will be useful,
 
@@ -15,21 +22,18 @@
 
# 
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# 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)
 
    
 
    
 
@@ -37,11 +41,14 @@ class HttpsFixup(object):
 
        """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:
 
            environ['wsgi.url_scheme'] = 'http'
 
        return None
rhodecode/lib/middleware/simplehg.py
Show inline comments
 
@@ -66,20 +66,22 @@ class SimpleHg(object):
 
        if not is_mercurial(environ):
 
            return self.application(environ, start_response)
 

	
 
        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
 
        #===================================================================
 
        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')
 
                REMOTE_USER.update(environ, result)
 
            else:
 
                return result.wsgi_application(environ, start_response)
rhodecode/public/css/style.css
Show inline comments
 
@@ -902,26 +902,12 @@ border-right:1px solid #404040;
 
border-bottom:1px solid #404040;
 
color:#000;
 
margin:0;
 
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;
 
border-right:1px solid #eaeaea;
 
border-bottom:1px solid #eaeaea;
 
margin:0 0 0 200px;
 
@@ -975,32 +961,23 @@ padding:0;
 
#content div.box div.form div.fields div.field div.textarea table td table td {
 
font-family:Lucida Grande, Verdana, Lucida Sans Regular, Lucida Sans Unicode, Arial, sans-serif;
 
font-size:11px;
 
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;
 
}
 
 
div.form div.fields div.field div.button {
 
margin:0;
 
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;
 
border-right:1px solid #2b7089;
 
border-bottom:1px solid #1a6480;
 
color:#FFF;
 
@@ -1016,13 +993,13 @@ border-right:1px solid #35829f;
 
border-bottom:1px solid #257897;
 
color:#FFF;
 
margin:0;
 
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;
 
border-right:1px solid #2b7089;
 
border-bottom:1px solid #1a6480;
 
color:#fff;
 
@@ -1405,13 +1382,13 @@ overflow:hidden;
 
border-top:1px solid #DDD;
 
text-align:left;
 
margin:0;
 
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;
 
border-style:solid;
 
border-width:1px;
 
}
 
@@ -1611,25 +1588,34 @@ background:#f8f8f8;
 
font-size:100%;
 
line-height:125%;
 
padding:0;
 
}
 
 
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 {
 
margin-left:25px;
 
font-weight:700;
 
}
 
 
div.browserblock .browser-body {
 
background:#EEE;
 
border-top:1px solid #CCC;
 
}
 
 
table.code-browser {
 
border-collapse:collapse;
 
width:100%;
 
}
 
@@ -1751,12 +1737,16 @@ font-family:arial, helvetica, verdana, s
 
border:2px solid #003367;
 
font:100% sans-serif;
 
width:auto;
 
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 {
 
vertical-align:top;
 
}
 
 
@@ -2049,13 +2039,13 @@ border-left:1px solid #316293;
 
}
 
 
#content div.box div.title div.search div.input input {
 
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;
 
color:#FFF;
 
}
 
 
@@ -2063,13 +2053,13 @@ color:#FFF;
 
background:#46a0c1 url("../../images/button_highlight_selected.png") repeat-x;
 
border:1px solid #316293;
 
border-left:none;
 
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;
 
border-right:1px solid #2b7089;
 
border-bottom:1px solid #1a6480;
 
color:#fff;
 
@@ -2208,13 +2198,13 @@ color:#000;
 
font-family:Lucida Grande, Verdana, Lucida Sans Regular, Lucida Sans Unicode, Arial, sans-serif;
 
font-size:11px;
 
font-weight:700;
 
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;
 
border-right:1px solid #DDD;
 
border-bottom:1px solid #c6c6c6;
 
color:#515151;
 
@@ -2256,13 +2246,13 @@ text-align:center;
 
#content div.box div.action div.button,#login div.form div.fields div.field div.input div.link,#register div.form div.fields div.field div.input div.link {
 
text-align:right;
 
margin:6px 0 0;
 
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;
 
border-right:1px solid #DDD;
 
border-bottom:1px solid #c6c6c6;
 
color:#515151;
rhodecode/templates/index.html
Show inline comments
 
@@ -84,13 +84,13 @@
 
		            	title="${_('Fork of')} ${repo['repo'].dbrepo.fork.repo_name}" 
 
		            	src="/images/icons/arrow_divide.png"/></a>
 
		            %endif
 
		            </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
 
		            <td>
 
		              <span class="tooltip" tooltip_title="${repo['last_change']}">
 
		              ${h.age(repo['last_change'])}</span>
test.ini
Show inline comments
 
@@ -42,12 +42,13 @@ use = egg:rhodecode
 
full_stack = true
 
static_files = true
 
lang=en
 
cache_dir = %(here)s/data
 
index_dir = /tmp/index
 
cut_off_limit = 256000
 
force_https = false
 

	
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 
use_celery = false
 
broker.host = localhost
0 comments (0 inline, 0 general)