# HG changeset patch # User Marcin Kuzminski # Date 1284169377 -7200 # Node ID 935dddee7422dd464ef30a5db8b1aba42849f90d # Parent 3fc3ce53659bcaa8bed6b43e70940000db6e23ed# Parent e94f4e54dc03992b1252b5832a344b199ae5cd1a merged with default diff -r 3fc3ce53659b -r 935dddee7422 pylons_app/config/environment.py --- a/pylons_app/config/environment.py Sat Sep 11 01:55:46 2010 +0200 +++ b/pylons_app/config/environment.py Sat Sep 11 03:42:57 2010 +0200 @@ -49,10 +49,10 @@ #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.', diff -r 3fc3ce53659b -r 935dddee7422 pylons_app/controllers/changeset.py --- a/pylons_app/controllers/changeset.py Sat Sep 11 01:55:46 2010 +0200 +++ b/pylons_app/controllers/changeset.py Sat Sep 11 03:42:57 2010 +0200 @@ -88,6 +88,7 @@ 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: @@ -125,7 +126,8 @@ 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 '' diff -r 3fc3ce53659b -r 935dddee7422 pylons_app/templates/changeset/changeset.html --- a/pylons_app/templates/changeset/changeset.html Sat Sep 11 01:55:46 2010 +0200 +++ b/pylons_app/templates/changeset/changeset.html Sat Sep 11 03:42:57 2010 +0200 @@ -23,6 +23,18 @@ ${self.breadcrumbs()}
+
+
+
+ ${_('Changeset')} - r${c.changeset.revision}:${c.changeset.raw_id} + » ${h.link_to(_('raw diff'), + h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='show'))} + » ${h.link_to(_('download diff'), + h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='download'))} +
+
+
+
diff -r 3fc3ce53659b -r 935dddee7422 pylons_app/templates/changeset/raw_changeset.html --- a/pylons_app/templates/changeset/raw_changeset.html Sat Sep 11 01:55:46 2010 +0200 +++ b/pylons_app/templates/changeset/raw_changeset.html Sat Sep 11 03:42:57 2010 +0200 @@ -1,5 +1,5 @@ # 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} diff -r 3fc3ce53659b -r 935dddee7422 pylons_app/tests/__init__.py --- a/pylons_app/tests/__init__.py Sat Sep 11 01:55:46 2010 +0200 +++ b/pylons_app/tests/__init__.py Sat Sep 11 03:42:57 2010 +0200 @@ -31,7 +31,6 @@ 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) diff -r 3fc3ce53659b -r 935dddee7422 pylons_app/tests/functional/test_search.py --- a/pylons_app/tests/functional/test_search.py Sat Sep 11 01:55:46 2010 +0200 +++ b/pylons_app/tests/functional/test_search.py Sat Sep 11 03:42:57 2010 +0200 @@ -1,4 +1,7 @@ from pylons_app.tests import * +from pylons_app.lib.indexers import IDX_LOCATION +import os +from nose.plugins.skip import SkipTest class TestSearchController(TestController): @@ -10,6 +13,17 @@ # 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' + diff -r 3fc3ce53659b -r 935dddee7422 pylons_app/tests/vcs_test.tar.gz Binary file pylons_app/tests/vcs_test.tar.gz has changed diff -r 3fc3ce53659b -r 935dddee7422 pylons_app/websetup.py --- a/pylons_app/websetup.py Sat Sep 11 01:55:46 2010 +0200 +++ b/pylons_app/websetup.py Sat Sep 11 03:42:57 2010 +0200 @@ -8,7 +8,8 @@ import logging import os import sys -import shutil +import tarfile + log = logging.getLogger(__name__) ROOT = dn(dn(os.path.realpath(__file__))) @@ -28,8 +29,10 @@ if not os.path.isdir(REPO_TEST_PATH): os.mkdir(REPO_TEST_PATH) - from_ = '/home/marcink/workspace-python/vcs' - shutil.copytree(from_, os.path.join(REPO_TEST_PATH,'vcs_test')) + cur_dir = dn(os.path.abspath(__file__)) + tar = tarfile.open(jn(cur_dir,'tests',"vcs_test.tar.gz")) + tar.extractall(REPO_TEST_PATH) + tar.close() tests = True