Changeset - 8b06c420491d
[Not reviewed]
pylons_app/config/middleware.py
Show inline comments
 
@@ -5,12 +5,13 @@ from paste.registry import RegistryManag
 
from paste.urlparser import StaticURLParser
 
from paste.deploy.converters import asbool
 
from pylons.middleware import ErrorHandler, StatusCodeRedirect
 
from pylons.wsgiapp import PylonsApp
 
from routes.middleware import RoutesMiddleware
 
from paste.auth.basic import AuthBasicHandler
 
from pylons_app.lib.simplehg import SimpleHg
 
from pylons_app.config.environment import load_environment
 
from pylons_app.lib.auth import authfunc 
 

	
 
def make_app(global_conf, full_stack=True, static_files=True, **app_conf):
 
    """Create a Pylons WSGI application and return it
 

	
 
@@ -34,18 +35,20 @@ def make_app(global_conf, full_stack=Tru
 
    config = load_environment(global_conf, app_conf)
 

	
 

	
 
    # The Pylons WSGI app
 
    app = PylonsApp(config=config)
 

	
 
    # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)
 

	
 
    
 
    # Routing/Session/Cache Middleware
 
    app = RoutesMiddleware(app, config['routes.map'])
 
    app = SessionMiddleware(app, config)
 
    app = AuthBasicHandler(app, config['repos_name'] + ' mercurial repository', authfunc)
 
    
 
    # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)    
 
    app = SimpleHg(app, config)
 
    app = AuthBasicHandler(app, config['repos_name'] + ' mercurial repository', authfunc)    
 
    
 
    if asbool(full_stack):
 
        # Handle Python exceptions
 
        app = ErrorHandler(app, global_conf, **config['pylons.errorware'])
 

	
 
        # Display error documents for 401, 403, 404 status codes (and
pylons_app/controllers/admin.py
Show inline comments
 
@@ -17,13 +17,13 @@ from pylons_app.model.db import Users, U
 
from webhelpers.paginate import Page
 
log = logging.getLogger(__name__)
 

	
 
class AdminController(BaseController):
 

	
 
    def __before__(self):
 
        c.staticurl = g.statics
 
        
 
        c.admin_user = session.get('admin_user', False)
 
        c.admin_username = session.get('admin_username')
 
        
 
    def index(self):
 
        # Return a rendered template
 
        if request.POST:
pylons_app/controllers/changelog.py
Show inline comments
 
@@ -10,13 +10,13 @@ from webhelpers.paginate import Page
 

	
 
log = logging.getLogger(__name__)
 

	
 
class ChangelogController(BaseController):
 
    def __before__(self):
 
        c.repos_prefix = config['repos_name']
 
        c.staticurl = g.statics
 
        
 
        c.repo_name = get_repo_slug(request)
 
        
 
        
 
    def index(self):
 
        hg_model = HgModel()
 
        p = int(request.params.get('page', 1))
pylons_app/controllers/error.py
Show inline comments
 
@@ -20,13 +20,13 @@ class ErrorController(BaseController):
 
    This behaviour can be altered by changing the parameters to the
 
    ErrorDocuments middleware in your config/middleware.py file.
 
    """
 
#
 
    def __before__(self):
 
        c.repos_prefix = config['repos_name']
 
        c.staticurl = g.statics
 
        
 
        c.repo_name = request.environ['pylons.original_request']\
 
            .environ.get('PATH_INFO').split('/')[-1]
 
        
 
    def document(self):
 
        resp = request.environ.get('pylons.original_response')
 
        log.debug(resp.status)
pylons_app/controllers/files.py
Show inline comments
 
@@ -8,13 +8,13 @@ from pylons_app.lib.utils import get_rep
 
from pylons_app.model.hg_model import HgModel
 
log = logging.getLogger(__name__)
 

	
 
class FilesController(BaseController):
 
    def __before__(self):
 
        c.repos_prefix = config['repos_name']
 
        c.staticurl = g.statics
 
        
 
        c.repo_name = get_repo_slug(request)
 

	
 
    def index(self, repo_name, revision, f_path):
 
        hg_model = HgModel()
 
        c.repo = repo = hg_model.get_repo(c.repo_name)
 
        c.cur_rev = revision
pylons_app/controllers/hg.py
Show inline comments
 
@@ -18,13 +18,13 @@ from beaker.cache import cache_region
 
log = logging.getLogger(__name__)
 

	
 
class HgController(BaseController):
 

	
 
    def __before__(self):
 
        c.repos_prefix = config['repos_name']
 
        c.staticurl = g.statics
 
        
 
        c.repo_name = get_repo_slug(request)
 
        
 
    def index(self):
 
        
 

	
 
        hg_model = HgModel()
