Changeset - 707dfdb1c7a8
[Not reviewed]
default
0 1 0
marcink - 16 years ago 2010-03-18 14:37:05

Bugfix when client is using old mercurial version and not setting http accept
1 file changed with 7 insertions and 1 deletions:
0 comments (0 inline, 0 general)
pylons_app/controllers/hg.py
Show inline comments
 
@@ -11,6 +11,7 @@ from mercurial import ui, hg
 
from mercurial.error import RepoError
 
from ConfigParser import ConfigParser
 
import encodings
 
from pylons.controllers.util import abort
 
log = logging.getLogger(__name__)
 

	
 
class HgController(BaseController):
 
@@ -20,8 +21,13 @@ class HgController(BaseController):
 

	
 
    def view(self, *args, **kwargs):
 
        response = g.hgapp(request.environ, self.start_response)
 
        
 
        http_accept = request.environ.get('HTTP_ACCEPT', False)
 
        if not http_accept:
 
            return abort(status_code=400, detail='no http accept in header')
 
        
 
        #for mercurial protocols and raw files we can't wrap into mako
 
        if request.environ['HTTP_ACCEPT'].find("mercurial") != -1 or \
 
        if http_accept.find("mercurial") != -1 or \
 
        request.environ['PATH_INFO'].find('raw-file') != -1:
 
                    return response
 
        try:
0 comments (0 inline, 0 general)