Commits

Marcin Kuzminski committed 57015c7 Merge
  • Participants
  • Parent commits 233f92e, 6c23e72
  • Branches demo

Comments (0)

Files changed (4)

File pylons_app/lib/auth.py

         self.repo_name = None
         
     def __call__(self, check_Location=''):
-        user = session['hg_app_user']
+        user = session.get('hg_app_user', False)
+        if not user:
+            return False
         self.user_perms = user.permissions
         self.granted_for = user.username        
         log.debug('checking %s %s', self.__class__.__name__, self.required_perms)            

File pylons_app/lib/middleware/simplehg.py

 # encoding: utf-8
 # middleware to handle mercurial api calls
 # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
+from mercurial.error import RepoError
  
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 from paste.auth.basic import AuthBasicAuthenticator
 from paste.httpheaders import REMOTE_USER, AUTH_TYPE
 from pylons_app.lib.auth import authfunc, HasPermissionAnyMiddleware
-from pylons_app.lib.utils import is_mercurial, make_ui, invalidate_cache
+from pylons_app.lib.utils import is_mercurial, make_ui, invalidate_cache, \
+    check_repo_fast
 from pylons_app.model import meta
 from pylons_app.model.db import UserLog, User
-from webob.exc import HTTPNotFound, HTTPForbidden
+from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError
 import logging
 import os
 import traceback
             
             try:
                 repo_name = '/'.join(environ['PATH_INFO'].split('/')[1:])
-            except Exception as e:
+            except:
                 log.error(traceback.format_exc())
-                return HTTPNotFound()(environ, start_response)
+                return HTTPInternalServerError()(environ, start_response)
             
             #===================================================================
             # CHECK PERMISSIONS FOR THIS REQUEST
                     user = sa.query(User)\
                         .filter(User.username == username).one()
                 except:
-                    return HTTPNotFound()(environ, start_response)
+                    log.error(traceback.format_exc())
+                    return HTTPInternalServerError()(environ, start_response)
                 #check permissions for this repository
                 if action == 'pull':
                     if not HasPermissionAnyMiddleware('repository.read',
             self.baseui = make_ui(self.config['hg_app_repo_conf'])
             self.basepath = self.config['base_path']
             self.repo_path = os.path.join(self.basepath, repo_name)
+
+            #quick check if that dir exists...
+            if check_repo_fast(repo_name, self.basepath):
+                return HTTPNotFound()(environ, start_response)
+            
             try:
                 app = wsgiapplication(self.__make_app)
+            except RepoError as e:
+                if str(e).find('not found') != -1:
+                    return HTTPNotFound()(environ, start_response)
             except Exception:
                 log.error(traceback.format_exc())
-                return HTTPNotFound()(environ, start_response)
+                return HTTPInternalServerError()(environ, start_response)
             
             
             #invalidate cache on push

File pylons_app/public/css/monoblue_custom.css

 
 /** end of file **/ /** changeset **/
 #changeset_content {
-	width: 60%;
-	float: left;
+	border:1px solid #CCCCCC;
+	padding:5px;
 }
 
 #changeset_content .container .wrapper {
 }
 
 #changeset_content .container {
-	border: 1px solid #CCCCCC;
 	height: 120px;
 }
 
 }
 
 .cs_files {
-	width: 60%;
+
 }
 
 .cs_files .cs_added {

File pylons_app/templates/changeset/changeset.html

 			<div class="left">
 				<div class="date">${_('Date')}: ${c.changeset.date}</div>
 				<div class="author">${_('Author')}: ${c.changeset.author}</div>
-				<div class="message">
-					${h.wrap_paragraphs(c.changeset.message)}
-				</div>
+				<div class="message">${h.wrap_paragraphs(c.changeset.message)}</div>
 			</div>	
 			<div class="right">
 				<span class="logtags">
 					</div>
 				%endfor								
 			</div>		
-		</div>    
+		</div>
+		<span style="font-size:1.1em;font-weight: bold">${_('Files affected')}</span>
+	    <div class="cs_files">
+				%for change,filenode,diff,cs1,cs2 in c.changes:
+					<div class="cs_${change}">${h.link_to(filenode.path,h.url.current(anchor='CHANGE-%s'%filenode.path))}</div>
+				%endfor
+		</div>		    
     </div>
-    
-    <div style="clear:both;height:10px"></div>
-    <div class="cs_files">
-			%for change,filenode,diff,cs1,cs2 in c.changes:
-				<div class="cs_${change}">${h.link_to(filenode.path,h.url.current(anchor='CHANGE-%s'%filenode.path))}</div>
-			%endfor
-	</div>
-	
+    	
 	%for change,filenode,diff,cs1,cs2 in c.changes:
 		%if change !='removed':
 		<div style="clear:both;height:10px"></div>