Changeset - 935dddee7422
[Not reviewed]
Merge celery
0 7 1
Marcin Kuzminski - 15 years ago 2010-09-11 03:42:57
marcin@python-works.com
merged with default
6 files changed:
0 comments (0 inline, 0 general)
pylons_app/config/environment.py
Show inline comments
 
@@ -46,16 +46,16 @@ def load_environment(global_conf, app_co
 
        module_directory=os.path.join(app_conf['cache_dir'], 'templates'),
 
        input_encoding='utf-8', default_filters=['escape'],
 
        imports=['from webhelpers.html import escape'])
 

	
 
    #sets the c attribute access when don't existing attribute are accessed
 
    config['pylons.strict_tmpl_context'] = True
 
    
 
    test = os.path.split(config['__file__'])[-1] == 'tests.ini'
 
    #MULTIPLE DB configs
 
    # Setup the SQLAlchemy database engine
 
    if config['debug'] and os.path.split(config['__file__'])[-1] != 'tests.ini':
 
    if config['debug'] and not test:
 
        #use query time debugging.
 
        from pylons_app.lib.timerproxy import TimerProxy
 
        sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.',
 
                                                            proxy=TimerProxy())
 
    else:
 
        sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.')
pylons_app/controllers/changeset.py
Show inline comments
 
@@ -85,12 +85,13 @@ class ChangesetController(BaseController
 
            
 
        return render('changeset/changeset.html')
 

	
 
    def raw_changeset(self,revision):
 
        
 
        hg_model = HgModel()
 
        method = request.GET.get('diff','show')
 
        try:
 
            c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision)
 
        except RepositoryError:
 
            log.error(traceback.format_exc())
 
            return redirect(url('hg_home'))
 
        else:
 
@@ -122,13 +123,14 @@ class ChangesetController(BaseController
 

	
 
                cs1 = filenode_old.last_changeset.raw_id
 
                cs2 = node.last_changeset.raw_id                    
 
                c.changes.append(('changed', node, diff, cs1, cs2))      
 
        
 
        response.content_type = 'text/plain'
 

	
 
        if method == 'download':
 
            response.content_disposition = 'attachment; filename=%s.patch' % revision 
 
        parent = True if len(c.changeset.parents) > 0 else False
 
        c.parent_tmpl = 'Parent  %s' % c.changeset.parents[0]._hex if parent else ''
 
    
 
        c.diffs = ''
 
        for x in c.changes:
 
            c.diffs += x[2]
pylons_app/templates/changeset/changeset.html
Show inline comments
 
@@ -20,12 +20,24 @@
 
<div class="box">
 
    <!-- box / title -->
 
    <div class="title">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <div class="table">
 
		<div id="body" class="diffblock">
 
			<div class="code-header">
 
				<div>
 
				${_('Changeset')} - r${c.changeset.revision}:${c.changeset.raw_id}
 
				 &raquo; <span>${h.link_to(_('raw diff'),
 
				h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='show'))}</span>
 
				 &raquo; <span>${h.link_to(_('download diff'),
 
				h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='download'))}</span>
 
				</div>
 
			</div>
 
		</div>
 
		    
 
    <div id="changeset_content">
 
		<div class="container">
 
			<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>
pylons_app/templates/changeset/raw_changeset.html
Show inline comments
 
# HG changeset patch
 
# User ${c.changeset.author}
 
# User ${c.changeset.author|n}
 
# Date ${"%d %d" % c.changeset._ctx.date()}
 
# Node ID ${c.changeset._hex}
 
# ${c.parent_tmpl}
 
${c.changeset.message}
 

	
 
${c.diffs|n}
 
\ No newline at end of file
pylons_app/tests/__init__.py
Show inline comments
 
@@ -28,13 +28,12 @@ environ = {}
 
class TestController(TestCase):
 

	
 
    def __init__(self, *args, **kwargs):
 
        wsgiapp = pylons.test.pylonsapp
 
        config = wsgiapp.config
 
        self.app = TestApp(wsgiapp)
 
        self.session = session
 
        url._push_object(URLGenerator(config['routes.map'], environ))
 
        self.sa = meta.Session
 
        TestCase.__init__(self, *args, **kwargs)
 

	
 
    
 
    def log_user(self):
pylons_app/tests/functional/test_search.py
Show inline comments
 
from pylons_app.tests import *
 
from pylons_app.lib.indexers import IDX_LOCATION
 
import os
 
from nose.plugins.skip import SkipTest
 

	
 
class TestSearchController(TestController):
 

	
 
    def test_index(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='search', action='index'))
 
        print response.body
 
        assert 'class="small" id="q" name="q" type="text"' in response.body,'Search box content error'
 
        # Test response...
 

	
 
    def test_empty_search(self):
 
        
 
        if os.path.isdir(IDX_LOCATION):
 
            raise SkipTest('skipped due to existing index')
 
        else:
 
            self.log_user()
 
            response = self.app.get(url(controller='search', action='index'),{'q':'vcs_test'})
 
            assert 'There is no index to search in. Please run whoosh indexer' in response.body,'No error message about empty index'
 
        
 
    def test_normal_search(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='search', action='index'),{'q':'vcs_test'})
 
        assert 'There is no index to search in. Please run whoosh indexer' in response.body,'No error message about empty index'
 
\ No newline at end of file
 
        response = self.app.get(url(controller='search', action='index'),{'q':'def+repo'})
 
        print response.body
 
        assert '9 results' in response.body,'no message about proper search results'
 
        

Changeset was too big and was cut off... Show full diff anyway

0 comments (0 inline, 0 general)