Changeset - 2963f2894a7a
[Not reviewed]
default
0 40 0
Marcin Kuzminski - 16 years ago 2010-03-04 23:13:12
marcin@python-blog.com
Tempalting change, bugfix for serving raw files, and diffs. Now raw files are not parsed thruough mako, and diffs are mako safe (not parsed also)
39 files changed with 63 insertions and 8 deletions:
0 comments (0 inline, 0 general)
pylons_app/controllers/hg.py
Show inline comments
 
@@ -7,38 +7,42 @@ from pylons_app.lib import helpers as h
 
from mako.template import Template
 
from pprint import pprint
 
import os
 
from mercurial import ui, hg
 
from mercurial.error import RepoError
 
from ConfigParser import ConfigParser
 

	
 
import encodings
 
log = logging.getLogger(__name__)
 

	
 
class HgController(BaseController):
 

	
 
    def __before__(self):
 
        c.repos_prefix = 'etelko'
 

	
 

	
 
    def view(self, *args, **kwargs):
 
        response = g.hgapp(request.environ, self.start_response)
 
        #for mercurial protocols we can't wrap into mako
 
        if request.environ['HTTP_ACCEPT'].find("mercurial") >= 0:
 
        #for mercurial protocols and raw files we can't wrap into mako
 
        if request.environ['HTTP_ACCEPT'].find("mercurial") != -1 or \
 
        request.environ['PATH_INFO'].find('raw-file') != -1:
 
                    return response
 

	
 
        #wrap the murcurial response in a mako template.
 
        template = Template("".join(response),
 
                            lookup = request.environ['pylons.pylons']\
 
        tmpl = ''.join(response)
 

	
 
        template = Template(tmpl, lookup=request.environ['pylons.pylons']\
 
                            .config['pylons.g'].mako_lookup)
 

	
 
        return template.render(g = g, c = c, session = session, h = h)
 

	
 

	
 
    def manage_hgrc(self):
 
        pass
 

	
 
    def hgrc(self, dirname):
 
        filename = os.path.join(dirname, '.hg', 'hgrc')
 
        return filename
 

	
 
    def add_repo(self, new_repo):
 
        c.staticurl = g.statics
 

	
 
        #extra check it can be add since it's the command
 
        if new_repo == 'add':
 
            c.msg = 'you basstard ! this repo is a command'
pylons_app/lib/app_globals.py
Show inline comments
 
@@ -35,12 +35,21 @@ class Globals(object):
 
        self.set_statics(cfg)
 

	
 
        for k, v in cfg.items('web'):
 
            baseui.setconfig('web', k, v)
 
        #magic trick to make our custom template dir working
 
        templater.path.append(cfg.get('web', 'templates', None))
 

	
 
        #baseui.setconfig('web', 'description', '')
 
        #baseui.setconfig('web', 'name', '')
 
        #baseui.setconfig('web', 'contact', '')
 
        #baseui.setconfig('web', 'allow_archive', '')
 
        #baseui.setconfig('web', 'style', 'monoblue_plain')
 
        #baseui.setconfig('web', 'baseurl', '')
 
        #baseui.setconfig('web', 'staticurl', '')
 
        
 
        hgwebapp = hgwebdir(paths, baseui = baseui)
 
        return hgwebapp
 

	
 

	
 
    def set_statics(self, cfg):
 
        '''
pylons_app/templates/monoblue_custom/branches.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
    <title>{repo|escape}: Branches</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
pylons_app/templates/monoblue_custom/changelog.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
    <title>{repo|escape}: changelog</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
pylons_app/templates/monoblue_custom/changelogentry.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
<h3 class="changelog"><a class="title" href="{url}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}<span class="logtags"> {inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}</span></a></h3>
 
<ul class="changelog-entry">
 
    <li class="age">{date|age}</li>
 
    <li>by <span class="name">{author|obfuscate}</span> <span class="revdate">[{date|rfc822date}] rev {rev}</span></li>
 
    <li class="description">{desc|strip|escape|addbreaks|nonempty}</li>
 
</ul>
pylons_app/templates/monoblue_custom/changeset.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<title>{repo|escape}: changeset {rev}:{node|short}</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
 
@@ -54,10 +55,12 @@
 

	
 
    <table>
 
    {files}
 
    </table>
 

	
 
    <div class="diff">
 
    <%text filter="n">
 
    {diff}
 
	</%text>
 
    </div>
 

	
 
{footer}
pylons_app/templates/monoblue_custom/error.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
    <title>{repo|escape}: Error</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
pylons_app/templates/monoblue_custom/fileannotate.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<title>{repo|escape}: {file|escape}@{node|short} (annotated)</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
pylons_app/templates/monoblue_custom/filediff.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<title>{repo|escape}: diff {file|escape}</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
 
@@ -45,10 +46,12 @@
 
        <dd><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></dd>
 
        {parent%filediffparent}
 
        {child%filediffchild}
 
    </dl>
 

	
 
    <div class="diff">
 
    <%text filter="n">
 
    {diff}
 
	</%text>
 
    </div>
 

	
 
{footer}
pylons_app/templates/monoblue_custom/filelog.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<title>{repo|escape}: File revisions</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
pylons_app/templates/monoblue_custom/filerevision.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<title>{repo|escape}: {file|escape}@{node|short}</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
 
@@ -54,10 +55,12 @@
 
        <dd>{permissions|permissions}</dd>
 
    </dl>
 

	
 
    <p class="description">{desc|strip|escape|addbreaks|nonempty}</p>
 

	
 
    <div class="source">
 
		<%text filter="n">
 
    {text%fileline}
 
		</%text>    
 
    </div>
 

	
 
{footer}
pylons_app/templates/monoblue_custom/footer.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
    <div class="page-footer">
 
        <p>Mercurial Repository: {repo|escape}</p>
 
        <ul class="rss-logo">
 
            <li><a href="{url}rss-log">RSS</a></li>
 
            <li><a href="{url}atom-log">Atom</a></li>
 
        </ul>
pylons_app/templates/monoblue_custom/graph.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
    <title>{repo|escape}: graph</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
    <!--[if IE]><script type="text/javascript" src="{staticurl}excanvas.js"></script><![endif]-->
 
</head>
pylons_app/templates/monoblue_custom/header.tmpl
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" xml:lang="en" lang="en">
 
<head>
 
    <link rel="icon" href="{staticurl}hgicon.png" type="image/png" />
 
    <meta name="robots" content="index, nofollow"/>
 
    <link rel="stylesheet" href="{staticurl}style-monoblue.css" type="text/css" />
pylons_app/templates/monoblue_custom/index.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
    <title>{repo|escape}: Mercurial repositories index</title>
 
</head>
 

	
 
<body>
 
<div id="container">
pylons_app/templates/monoblue_custom/manifest.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<title>{repo|escape}: files</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
pylons_app/templates/monoblue_custom/notfound.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
    <title>{repo|escape}: Mercurial repository not found</title>
 
</head>
 

	
 
<body>
 
<div id="container">
pylons_app/templates/monoblue_custom/search.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
    <title>{repo|escape}: Search</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
pylons_app/templates/monoblue_custom/shortlog.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
    <title>{repo|escape}: shortlog</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
pylons_app/templates/monoblue_custom/summary.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
    <title>{repo|escape}: Summary</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
pylons_app/templates/monoblue_custom/tags.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
    <title>{repo|escape}: Tags</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
pylons_app/templates/monoblue_plain/changelog.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<div id="container">
 
    <div class="page-header">
 
        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / changelog</h1>
 

	
 
        <ul class="object-tools">
pylons_app/templates/monoblue_plain/changelogentry.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
<h3 class="changelog"><a class="title" href="{url}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape}<span class="logtags"> {inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}</span></a></h3>
 
    <h4>{date|age} ago, by {author|obfuscate} [{date|rfc822date}] rev {rev}</h4>
 
    <p>{desc|strip|escape|addbreaks}</p>
 
<hr/>
pylons_app/templates/monoblue_plain/changeset.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<div id="container">
 
    <div class="page-header">
 
        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / files</h1>
 

	
 
        <ul class="object-tools">
pylons_app/templates/monoblue_plain/error.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
    <title>{repo|escape}: Error</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
pylons_app/templates/monoblue_plain/fileannotate.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<div id="container">
 
    <div class="page-header">
 
        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / annotate</h1>
 

	
 
        <ul class="object-tools">
pylons_app/templates/monoblue_plain/filediff.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<div id="container">
 
    <div class="page-header">
 
        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / file diff</h1>
 

	
 
        <ul class="object-tools">
pylons_app/templates/monoblue_plain/filelog.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<div id="container">
 
    <div class="page-header">
 
        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / file revisions</h1>
 

	
 
        <ul class="object-tools">
pylons_app/templates/monoblue_plain/filerevision.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<div id="container">
 
    <div class="page-header">
 
        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / file revision</h1>
 

	
 
        <ul class="object-tools">
pylons_app/templates/monoblue_plain/footer.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
    <div class="page-footer">
 
        <p>
 
            Mercurial Repository: {repo|escape}
 
        </p>
 
        <ul class="object-tools">
 
            <li><a href="{url}rss-log">RSS</a></li>
pylons_app/templates/monoblue_plain/graph.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<!--[if IE]><script type="text/javascript" src="{staticurl}excanvas.js"></script><![endif]-->
 
<div id="container">
 
    <div class="page-header">
 
        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / graph</h1>
 

	
pylons_app/templates/monoblue_plain/header.tmpl
Show inline comments
 

	
 
## -*- coding: utf-8 -*-
pylons_app/templates/monoblue_plain/index.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<div id="container">
 
    <div class="page-header">
 
        <h1>Mercurial Repositories</h1>
 
    </div>
 

	
pylons_app/templates/monoblue_plain/manifest.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<div id="container">
 
    <div class="page-header">
 
        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / files</h1>
 

	
 
        <ul class="object-tools">
pylons_app/templates/monoblue_plain/notfound.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
    <title>{repo|escape}: Mercurial repository not found</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
pylons_app/templates/monoblue_plain/search.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
    <title>{repo|escape}: Search</title>
 
    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
 
    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
 
</head>
 

	
pylons_app/templates/monoblue_plain/shortlog.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<div id="container">
 
    <div class="page-header">
 
        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / shortlog</h1>
 

	
 
        <ul class="object-tools">
pylons_app/templates/monoblue_plain/summary.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<div id="container">
 
    <div class="page-header">
 
        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / summary</h1>
 

	
 
        <ul class="object-tools">
pylons_app/templates/monoblue_plain/tags.tmpl
Show inline comments
 
## -*- coding: utf-8 -*-
 
{header}
 
<div id="container">
 
    <div class="page-header">
 
        <h1><a href="{url}summary{sessionvars%urlparameter}">{repo|escape}</a> / tags</h1>
 

	
 
        <ul class="object-tools">
0 comments (0 inline, 0 general)