pylons_app/controllers/repos.py
Show inline comments
 
@@ -17,13 +17,13 @@ class ReposController(BaseController):
 
    # To properly map this controller, ensure your config/routing.py
 
    # file has a resource setup:
 
    #     map.resource('repo', 'repos')
 
    
 
    @authenticate
 
    def __before__(self):
 
        c.staticurl = g.statics
 
        
 
        c.admin_user = session.get('admin_user')
 
        c.admin_username = session.get('admin_username')
 
        self.sa = meta.Session
 
                
 
    def index(self, format='html'):
 
        """GET /repos: All items in the collection"""
pylons_app/controllers/shortlog.py
Show inline comments
 
@@ -10,13 +10,13 @@ from webhelpers.paginate import Page
 

	
 
log = logging.getLogger(__name__)
 

	
 
class ShortlogController(BaseController):
 
    def __before__(self):
 
        c.repos_prefix = config['repos_name']
 
        c.staticurl = g.statics
 
        
 
        c.repo_name = get_repo_slug(request)
 
        
 
        
 
    def index(self):
 
        hg_model = HgModel()
 
        p = int(request.params.get('page', 1))
pylons_app/controllers/summary.py
Show inline comments
 
@@ -8,13 +8,13 @@ from pylons_app.lib.utils import get_rep
 
from pylons_app.model.hg_model import HgModel
 
log = logging.getLogger(__name__)
 

	
 
class SummaryController(BaseController):
 
    def __before__(self):
 
        c.repos_prefix = config['repos_name']
 
        c.staticurl = g.statics
 
        
 
        c.repo_name = get_repo_slug(request)
 
        
 
    def index(self):
 
        hg_model = HgModel()
 
        c.repo_info = hg_model.get_repo(c.repo_name)
 
        c.repo_changesets = c.repo_info.get_changesets(10)
pylons_app/controllers/users.py
Show inline comments
 
@@ -17,13 +17,13 @@ class UsersController(BaseController):
 
    # To properly map this controller, ensure your config/routing.py
 
    # file has a resource setup:
 
    #     map.resource('user', 'users')
 
    
 
    @authenticate
 
    def __before__(self):
 
        c.staticurl = g.statics
 
        
 
        c.admin_user = session.get('admin_user')
 
        c.admin_username = session.get('admin_username')
 
        self.sa = meta.Session
 
        
 
    def index(self, format='html'):
 
        """GET /users: All items in the collection"""
pylons_app/public/images/hgicon.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
pylons_app/public/images/hglogo.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
pylons_app/templates/add.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
 
    <link rel="icon" href="${c.staticurl}hgicon.png" type="image/png" />
 
    <link rel="icon" href="/images/hgicon.png" type="image/png" />
 
    <meta name="robots" content="index, nofollow"/>
 
    <link rel="stylesheet" href="${c.staticurl}style-monoblue.css" type="text/css" />
 
    <link rel="stylesheet" href="/images/style-monoblue.css" type="text/css" />
 
       <title> Mercurial repositories add</title>
 
</head>
 

	
 
<body>
 
<div id="container">
 
    <div class="page-header">
 
@@ -27,13 +27,13 @@
 
        Mercurial Repository: admin
 
    </div>
 

	
 
    <div id="powered-by">
 
        <p>
 
        <a href="http://mercurial.selenic.com/" title="Mercurial">
 
            <img src="${c.staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
 
            <img src="/images/hglogo.png" width="75" height="90" border=0 alt="mercurial"/></a>
 
        </p>
 
    </div>
 

	
 
    <div id="corner-top-left"></div>
 
    <div id="corner-top-right"></div>
 
    <div id="corner-bottom-left"></div>
pylons_app/templates/base/base.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
 
    <link rel="icon" href="${c.staticurl}hgicon.png" type="image/png" />
 
    <link rel="icon" href="/images/hgicon.png" type="image/png" />
 
    <meta name="robots" content="index, nofollow"/>
 
    <title>${next.title()}</title>
 
    ${self.css()}
 
    ${self.js()}
 
</head>
 

	
 
@@ -24,13 +24,13 @@
 
        Mercurial App &copy; 2010
 
    </div>   
 

	
 
    <div id="powered-by">
 
        <p>
 
        <a href="http://mercurial.selenic.com/" title="Mercurial">
 
            <img src="${c.staticurl}hglogo.png" width="75" height="90" alt="mercurial"/></a>
 
            <img src="/images/hglogo.png" width="75" height="90" alt="mercurial"/></a>
 
        </p>
 
    </div>
 

	
 
    <div id="corner-top-left"></div>
 
    <div id="corner-top-right"></div>
 
    <div id="corner-bottom-left"></div>
0 comments (0 inline, 0 general)