You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/04/01 16:27:20 UTC

[01/40] git commit: Added test for forks listing

Updated Branches:
  refs/heads/cj/5963 9dc959330 -> 07861f4a4 (forced update)


Added test for forks listing


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/db0dd9ce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/db0dd9ce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/db0dd9ce

Branch: refs/heads/cj/5963
Commit: db0dd9ce1f14adf970799d16c29cbf367b1be4f3
Parents: a09148c
Author: Wayne Witzel III <ww...@geek.net>
Authored: Wed Mar 20 21:36:38 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 18:15:12 2013 +0000

----------------------------------------------------------------------
 .../forgegit/tests/functional/test_controllers.py  |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/db0dd9ce/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index e77f210..84b0133 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -351,6 +351,10 @@ class TestFork(_TestCase):
         assert mr_num.isdigit(), mr_num
         return r, mr_num
 
+    def test_forks_list(self):
+        r = self.app.get('%sforks/' % c.app.repo.url())
+        assert 'test2 / code' in r
+
     def test_fork_form(self):
         r = self.app.get('%sfork/' % c.app.repo.url())
         assert '<input type="text" name="mount_point" value="test"/>' in r


[39/40] git commit: [#5963] ticket:305 Code snapshot status check changes

Posted by jo...@apache.org.
[#5963] ticket:305 Code snapshot status check changes


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5105ac33
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5105ac33
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5105ac33

Branch: refs/heads/cj/5963
Commit: 5105ac3318739d1f3b5664204918aa6ba94013ea
Parents: 9110fed
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Fri Mar 22 13:49:08 2013 +0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Mar 29 18:18:41 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/repository.py                  |   28 +++++++-------
 Allura/allura/tasks/repo_tasks.py                  |    3 --
 Allura/allura/templates/repo/tarball.html          |    9 ++++-
 Allura/allura/tests/test_tasks.py                  |    6 ---
 ForgeGit/forgegit/model/git_repo.py                |   13 ++++---
 .../forgegit/tests/functional/test_controllers.py  |    7 ----
 ForgeGit/forgegit/tests/model/test_repository.py   |   19 ++++++++++
 ForgeSVN/forgesvn/model/svn.py                     |   10 +++---
 8 files changed, 52 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5105ac33/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index d6f843d..aed4363 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -208,7 +208,6 @@ class Repository(Artifact, ActivityObject):
     branches = FieldProperty([dict(name=str,object_id=str, count=int)])
     repo_tags = FieldProperty([dict(name=str,object_id=str, count=int)])
     upstream_repo = FieldProperty(dict(name=str,url=str))
-    tarball_status = FieldProperty([dict(revision=str, status=str)])
 
     def __init__(self, **kw):
         if 'name' in kw and 'tool' in kw:
@@ -240,10 +239,14 @@ class Repository(Artifact, ActivityObject):
                             self.project.shortname,
                             self.name)
 
-    def tarball_url(self, revision):
+    def tarball_filename(self, revision):
         shortname = c.app.repo.project.shortname.replace('/', '-')
         mount_point = c.app.repo.app.config.options.mount_point
-        filename = '%s-%s-%s.tar.gz' % (shortname, mount_point, revision)
+        filename = '%s-%s-%s' % (shortname, mount_point, revision)
+        return filename
+
+    def tarball_url(self, revision):
+        filename = '%s%s' % (self.tarball_filename(revision), '.tar.gz')
         r = os.path.join(self.tool,
                          self.project.shortname[:1],
                          self.project.shortname[:2],
@@ -253,17 +256,14 @@ class Repository(Artifact, ActivityObject):
         return urljoin(tg.config.get('scm.repos.tarball.url_prefix', '/'), r)
 
     def get_tarball_status(self, revision):
-        tarballs = dict((t.revision, t.status) for t in self.tarball_status)
-        return tarballs.get(revision)
-
-    def set_tarball_status(self, revision, status):
-        for tarball in self.tarball_status:
-            if tarball['revision'] == revision:
-                tarball['status'] = status
-                session(self).flush(self)
-                return
-        self.tarball_status.append(dict(revision=revision, status=status))
-        session(self).flush(self)
+        pathname = os.path.join(self.tarball_path, self.tarball_filename(revision))
+        filename = '%s%s' % (pathname, '.tar.gz')
+        tmpfilename = '%s%s' % (pathname, '.tmp')
+
+        if os.path.isfile(filename):
+            return 'ready'
+        elif os.path.isfile(tmpfilename) or os.path.isdir(pathname):
+            return 'busy'
 
     def __repr__(self): # pragma no cover
         return '<%s %s>' % (

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5105ac33/Allura/allura/tasks/repo_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/repo_tasks.py b/Allura/allura/tasks/repo_tasks.py
index 4eff18d..03ce1f2 100644
--- a/Allura/allura/tasks/repo_tasks.py
+++ b/Allura/allura/tasks/repo_tasks.py
@@ -108,12 +108,9 @@ def tarball(revision=None):
     log = logging.getLogger(__name__)
     if revision:
         repo = c.app.repo
-        repo.set_tarball_status(revision, 'busy')
         try:
             repo.tarball(revision)
-            repo.set_tarball_status(revision, 'ready')
         except:
-            repo.set_tarball_status(revision, None)
             log.error('Could not create tarball for repository %s:%s revision %s' % (c.project.shortname, c.app.config.options.mount_point, revision), exc_info=True)
     else:
         log.warn('Creation of tarball for %s:%s skipped because revision is not specified' % (c.project.shortname, c.app.config.options.mount_point))

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5105ac33/Allura/allura/templates/repo/tarball.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/tarball.html b/Allura/allura/templates/repo/tarball.html
index c312d8b..c5e071d 100644
--- a/Allura/allura/templates/repo/tarball.html
+++ b/Allura/allura/templates/repo/tarball.html
@@ -34,20 +34,25 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
             left: 10 // Left position relative to parent in px
         };
         var spinner = new Spinner(opts).spin($('#snapshot_status')[0]);
+        var delay = 5000
         // Check tarball status every 5 seconds
         function check_status() {
             $.get('{{commit.url()}}tarball_status', function(data) {
                 if (data.status === 'ready') {
-                    window.clearInterval(status_checker);
                     spinner.stop();
                     $('#snapshot_status h2').toggle();
                     {% if 'no-redirect' not in request.params %}
                         window.location.href = '{{c.app.repo.tarball_url(revision)}}';
                     {% endif %}
+                } else {
+                    if (delay < 600000){
+                        delay = delay * 2
+                    }
+                    window.setTimeout(check_status, delay);
                 }
             });
         }
-        var status_checker = window.setInterval(check_status, 5000);
+        window.setTimeout(check_status, delay);
     {% endif %}
 });
 </script>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5105ac33/Allura/allura/tests/test_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_tasks.py b/Allura/allura/tests/test_tasks.py
index 9e16bfb..74a09d0 100644
--- a/Allura/allura/tests/test_tasks.py
+++ b/Allura/allura/tests/test_tasks.py
@@ -38,12 +38,6 @@ class TestRepoTasks(unittest.TestCase):
         assert_equal(post_event.call_args[0][2], None)
         # ignore args[3] which is a traceback string
 
-    @mock.patch('allura.tasks.repo_tasks.c.app.repo.set_tarball_status')
-    def test_repo_tarball(self,st):
-        repo_tasks.tarball('HEAD')
-        calls = [mock.call('HEAD', 'busy'), mock.call('HEAD', 'ready')]
-        st.assert_has_calls(calls, any_order=True)
-
 
 class TestEventTasks(unittest.TestCase):
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5105ac33/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index c660d69..27fc8e4 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -324,14 +324,15 @@ class GitImplementation(M.RepositoryImplementation):
         return tree._id
 
     def tarball(self, commit):
-        shortname = self._repo.project.shortname.replace('/', '-')
-        mount_point = self._repo.app.config.options.mount_point
         if not os.path.exists(self._repo.tarball_path):
             os.makedirs(self._repo.tarball_path)
-        archive_name = '%s-%s-%s' % (shortname, mount_point, commit)
-        filename = os.path.join(self._repo.tarball_path, archive_name + '.tar.gz')
-        with gzip.open(filename, 'w') as fp:
-            self._git.archive(fp, format='tar', treeish=commit, prefix=archive_name+'/')
+        archive_name = self._repo.tarball_filename(commit)
+        filename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.tar.gz'))
+        tmpfilename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.tmp'))
+        with gzip.open(tmpfilename, 'w') as fp:
+            self._git.archive(fp, format='tar', treeish=commit, prefix=archive_name + '/')
+        os.rename(tmpfilename, filename)
+
 
 class _OpenedGitBlob(object):
     CHUNK_SIZE=4096

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5105ac33/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 84b0133..1c8e0df 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -290,13 +290,6 @@ class TestRootController(_TestCase):
         r = self.app.get(ci + 'tarball_status')
         assert '{"status": "ready"}' in r
 
-    def test_tarball_status(self):
-        assert_equal(c.app.repo.get_tarball_status('1e146e67985dcd71c74de79613719bef7bddca4a'), None)
-        c.app.repo.set_tarball_status('1e146e67985dcd71c74de79613719bef7bddca4a', 'ready')
-        c.app.repo.set_tarball_status('df30427c488aeab84b2352bdf88a3b19223f9d7a', 'busy')
-        assert_equal(c.app.repo.get_tarball_status('1e146e67985dcd71c74de79613719bef7bddca4a'), 'ready')
-        assert_equal(c.app.repo.get_tarball_status('df30427c488aeab84b2352bdf88a3b19223f9d7a'), 'busy')
-
 
 class TestRestController(_TestCase):
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5105ac33/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 6258251..59416c8 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -240,6 +240,8 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
         self.assertEqual(new_tree.other_ids, orig_tree.other_ids)
 
     def test_tarball(self):
+        if os.path.isfile("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tar.gz"):
+            os.remove("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tar.gz")
         assert_equal(self.repo.tarball_path, '/tmp/tarball/git/t/te/test/testgit.git')
         assert_equal(self.repo.tarball_url('HEAD'), 'file:///git/t/te/test/testgit.git/test-src-git-HEAD.tar.gz')
         self.repo.tarball('HEAD')
@@ -260,6 +262,23 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
                     'summary': u'Change README'},
                 'name': u'README'}])
 
+    def test_tarball_status(self):
+        if os.path.isfile("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tar.gz"):
+            os.remove("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tar.gz")
+        if os.path.isfile("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tmp"):
+            os.remove("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tmp")
+        if os.path.isdir("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD/"):
+            os.removedirs("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD/")
+        self.repo.tarball('HEAD')
+        assert_equal(self.repo.get_tarball_status('HEAD'), 'ready')
+        os.rename("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tar.gz",
+                  "/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tmp")
+        assert_equal(self.repo.get_tarball_status('HEAD'), 'busy')
+        os.remove("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tmp")
+        assert_equal(self.repo.get_tarball_status('HEAD'), None)
+        os.makedirs("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD")
+        assert_equal(self.repo.get_tarball_status('HEAD'), 'busy')
+
 
 class TestGitCommit(unittest.TestCase):
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5105ac33/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 7c7515a..902c829 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -611,8 +611,6 @@ class SVNImplementation(M.RepositoryImplementation):
         return entries
 
     def tarball(self, commit):
-        shortname = self._repo.project.shortname.replace('/', '-')
-        mount_point = self._repo.app.config.options.mount_point
         if not os.path.exists(self._repo.tarball_path):
             os.makedirs(self._repo.tarball_path)
         path = os.path.join(self._repo.tarball_path, commit)
@@ -621,11 +619,13 @@ class SVNImplementation(M.RepositoryImplementation):
         self._svn.export(self._url,
                          path,
                          revision=pysvn.Revision(pysvn.opt_revision_kind.number, commit))
-        archive_name = '%s-%s-%s' % (shortname, mount_point, commit)
-        filename = os.path.join(self._repo.tarball_path, archive_name + '.tar.gz')
-        with tarfile.open(filename, "w:gz") as tar:
+        archive_name = self._repo.tarball_filename(commit)
+        filename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.tar.gz'))
+        tmpfilename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.tmp'))
+        with tarfile.open(tmpfilename, "w:gz") as tar:
             tar.add(path, arcname=archive_name)
         rmtree(path)
+        os.rename(tmpfilename, filename)
 
 
 Mapper.compile_all()


[24/40] git commit: [#2835] support old title_s in results, so reindexing is not required

Posted by jo...@apache.org.
[#2835] support old title_s in results, so reindexing is not required


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/aced859b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/aced859b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/aced859b

Branch: refs/heads/cj/5963
Commit: aced859b5141eaab9560998b1b2d6c581011df58
Parents: f211493
Author: Dave Brondsema <db...@geek.net>
Authored: Tue Mar 26 20:57:21 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 21:02:17 2013 +0000

----------------------------------------------------------------------
 Allura/allura/templates/search_index.html          |    4 +++-
 .../allura/templates/widgets/search_results.html   |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aced859b/Allura/allura/templates/search_index.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/search_index.html b/Allura/allura/templates/search_index.html
index 6fd2107..8452ce8 100644
--- a/Allura/allura/templates/search_index.html
+++ b/Allura/allura/templates/search_index.html
@@ -27,7 +27,9 @@
   <ol>
   {% for doc in results %}
   <li>
-    <a href="{{doc['url_s']}}">{{h.get_first(doc, 'title')}}</a>
+    <a href="{{doc['url_s']}}">
+       {{- h.get_first(doc, 'title') or h.get_first(doc, 'title_s') -}}  {#-  title_s is legacy -#}
+    </a>
     {% if doc.get('snippet') %}
       <p>{{doc['snippet']|safe}}</p>
     {% endif %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aced859b/Allura/allura/templates/widgets/search_results.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/search_results.html b/Allura/allura/templates/widgets/search_results.html
index d1067cc..b586dec 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -41,7 +41,9 @@
   <div class="grid-19">
     {# TODO: mark matches in title and snippet #}
     <p>
-    <a href="{{doc['url_paginated'] or doc['url_s']}}">{{ h.get_first(doc, 'title') }}</a>
+    <a href="{{doc['url_paginated'] or doc['url_s']}}">
+       {{- h.get_first(doc, 'title') or h.get_first(doc, 'title_s') -}}  {#-  title_s is legacy -#}
+    </a>
     {% if doc['type_s'] %}<span class="gray"><sup>{{ '(%s)' % doc['type_s'] }}</sup></span>{% endif %}
     <br>
     {{ doc.snippet }}


[33/40] git commit: [#6020] ok to have a print in import_api.py

Posted by jo...@apache.org.
[#6020] ok to have a print in import_api.py


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/699e9b88
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/699e9b88
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/699e9b88

Branch: refs/heads/cj/5963
Commit: 699e9b88093a24ea0d683c80a2a09f6bc2a8c329
Parents: e8161e6
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Mar 28 21:25:00 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Mar 28 21:25:00 2013 +0000

----------------------------------------------------------------------
 AlluraTesting/alluratest/test_syntax.py |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/699e9b88/AlluraTesting/alluratest/test_syntax.py
----------------------------------------------------------------------
diff --git a/AlluraTesting/alluratest/test_syntax.py b/AlluraTesting/alluratest/test_syntax.py
index a3f7a4a..902574d 100644
--- a/AlluraTesting/alluratest/test_syntax.py
+++ b/AlluraTesting/alluratest/test_syntax.py
@@ -65,10 +65,9 @@ def test_no_prints():
         'Allura/ldap-setup.py',
         'Allura/ldap-userconfig.py',
         'Allura/ez_setup/',
-        'Allura/push_re.py',
         'Allura/allura/lib/AsciiDammit.py',
         '/scripts/',
-        'ForgeMail/forgemail/sstress.py',
+        'Allura/allura/lib/import_api.py',
     ]
     if run(find_py + " | grep -v '" + "' | grep -v '".join(skips) + "' | xargs grep -v '^ *#' | grep 'print ' | grep -E -v '(pprint|#pragma: ?printok)' ") != 1:
         raise Exception("These should use logging instead of print")


[02/40] git commit: Remove fork listing from changehistory page

Posted by jo...@apache.org.
Remove fork listing from changehistory page


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/a09148cf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/a09148cf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/a09148cf

Branch: refs/heads/cj/5963
Commit: a09148cfcb1bdda431d935c5498ea33f892352e1
Parents: d2678d1
Author: Wayne Witzel III <ww...@geek.net>
Authored: Mon Mar 18 21:40:03 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 18:15:12 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py |   15 +++++++++++++++
 Allura/allura/lib/repository.py         |   12 ++++--------
 Allura/allura/templates/repo/forks.html |   13 +++++++++++++
 3 files changed, 32 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a09148cf/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index d0c5a26..e110e10 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -34,6 +34,7 @@ from allura.lib.widgets import form_fields as ffw
 from allura.controllers.base import DispatchIndex
 from allura.lib.diff import HtmlSideBySideDiff
 from paste.deploy.converters import asbool
+from allura.app import SitemapEntry
 from .base import BaseController
 
 log = logging.getLogger(__name__)
@@ -58,6 +59,20 @@ class RepoRootController(BaseController):
         redirect(url(quote('%s%s/' % (
                         branch, c.app.END_OF_REF_ESCAPE))))
 
+    @with_trailing_slash
+    @expose('jinja:allura:templates/repo/forks.html')
+    def forks(self):
+
+        links = []
+        if c.app.repo.forks:
+            for f in c.app.repo.forks:
+                repo_path_parts = f.url().strip('/').split('/')
+                links.append(dict(
+                    repo_url=f.url(),
+                    repo = '%s / %s' % (repo_path_parts[1], repo_path_parts[-1]),
+                ))
+        return dict(links=links)
+
     @expose()
     def refresh(self):
         allura.tasks.repo_tasks.refresh.post()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a09148cf/Allura/allura/lib/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/repository.py b/Allura/allura/lib/repository.py
index 383ef30..7fbb0bb 100644
--- a/Allura/allura/lib/repository.py
+++ b/Allura/allura/lib/repository.py
@@ -96,6 +96,10 @@ class RepositoryApp(Application):
                 SitemapEntry(
                     'Merge Requests', c.app.url + 'merge-requests/',
                     small=merge_request_count) ]
+        if self.repo.forks:
+            links += [
+                SitemapEntry('Forks', c.app.url + 'forks/', small=len(self.repo.forks))
+            ]
         if self.repo.upstream_repo.name:
             repo_path_parts = self.repo.upstream_repo.name.strip('/').split('/')
             links += [
@@ -135,14 +139,6 @@ class RepositoryApp(Application):
                             default_branch_url+'tags/',
                             ))
                     break
-        if self.repo.forks:
-            links.append(SitemapEntry('Forks'))
-            for f in self.repo.forks:
-                repo_path_parts = f.url().strip('/').split('/')
-                links.append(SitemapEntry(
-                    '%s / %s' %
-                    (repo_path_parts[1], repo_path_parts[-1]),
-                    f.url()))
         return links
 
     def install(self, project):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a09148cf/Allura/allura/templates/repo/forks.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/forks.html b/Allura/allura/templates/repo/forks.html
new file mode 100644
index 0000000..a8cb7b8
--- /dev/null
+++ b/Allura/allura/templates/repo/forks.html
@@ -0,0 +1,13 @@
+{% extends 'allura:templates/repo/repo_master.html' %}
+
+{% block title %}{{c.project.name}} / {{c.app.config.options.mount_label}} / Forks{% endblock %}
+
+{% block header %}Forks{% endblock %}
+
+{% block content %}
+<ul>
+{% for link in links %}
+<li><a href="{{link.repo_url}}">{{link.repo}}</a></li>
+{% endfor %}
+</ul>
+{% endblock %}


[10/40] git commit: [#2835] ticket:287 Add ago_string helper

Posted by jo...@apache.org.
[#2835] ticket:287 Add ago_string helper


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/556cfdbd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/556cfdbd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/556cfdbd

Branch: refs/heads/cj/5963
Commit: 556cfdbde2a4b382a7003889432d634aca21b56b
Parents: 5b1eba0
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 15:39:17 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:35 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/helpers.py        |    6 ++++++
 Allura/allura/tests/test_helpers.py |    4 ++++
 2 files changed, 10 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/556cfdbd/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index d078072..5e32882 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -269,6 +269,12 @@ def ago(start_time):
 def ago_ts(timestamp):
     return ago(datetime.utcfromtimestamp(timestamp))
 
+def ago_string(s):
+    try:
+        return ago(parse(s, ignoretz=True))
+    except (ValueError, AttributeError):
+        return 'unknown'
+
 class DateTimeConverter(FancyValidator):
 
     def _to_python(self, value, state):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/556cfdbd/Allura/allura/tests/test_helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_helpers.py b/Allura/allura/tests/test_helpers.py
index 4eaa7ec..8407ef4 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -94,6 +94,10 @@ def test_ago():
     import time
     assert_equals(h.ago(datetime.utcnow() - timedelta(days=2)), '2 days ago')
     assert_equals(h.ago_ts(time.time() - 60*60*2), '2 hours ago')
+    d_str = (datetime.utcnow() - timedelta(hours=3)).isoformat()
+    assert_equals(h.ago_string(d_str), '3 hours ago')
+    assert_equals(h.ago_string('bad format'), 'unknown')
+    assert_equals(h.ago_string(None), 'unknown')
 
 def test_urlquote_unicode():
     # No exceptions please


[32/40] git commit: Check if the document to import has trackers or is just a list of tickets

Posted by jo...@apache.org.
Check if the document to import has trackers or is just a list of
tickets

When exporting with trac_export.py the tickets are the top level list of
objects in the JSON dump.


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5a3ff203
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5a3ff203
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5a3ff203

Branch: refs/heads/cj/5963
Commit: 5a3ff203beeab56516d812886a74a3a8a61893d4
Parents: 5c07930
Author: Jon Schewe <jp...@mtu.net>
Authored: Tue Mar 26 18:30:15 2013 -0500
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Mar 28 20:42:12 2013 +0000

----------------------------------------------------------------------
 scripts/allura_import.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5a3ff203/scripts/allura_import.py
----------------------------------------------------------------------
diff --git a/scripts/allura_import.py b/scripts/allura_import.py
index 1dd151c..e6982b2 100644
--- a/scripts/allura_import.py
+++ b/scripts/allura_import.py
@@ -66,8 +66,13 @@ def import_tracker(cli, project, tool, import_options, options, doc_txt, validat
             existing_map[t['ticket_num']] = t['summary']
 
     doc = json.loads(doc_txt)
-    tickets_in = doc['trackers']['default']['artifacts']
-    doc['trackers']['default']['artifacts'] = []
+
+    if 'trackers' in doc and 'default' in doc['trackers'] and 'artifacts' in doc['trackers']['default']:
+        tickets_in = doc['trackers']['default']['artifacts']
+        doc['trackers']['default']['artifacts'] = []
+    else:
+        tickets_in = doc
+        
     if options.verbose:
         print "Processing %d tickets" % len(tickets_in)
 


[25/40] git commit: format capabilities in the same format needed to input a new one

Posted by jo...@apache.org.
format capabilities in the same format needed to input a new one


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/6f44f8ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6f44f8ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6f44f8ac

Branch: refs/heads/cj/5963
Commit: 6f44f8ac15258194e9c6d03774d7bfa2682a2b38
Parents: aced859
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Mar 28 16:47:03 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Mar 28 16:47:03 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/site_admin_api_tickets.html   |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6f44f8ac/Allura/allura/templates/site_admin_api_tickets.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_api_tickets.html b/Allura/allura/templates/site_admin_api_tickets.html
index 3aaf37c..4f82fb2 100644
--- a/Allura/allura/templates/site_admin_api_tickets.html
+++ b/Allura/allura/templates/site_admin_api_tickets.html
@@ -33,7 +33,7 @@
 <tr>
 <td>{{token.user.username}}</td>
 <td>{{token.expires}}</td>
-<td>{{token.capabilities}}</td>
+<td>{{h.json.dumps(token.capabilities)}}</td>
 <td></td>
 </tr>
 <tr>


[40/40] git commit: [#5963] Minor fixups to code-snapshots

Posted by jo...@apache.org.
[#5963] Minor fixups to code-snapshots

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/07861f4a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/07861f4a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/07861f4a

Branch: refs/heads/cj/5963
Commit: 07861f4a485fa8c4fd199e8932f25defc7bb218e
Parents: 5105ac3
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Fri Mar 29 15:15:42 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Mar 29 18:18:41 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/repository.py                |    6 ++--
 ForgeGit/forgegit/model/git_repo.py              |   10 +++++--
 ForgeGit/forgegit/tests/model/test_repository.py |    2 +-
 ForgeSVN/forgesvn/model/svn.py                   |   22 ++++++++++-------
 4 files changed, 24 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/07861f4a/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index aed4363..6ca3a31 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -240,8 +240,8 @@ class Repository(Artifact, ActivityObject):
                             self.name)
 
     def tarball_filename(self, revision):
-        shortname = c.app.repo.project.shortname.replace('/', '-')
-        mount_point = c.app.repo.app.config.options.mount_point
+        shortname = c.project.shortname.replace('/', '-')
+        mount_point = c.app.config.options.mount_point
         filename = '%s-%s-%s' % (shortname, mount_point, revision)
         return filename
 
@@ -262,7 +262,7 @@ class Repository(Artifact, ActivityObject):
 
         if os.path.isfile(filename):
             return 'ready'
-        elif os.path.isfile(tmpfilename) or os.path.isdir(pathname):
+        elif os.path.isfile(tmpfilename):
             return 'busy'
 
     def __repr__(self): # pragma no cover

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/07861f4a/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 27fc8e4..d7c9d49 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -329,9 +329,13 @@ class GitImplementation(M.RepositoryImplementation):
         archive_name = self._repo.tarball_filename(commit)
         filename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.tar.gz'))
         tmpfilename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.tmp'))
-        with gzip.open(tmpfilename, 'w') as fp:
-            self._git.archive(fp, format='tar', treeish=commit, prefix=archive_name + '/')
-        os.rename(tmpfilename, filename)
+        try:
+            with gzip.open(tmpfilename, 'w') as fp:
+                self._git.archive(fp, format='tar', treeish=commit, prefix=archive_name + '/')
+            os.rename(tmpfilename, filename)
+        finally:
+            if os.path.exists(tmpfilename):
+                os.remove(tmpfilename)
 
 
 class _OpenedGitBlob(object):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/07861f4a/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 59416c8..fbcfaa0 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -277,7 +277,7 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
         os.remove("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tmp")
         assert_equal(self.repo.get_tarball_status('HEAD'), None)
         os.makedirs("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD")
-        assert_equal(self.repo.get_tarball_status('HEAD'), 'busy')
+        assert_equal(self.repo.get_tarball_status('HEAD'), None)
 
 
 class TestGitCommit(unittest.TestCase):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/07861f4a/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 902c829..171c709 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -614,18 +614,22 @@ class SVNImplementation(M.RepositoryImplementation):
         if not os.path.exists(self._repo.tarball_path):
             os.makedirs(self._repo.tarball_path)
         path = os.path.join(self._repo.tarball_path, commit)
-        if os.path.exists(path):
-            rmtree(path)
-        self._svn.export(self._url,
-                         path,
-                         revision=pysvn.Revision(pysvn.opt_revision_kind.number, commit))
         archive_name = self._repo.tarball_filename(commit)
         filename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.tar.gz'))
         tmpfilename = os.path.join(self._repo.tarball_path, '%s%s' % (archive_name, '.tmp'))
-        with tarfile.open(tmpfilename, "w:gz") as tar:
-            tar.add(path, arcname=archive_name)
-        rmtree(path)
-        os.rename(tmpfilename, filename)
+        if os.path.exists(path):
+            rmtree(path)
+        try:
+            self._svn.export(self._url,
+                             path,
+                             revision=pysvn.Revision(pysvn.opt_revision_kind.number, commit))
+            with tarfile.open(tmpfilename, "w:gz") as tar:
+                tar.add(path, arcname=archive_name)
+            os.rename(tmpfilename, filename)
+        finally:
+            rmtree(path)
+            if os.path.exists(tmpfilename):
+                os.remove(tmpfilename)
 
 
 Mapper.compile_all()


[08/40] git commit: [#2835] ticket:287 Center radiobuttons and checkboxes

Posted by jo...@apache.org.
[#2835] ticket:287 Center radiobuttons and checkboxes


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/c8cbb93f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/c8cbb93f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/c8cbb93f

Branch: refs/heads/cj/5963
Commit: c8cbb93ff3df63130e1291c0cabe20c2e4dddb01
Parents: c3db268
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Mar 6 09:08:35 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:35 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/widgets/resources/css/search.css |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c8cbb93f/Allura/allura/lib/widgets/resources/css/search.css
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/css/search.css b/Allura/allura/lib/widgets/resources/css/search.css
index 8d4f308..614bc01 100644
--- a/Allura/allura/lib/widgets/resources/css/search.css
+++ b/Allura/allura/lib/widgets/resources/css/search.css
@@ -5,3 +5,8 @@ input.search-query {
 .date {
   color: #aaa;
 }
+
+input[type="radio"],
+input[type="checkbox"] {
+  vertical-align: middle;
+}


[34/40] git commit: [#5978] Fixed guess_repo being called for rendering SCM trees

Posted by jo...@apache.org.
[#5978] Fixed guess_repo being called for rendering SCM trees

Signed-off-by: Cory Johns <jo...@geek.net>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/789d7b84
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/789d7b84
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/789d7b84

Branch: refs/heads/cj/5963
Commit: 789d7b84c8ab02cc8616141d3fb2cc0e35520907
Parents: 699e9b8
Author: Cory Johns <jo...@geek.net>
Authored: Tue Mar 26 22:38:56 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Mar 29 14:30:14 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/repo.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/789d7b84/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 3df5f59..40f4567 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -532,6 +532,8 @@ class Tree(RepoObject):
             return []
         commit_ids = [e.commit_id for e in lcd.entries]
         commits = Commit.query.find(dict(_id={'$in': commit_ids}))
+        for commit in commits:
+            commit.set_context(self.repo)
         commit_infos = {c._id: c.info for c in commits}
         by_name = lambda n: n.name
         tree_names = sorted([n.name for n in self.tree_ids])


[11/40] git commit: [#2835] ticket:288 Search comments option

Posted by jo...@apache.org.
[#2835] ticket:288 Search comments option


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/cf33bec6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/cf33bec6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/cf33bec6

Branch: refs/heads/cj/5963
Commit: cf33bec6cb977bb4eba09292149a410bee6ecc16
Parents: 8797294
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 7 12:50:26 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:36 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/widgets/search_results.html   |    3 ++-
 ForgeWiki/forgewiki/wiki_main.py                   |   15 ++++++++++-----
 2 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cf33bec6/Allura/allura/templates/widgets/search_results.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/search_results.html b/Allura/allura/templates/widgets/search_results.html
index 74eb466..4cfc891 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -20,8 +20,9 @@
   </div>
   <div class="grid-9">
     {% if not search_comments_disable %}
+      {% set comments = request.GET['search_comments'] %}
       <label for="search-comments">Search comments?</label>
-      <input id="search-comments" type="checkbox" name="search_comments"{% if search_comments %} checked{% endif %}>
+      <input id="search-comments" type="checkbox" name="search_comments"{% if comments %} checked{% endif %}>
     {% endif %}
     <label for="search-history">Search history?</label>
     <input id="search-history" type="checkbox" name="history"{% if history %} checked{% endif %}>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cf33bec6/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index e5482ea..0b0f143 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -292,8 +292,9 @@ class RootController(BaseController, DispatchIndex):
     @expose('jinja:forgewiki:templates/wiki/search.html')
     @validate(dict(q=validators.UnicodeString(if_empty=None),
                    history=validators.StringBool(if_empty=False),
+                   search_comments=validators.StringBool(if_empty=False),
                    project=validators.StringBool(if_empty=False)))
-    def search(self, q=None, history=None, project=None, limit=None, page=0, **kw):
+    def search(self, q=None, history=None, search_comments=None, project=None, limit=None, page=0, **kw):
         'local wiki search'
         if project:
             redirect(c.project.url() + 'search?' + urlencode(dict(q=q, history=history)))
@@ -307,15 +308,19 @@ class RootController(BaseController, DispatchIndex):
             # Match on both `title` and `text` by default, using 'dismax' parser.
             # Score on `title` matches is boosted, so title match is better than body match.
             # It's 'fuzzier' than standard parser, which matches only on `text`.
+            allowed_types = ['WikiPage', 'WikiPage Snapshot']
+            if search_comments:
+                allowed_types += ['Post', 'Post Snapshot']
             search_params = {
                 'qt': 'dismax',
                 'qf': 'title^2 text',
                 'pf': 'title^2 text',
                 'fq': [
-                    'project_id_s:%s' % c.project._id,
-                    'mount_point_s:%s'% c.app.config.options.mount_point,
-                    '-deleted_b:true'
-                ]
+                    'project_id_s:%s'  % c.project._id,
+                    'mount_point_s:%s' % c.app.config.options.mount_point,
+                    '-deleted_b:true',
+                    'type_s:(%s)' % ' OR '.join(['"%s"' % t for t in allowed_types])
+                ],
             }
             if not history:
                search_params['fq'].append('is_history_b:False')


[17/40] git commit: [#2835] ticket:288 Add `version=N` to the urls

Posted by jo...@apache.org.
[#2835] ticket:288 Add `version=N` to the urls


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/cd839bb6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/cd839bb6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/cd839bb6

Branch: refs/heads/cj/5963
Commit: cd839bb65bea2d7c5c1109ef85a48d75bf705af5
Parents: cf33bec
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 7 13:13:03 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:37 2013 +0000

----------------------------------------------------------------------
 ForgeWiki/forgewiki/wiki_main.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cd839bb6/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 0b0f143..15f86ec 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -3,6 +3,7 @@ import logging
 from pprint import pformat
 from urllib import urlencode, unquote
 from datetime import datetime
+from itertools import imap
 
 # Non-stdlib imports
 from tg import expose, validate, redirect, response, flash
@@ -310,7 +311,7 @@ class RootController(BaseController, DispatchIndex):
             # It's 'fuzzier' than standard parser, which matches only on `text`.
             allowed_types = ['WikiPage', 'WikiPage Snapshot']
             if search_comments:
-                allowed_types += ['Post', 'Post Snapshot']
+                allowed_types += ['Post']
             search_params = {
                 'qt': 'dismax',
                 'qf': 'title^2 text',
@@ -330,7 +331,14 @@ class RootController(BaseController, DispatchIndex):
                     rows=limit, start=start, **search_params)
             except SolrError as e:
                 search_error = e
-            if results: count=results.hits
+            if results:
+                count=results.hits
+                def historize_urls(doc):
+                    if doc.get('type_s', '').endswith(' Snapshot'):
+                        if doc.get('url_s'):
+                            doc['url_s'] = doc['url_s'] + '?version=%s' % doc.get('version_i')
+                    return doc
+                results = imap(historize_urls, results)
         c.search_results = W.search_results
         return dict(q=q, history=history, results=results or [],
                     count=count, limit=limit, page=page, search_error=search_error)


[18/40] git commit: [#2835] ticket:303 Add option to use standard parser

Posted by jo...@apache.org.
[#2835] ticket:303 Add option to use standard parser


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/e3b30ad7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/e3b30ad7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/e3b30ad7

Branch: refs/heads/cj/5963
Commit: e3b30ad7427e6a91c17c9a1fbc7fbe785cf85f2f
Parents: 975b209
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 15 09:23:56 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:38 2013 +0000

----------------------------------------------------------------------
 .../templates/blog_widgets/preview_post.html       |    2 +-
 .../templates/blog_widgets/view_post.html          |    2 +-
 ForgeWiki/forgewiki/templates/wiki/page_view.html  |    4 ++--
 ForgeWiki/forgewiki/wiki_main.py                   |    7 ++++++-
 4 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e3b30ad7/ForgeBlog/forgeblog/templates/blog_widgets/preview_post.html
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/templates/blog_widgets/preview_post.html b/ForgeBlog/forgeblog/templates/blog_widgets/preview_post.html
index 549aa03..36f9ebc 100644
--- a/ForgeBlog/forgeblog/templates/blog_widgets/preview_post.html
+++ b/ForgeBlog/forgeblog/templates/blog_widgets/preview_post.html
@@ -17,7 +17,7 @@
   <em class="grid-19">
     <strong>Labels:</strong>
     {% for l in value.labels %}
-      <span><a href="{{c.app.url}}search?q=labels_t:{{l}}">{{l}}</a> </span>
+      <span><a href="{{c.app.url}}search?q=labels_t:{{l}}&parser=standard">{{l}}</a> </span>
     {% endfor %}
   </em>
   {% endif %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e3b30ad7/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html b/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
index 40f367f..8c1e747 100644
--- a/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
+++ b/ForgeBlog/forgeblog/templates/blog_widgets/view_post.html
@@ -15,7 +15,7 @@
 <em class="grid-19">
   <strong>Labels:</strong>
   {% for l in value.labels %}
-    <span><a href="{{c.app.url}}search?q=labels_t:{{l}}">{{l}}</a> </span>
+    <span><a href="{{c.app.url}}search?q=labels_t:{{l}}&parser=standard">{{l}}</a> </span>
   {% endfor %}
 </em>
 {% endif %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e3b30ad7/ForgeWiki/forgewiki/templates/wiki/page_view.html
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/templates/wiki/page_view.html b/ForgeWiki/forgewiki/templates/wiki/page_view.html
index 1a32fa1..8c18bda 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_view.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_view.html
@@ -47,7 +47,7 @@
     <label class="simple">Labels: </label>
     {% for label in page.labels %}
       {% if label != '' %}
-        <span><a href="{{c.app.url}}search/?q=labels_t:{{label}}">{{label}} ({{page.artifacts_labeled_with(label, page.app_config).count()}})</a></span>
+        <span><a href="{{c.app.url}}search/?q=labels_t:{{label}}&parser=standard">{{label}} ({{page.artifacts_labeled_with(label, page.app_config).count()}})</a></span>
       {% endif %}
     {% endfor %}
   </div>
@@ -57,7 +57,7 @@
     {% for author in page.authors() %}
       <a href="{{author.url()}}">
         {{lib.gravatar(author, size=16)}}
-      </a>  
+      </a>
     {% endfor %}
   </div>
   {% if page.attachments %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e3b30ad7/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 15f86ec..be11731 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -301,7 +301,8 @@ class RootController(BaseController, DispatchIndex):
             redirect(c.project.url() + 'search?' + urlencode(dict(q=q, history=history)))
         search_error = None
         results = []
-        count=0
+        count = 0
+        parser = kw.pop('parser', None)
         limit, page, start = g.handle_paging(limit, page, default=25)
         if not q:
             q = ''
@@ -325,6 +326,10 @@ class RootController(BaseController, DispatchIndex):
             }
             if not history:
                search_params['fq'].append('is_history_b:False')
+            if parser == 'standard':
+                search_params.pop('qt', None)
+                search_params.pop('qf', None)
+                search_params.pop('pf', None)
             try:
                 results = search(
                     q, short_timeout=True, ignore_errors=False,


[12/40] git commit: [#2835] ticket:288 Use 'dismax' parser for wiki search, better match on title

Posted by jo...@apache.org.
[#2835] ticket:288 Use 'dismax' parser for wiki search, better match on title


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/87972940
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/87972940
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/87972940

Branch: refs/heads/cj/5963
Commit: 879729401792f6378f766fdb30c8179bc23dfa95
Parents: a9f0bdb
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 7 11:52:11 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:36 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/artifact.py   |    6 +++---
 ForgeWiki/forgewiki/model/wiki.py |    6 ++++--
 ForgeWiki/forgewiki/wiki_main.py  |   22 ++++++++++++++++------
 3 files changed, 23 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/87972940/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index 4c24a1c..95da7dd 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -208,12 +208,11 @@ class Artifact(MappedClass):
         """
         Subclasses should override this, providing a dictionary of solr_field => value.
         These fields & values will be stored by solr.  Subclasses should call the
-        super() index() and then extend it with more fields.  All these fields will be
-        included in the 'text' field (done by search.solarize())
+        super() index() and then extend it with more fields.
 
         The _s and _t suffixes, for example, follow solr dynamic field naming
         pattern.
-        You probably want to override at least title_s and text to have
+        You probably want to override at least title, title_s and text to have
         meaningful search results and email senders.
         """
 
@@ -222,6 +221,7 @@ class Artifact(MappedClass):
             id=self.index_id(),
             mod_date_dt=self.mod_date,
             title_s='Artifact %s' % self._id,
+            title='Artifact %s' % self._id,
             project_id_s=str(project._id),
             project_name_t=project.name,
             project_shortname_t=project.shortname,

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/87972940/ForgeWiki/forgewiki/model/wiki.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/model/wiki.py b/ForgeWiki/forgewiki/model/wiki.py
index dac92c7..c477b91 100644
--- a/ForgeWiki/forgewiki/model/wiki.py
+++ b/ForgeWiki/forgewiki/model/wiki.py
@@ -46,9 +46,10 @@ class PageHistory(Snapshot):
 
     def index(self):
         result = Snapshot.index(self)
+        title = '%s (version %d)' % (self.original().title, self.version)
         result.update(
-            title_s='Version %d of %s' % (
-                self.version,self.original().title),
+            title_s=title,
+            title=title,
             type_s='WikiPage Snapshot',
             text=self.data.text)
         return result
@@ -130,6 +131,7 @@ class Page(VersionedArtifact, ActivityObject):
         result = VersionedArtifact.index(self)
         result.update(
             title_s=self.title,
+            title=self.title,
             version_i=self.version,
             type_s='WikiPage',
             text=self.text)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/87972940/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index f15c634..e5482ea 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -304,15 +304,25 @@ class RootController(BaseController, DispatchIndex):
         if not q:
             q = ''
         else:
+            # Match on both `title` and `text` by default, using 'dismax' parser.
+            # Score on `title` matches is boosted, so title match is better than body match.
+            # It's 'fuzzier' than standard parser, which matches only on `text`.
+            search_params = {
+                'qt': 'dismax',
+                'qf': 'title^2 text',
+                'pf': 'title^2 text',
+                'fq': [
+                    'project_id_s:%s' % c.project._id,
+                    'mount_point_s:%s'% c.app.config.options.mount_point,
+                    '-deleted_b:true'
+                ]
+            }
+            if not history:
+               search_params['fq'].append('is_history_b:False')
             try:
                 results = search(
                     q, short_timeout=True, ignore_errors=False,
-                    rows=limit, start=start,
-                    fq=[
-                        'is_history_b:%s' % history,
-                        'project_id_s:%s' % c.project._id,
-                        'mount_point_s:%s'% c.app.config.options.mount_point,
-                        '-deleted_b:true'])
+                    rows=limit, start=start, **search_params)
             except SolrError as e:
                 search_error = e
             if results: count=results.hits


[29/40] git commit: [#5932] Fixed Invalid field error for removed _milestone_counts fields

Posted by jo...@apache.org.
[#5932] Fixed Invalid field error for removed _milestone_counts fields

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/cbbd95ee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/cbbd95ee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/cbbd95ee

Branch: refs/heads/cj/5963
Commit: cbbd95eea81483cfd72a36072a56d38ea5f3b280
Parents: b5bc185
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Mar 27 20:11:49 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Mar 28 20:06:33 2013 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/model/ticket.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cbbd95ee/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index 1abeaac..686fd7d 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -53,6 +53,8 @@ class Globals(MappedClass):
     _bin_counts_data = FieldProperty([dict(summary=str, hits=int)])
     _bin_counts_expire = FieldProperty(datetime)
     _bin_counts_invalidated = FieldProperty(datetime)
+    _milestone_counts = FieldProperty(schema.Deprecated) #[dict(name=str,hits=int,closed=int)])
+    _milestone_counts_expire = FieldProperty(schema.Deprecated) #datetime)
     show_in_search = FieldProperty({str: bool}, if_missing={'ticket_num': True,
                                                             'summary': True,
                                                             '_milestone': True,


[35/40] git commit: [#5978] Fixed call to guess_repo in History view and log any other calls as errors

Posted by jo...@apache.org.
[#5978] Fixed call to guess_repo in History view and log any other calls as errors

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/34729f5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/34729f5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/34729f5c

Branch: refs/heads/cj/5963
Commit: 34729f5cc504c027115f251f91f5ad67b8a286f2
Parents: 789d7b8
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Mar 28 22:09:19 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Mar 29 14:30:15 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py |    6 +++++-
 Allura/allura/model/repo.py             |    2 ++
 2 files changed, 7 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/34729f5c/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index e110e10..bbfb307 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -470,7 +470,11 @@ class CommitBrowser(BaseController):
         next_commit = None
         if len(commits) > limit:
             next_commit = M.repo.Commit.query.get(_id=commits.pop())
-        revisions = sorted(M.repo.Commit.query.find({'_id': {'$in': commits}}), key=lambda c:commits.index(c._id))
+            next_commit.set_context(c.app.repo)
+        revisions = list(M.repo.Commit.query.find({'_id': {'$in': commits}}))
+        for commit in revisions:
+            commit.set_context(c.app.repo)
+        revisions = sorted(revisions, key=lambda c:commits.index(c._id))
         c.log_widget = self.log_widget
         return dict(
             username=c.user._id and c.user.username,

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/34729f5c/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 40f4567..85fa875 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -231,6 +231,8 @@ class Commit(RepoObject):
         return self.repo.url_for_commit(self)
 
     def guess_repo(self):
+        import traceback
+        log.error('guess_repo: should not be called: %s' % ''.join(traceback.format_stack()))
         for ac in c.project.app_configs:
             try:
                 app = c.project.app_instance(ac)


[23/40] git commit: [#2835] ticket:303 Append all fields into inside the ticket's index()

Posted by jo...@apache.org.
[#2835] ticket:303 Append all fields into  inside the ticket's index()


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/186cf487
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/186cf487
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/186cf487

Branch: refs/heads/cj/5963
Commit: 186cf48763ededb55c6594879476d6e1a2e5dcba
Parents: e3b30ad
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 15 09:46:21 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:39 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/search.py               |    5 -----
 ForgeTracker/forgetracker/model/ticket.py |    7 +++++++
 2 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/186cf487/Allura/allura/lib/search.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/search.py b/Allura/allura/lib/search.py
index a6587f1..a428c53 100644
--- a/Allura/allura/lib/search.py
+++ b/Allura/allura/lib/search.py
@@ -1,7 +1,6 @@
 import re
 import socket
 from logging import getLogger
-from pprint import pformat
 
 import markdown
 from pylons import tmpl_context as c, app_globals as g
@@ -18,10 +17,6 @@ def solarize(obj):
     # if index() returned doc without text, assume empty text
     if not doc.get('text'):
         doc['text'] = ''
-    # Tracker uses search with default solr parser. It would match only on
-    # `text`, so we append all other field values into `text`, to match on it too.
-    if getattr(obj, 'type_s', '').lower() == 'ticket':
-        doc['text'] += pformat(doc.values())
     return doc
 
 class SearchError(SolrError):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/186cf487/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index dbfda81..db7113a 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -7,6 +7,7 @@ from datetime import datetime, timedelta
 import pymongo
 from pymongo.errors import OperationFailure
 from pylons import tmpl_context as c, app_globals as g
+from pprint import pformat
 
 from ming import schema
 from ming.utils import LazyProperty
@@ -209,6 +210,9 @@ class TicketHistory(Snapshot):
                 self.version, orig.summary),
             type_s='Ticket Snapshot',
             text=self.data.summary)
+        # Tracker uses search with default solr parser. It would match only on
+        # `text`, so we're appending all other field values into `text`, to match on it too.
+        result['text'] += pformat(result.values())
         return result
 
 class Bin(Artifact, ActivityObject):
@@ -319,6 +323,9 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
             result['reported_by_s'] = self.reported_by.username
         if self.assigned_to:
             result['assigned_to_s'] = self.assigned_to.username
+        # Tracker uses search with default solr parser. It would match only on
+        # `text`, so we're appending all other field values into `text`, to match on it too.
+        result['text'] += pformat(result.values())
         return result
 
     @classmethod


[37/40] git commit: [#5971] don't show or create user-projects for disabled users

Posted by jo...@apache.org.
[#5971] don't show or create user-projects for disabled users


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/d7846b25
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d7846b25
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d7846b25

Branch: refs/heads/cj/5963
Commit: d7846b25df18c085792f64a42fbfb7ffab7366a5
Parents: 34729f5
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Mar 28 19:08:45 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 29 15:23:59 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/project.py               |    7 ++++++-
 Allura/allura/model/auth.py                        |    3 +++
 .../allura/tests/functional/test_neighborhood.py   |    7 +++++++
 Allura/allura/tests/model/test_auth.py             |    7 +++++++
 4 files changed, 23 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d7846b25/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index ebeba77..7a1551f 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -67,7 +67,7 @@ class NeighborhoodController(object):
         project = M.Project.query.get(shortname=self.prefix + pname, neighborhood_id=self.neighborhood._id)
         if project is None and self.prefix == 'u/':
             # create user-project if it is missing
-            user = M.User.query.get(username=pname)
+            user = M.User.query.get(username=pname, disabled=False)
             if user:
                 project = self.neighborhood.register_project(
                     plugin.AuthenticationProvider.get(request).user_project_shortname(user),
@@ -77,6 +77,11 @@ class NeighborhoodController(object):
             project = self.neighborhood.neighborhood_project
             c.project = project
             return ProjectController()._lookup(pname, *remainder)
+        if project and self.prefix == 'u/':
+            # make sure user-projects are associated with an enabled user
+            user = project.user_project_of
+            if not user or user.disabled:
+                raise exc.HTTPNotFound
         if project.database_configured == False:
             if remainder == ('user_icon',):
                 redirect(g.forge_static('images/user.png'))

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d7846b25/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 8df4a58..ee9abec 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -587,6 +587,9 @@ class User(MappedClass, ActivityNode, ActivityObject):
         '''
         Returns the personal user-project for the user
         '''
+        if self.disabled:
+            return None
+
         from allura import model as M
         n = M.Neighborhood.query.get(name='Users')
         auth_provider = plugin.AuthenticationProvider.get(request)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d7846b25/Allura/allura/tests/functional/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index 9c86a67..815f557 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -813,6 +813,13 @@ class TestNeighborhood(TestController):
         ThreadLocalORMSession.flush_all()
         self.app.get('/u/donald-duck/')
 
+    def test_disabled_user_has_no_user_project(self):
+        user = M.User.register(dict(username='donald-duck'))
+        self.app.get('/u/donald-duck/')  # assert it's there
+        M.User.query.update(dict(username='donald-duck'), {'$set': {'disabled': True}})
+        self.app.get('/u/donald-duck/', status=404)
+
+
     def test_more_projects_link(self):
         r = self.app.get('/adobe/adobe-1/admin/')
         link = r.html.find('div', {'class':'neighborhood_title_link'}).find('a')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d7846b25/Allura/allura/tests/model/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_auth.py b/Allura/allura/tests/model/test_auth.py
index 8fd0b65..9e0ff48 100644
--- a/Allura/allura/tests/model/test_auth.py
+++ b/Allura/allura/tests/model/test_auth.py
@@ -104,6 +104,13 @@ def test_user_project_already_deleted_creates_on_demand():
     assert M.Project.query.get(shortname='u/foobar123', deleted=False)
 
 @with_setup(setUp)
+def test_user_project_does_not_create_on_demand_for_disabled_user():
+    u = M.User.register(dict(username='foobar123', disabled=True), make_project=False)
+    ThreadLocalORMSession.flush_all()
+    assert not u.private_project()
+    assert not M.Project.query.get(shortname='u/foobar123')
+
+@with_setup(setUp)
 def test_project_role():
     role = M.ProjectRole(project_id=c.project._id, name='test_role')
     c.user.project_role().roles.append(role._id)


[09/40] git commit: [#2835] ticket:287 Display time using ago_string helper

Posted by jo...@apache.org.
[#2835] ticket:287 Display time using ago_string helper


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/c3db2686
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/c3db2686
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/c3db2686

Branch: refs/heads/cj/5963
Commit: c3db26862c3205b8374f0bce7c119657c1c0f720
Parents: 556cfdb
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 15:47:02 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:35 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/widgets/search_results.html   |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c3db2686/Allura/allura/templates/widgets/search_results.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/search_results.html b/Allura/allura/templates/widgets/search_results.html
index 5e66ccd..92b7cb6 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -42,7 +42,7 @@
     {{ doc.snippet }}
     TODO: change me to something useful! Mark <strong>matches</strong>.<br/>
     an open source implementation of a software "forge", <strong>a web site</strong> that manages source code repositories, bug reports, discussions, mailing lists, wiki pages, blogs and more for any number of individual proje<br>
-    <span class="date">Last updated: {{ doc['mod_date_dt'] }}</span>
+    <span class="date">Last updated: {{ h.ago_string(doc['mod_date_dt']) }}</span>
     </p>
   </div>
 {% endfor %}


[28/40] git commit: [#5951] Display closed milestones in an optgroup

Posted by jo...@apache.org.
[#5951] Display closed milestones in an optgroup

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/b5bc1858
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b5bc1858
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b5bc1858

Branch: refs/heads/cj/5963
Commit: b5bc1858daa093d1ce7b2b6c6026039af6fdcf09
Parents: 5acf2eb
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Mar 27 19:56:22 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Mar 28 19:45:46 2013 +0000

----------------------------------------------------------------------
 .../forgetracker/tests/functional/test_root.py     |   19 ++++++--
 ForgeTracker/forgetracker/widgets/ticket_form.py   |   36 ++++++++++++---
 2 files changed, 44 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b5bc1858/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index b7f4ae2..d638cf8 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -116,16 +116,25 @@ class TestMilestones(TrackerTestController):
         }
         self.app.post('/bugs/update_milestones', d)
         r = self.app.get('/bugs/1/')
+        closed = r.html.find('optgroup', label='Closed')
+        assert closed
+        closed = str(closed)
         assert '<option selected value="1.0">1.0</option>' in r
+        assert '<option selected value="1.0">1.0</option>' not in closed
         assert '<option value="2.0">2.0</option>' in r
-        assert '<option value="3.0">3.0</option>' not in r
-        assert '<option value="4.0">4.0</option>' not in r
+        assert '<option value="2.0">2.0</option>' not in closed
+        assert '<option value="3.0">3.0</option>' in closed
+        assert '<option value="4.0">4.0</option>' in closed
         r = self.app.get('/bugs/new/')
+        closed = r.html.find('optgroup', label='Closed')
+        assert closed
+        closed = str(closed)
         assert '<option selected value="1.0">1.0</option>' not in r
-        assert '<option value="1.0">1.0</option>' not in r
+        assert '<option value="1.0">1.0</option>' in closed
         assert '<option value="2.0">2.0</option>' in r
-        assert '<option value="3.0">3.0</option>' not in r
-        assert '<option value="4.0">4.0</option>' not in r
+        assert '<option value="2.0">2.0</option>' not in closed
+        assert '<option value="3.0">3.0</option>' in closed
+        assert '<option value="4.0">4.0</option>' in closed
 
 
 def post_install_create_ticket_permission(app):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b5bc1858/ForgeTracker/forgetracker/widgets/ticket_form.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_form.py b/ForgeTracker/forgetracker/widgets/ticket_form.py
index aaba037..4394fbb 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_form.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_form.py
@@ -179,9 +179,33 @@ class TicketCustomField(object):
         return factory(field)
 
 class MilestoneField(ew.SingleSelectField):
-    def display(self, *args, **kwargs):
-        milestone_value = kwargs['value']
-        for milestone in reversed(self.options):  # reverse so del hits the correct indexes
-            if milestone.complete and (milestone.py_value != milestone_value):
-                del self.options[self.options.index(milestone)]
-        return super(MilestoneField, self).display(*args, **kwargs)
+    template=ew.Snippet('''<select {{widget.j2_attrs({
+               'id':id,
+               'name':rendered_name,
+               'multiple':multiple,
+               'class':css_class},
+               attrs)}}>
+            {% for o in open_milestones %}
+            <option{% if o.selected%} selected{% endif %} value="{{o.html_value}}">{{o.label|e}}</option>
+            {% endfor %}
+            {% if closed_milestones %}
+            <optgroup label="Closed">
+                {% for o in closed_milestones %}
+                <option{% if o.selected%} selected{% endif %} value="{{o.html_value}}">{{o.label|e}}</option>
+                {% endfor %}
+            </optgroup>
+            {% endif %}
+        </select>''', 'jinja2')
+
+    def prepare_context(self, context):
+        context = super(MilestoneField, self).prepare_context(context)
+
+        # group open / closed milestones
+        context['open_milestones'] = [opt for opt in self.options if not opt.complete]
+        context['closed_milestones'] = [opt for opt in self.options if opt.complete]
+
+        # filter closed milestones entirely
+        #value = context['value']
+        #context['options'] = [opt for opt in self.options if not opt.complete or value == opt.py_value]
+
+        return context


[36/40] git commit: [#5971] don't re-query the Users nbhd every time we look up a user-project

Posted by jo...@apache.org.
[#5971] don't re-query the Users nbhd every time we look up a user-project


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/53635e77
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/53635e77
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/53635e77

Branch: refs/heads/cj/5963
Commit: 53635e778f61d8a8a20f0205caa45eabdbe0d143
Parents: d7846b2
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Mar 28 19:12:50 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 29 15:23:59 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/auth.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/53635e77/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index ee9abec..5ccfd60 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -23,6 +23,7 @@ from ming.orm import session, state
 from ming.orm import FieldProperty, RelationProperty, ForeignIdProperty
 from ming.orm.declarative import MappedClass
 from ming.orm.ormsession import ThreadLocalORMSession
+from ming.utils import LazyProperty
 
 import allura.tasks.mail_tasks
 from allura.lib import helpers as h
@@ -583,6 +584,11 @@ class User(MappedClass, ActivityNode, ActivityObject):
                                user=user, user_project=True)
         return user
 
+    @LazyProperty
+    def neighborhood(self):
+        from allura import model as M
+        return M.Neighborhood.query.get(name='Users')
+
     def private_project(self):
         '''
         Returns the personal user-project for the user
@@ -591,7 +597,7 @@ class User(MappedClass, ActivityNode, ActivityObject):
             return None
 
         from allura import model as M
-        n = M.Neighborhood.query.get(name='Users')
+        n = self.neighborhood
         auth_provider = plugin.AuthenticationProvider.get(request)
         project_shortname = auth_provider.user_project_shortname(self)
         p = M.Project.query.get(shortname=project_shortname, neighborhood_id=n._id)


[05/40] git commit: [#2835] ticket:287 Search results styles (with stubs for some data)

Posted by jo...@apache.org.
[#2835] ticket:287 Search results styles (with stubs for some data)


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/86bd80f7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/86bd80f7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/86bd80f7

Branch: refs/heads/cj/5963
Commit: 86bd80f7294bbf034afee92d937fbeaa37e6ab07
Parents: b7f967d
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 13:07:15 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:34 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/widgets/resources/css/search.css |    4 ++++
 .../allura/templates/widgets/search_results.html   |   13 ++++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/86bd80f7/Allura/allura/lib/widgets/resources/css/search.css
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/css/search.css b/Allura/allura/lib/widgets/resources/css/search.css
index 16b792a..8d4f308 100644
--- a/Allura/allura/lib/widgets/resources/css/search.css
+++ b/Allura/allura/lib/widgets/resources/css/search.css
@@ -1,3 +1,7 @@
 input.search-query {
   width: 95%;
 }
+
+.date {
+  color: #aaa;
+}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/86bd80f7/Allura/allura/templates/widgets/search_results.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/search_results.html b/Allura/allura/templates/widgets/search_results.html
index 6700c48..0b1fcdf 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -36,12 +36,15 @@
 </div>
 {% for doc in results %}
   <div class="grid-19">
-    <a href="{{doc['url_paginated'] or doc['url_s']}}">{{doc.title_s}}</a><br>
-    {% if doc.get('snippet') %}
-      <p>{{doc.snippet}}</p>
-    {% endif %}
+    {# TODO: mark matches in title and snippet #}
+    <p>
+    <a href="{{doc['url_paginated'] or doc['url_s']}}">{{ doc.title_s }}</a><br>
+    {{ doc.snippet }}
+    TODO: change me to something useful! Mark <strong>matches</strong>.<br/>
+    an open source implementation of a software "forge", <strong>a web site</strong> that manages source code repositories, bug reports, discussions, mailing lists, wiki pages, blogs and more for any number of individual proje<br>
+    <span class="date">Last updated: {{ doc['mod_date_dt'] }}</span>
+    </p>
   </div>
-  <hr>
 {% endfor %}
 <div class="grid-19" style="clear:both">
   {{widget.fields['page_list'].display(limit=limit, page=page, count=count)}}


[38/40] git commit: [#5978] Fixed empty LCD info from double iteration of result set

Posted by jo...@apache.org.
[#5978] Fixed empty LCD info from double iteration of result set

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/9110fed6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/9110fed6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/9110fed6

Branch: refs/heads/cj/5963
Commit: 9110fed627d5f6fdc7ccebbcea60ec848a43eb0f
Parents: 53635e7
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Fri Mar 29 16:54:53 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Mar 29 17:14:55 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/repo.py                      |    2 +-
 ForgeGit/forgegit/tests/model/test_repository.py |   16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9110fed6/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 85fa875..4d396b8 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -533,7 +533,7 @@ class Tree(RepoObject):
         if lcd is None:
             return []
         commit_ids = [e.commit_id for e in lcd.entries]
-        commits = Commit.query.find(dict(_id={'$in': commit_ids}))
+        commits = list(Commit.query.find(dict(_id={'$in': commit_ids})))
         for commit in commits:
             commit.set_context(self.repo)
         commit_infos = {c._id: c.info for c in commits}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9110fed6/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index 4e1d417..6258251 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -2,6 +2,7 @@ import os
 import shutil
 import unittest
 import pkg_resources
+import datetime
 
 import mock
 from pylons import tmpl_context as c, app_globals as g
@@ -244,6 +245,21 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
         self.repo.tarball('HEAD')
         assert os.path.isfile("/tmp/tarball/git/t/te/test/testgit.git/test-src-git-HEAD.tar.gz")
 
+    def test_ls(self):
+        lcd_map = self.repo.commit('HEAD').tree.ls()
+        self.assertEqual(lcd_map, [{
+                'href': u'README',
+                'kind': 'BLOB',
+                'last_commit': {
+                    'author': u'Rick Copeland',
+                    'author_email': u'rcopeland@geek.net',
+                    'author_url': None,
+                    'date': datetime.datetime(2010, 10, 7, 18, 44, 11),
+                    'href': u'/p/test/src-git/ci/1e146e67985dcd71c74de79613719bef7bddca4a/',
+                    'shortlink': u'[1e146e]',
+                    'summary': u'Change README'},
+                'name': u'README'}])
+
 
 class TestGitCommit(unittest.TestCase):
 


[31/40] git commit: Output the URL being used to import tickets when verbose is turned on

Posted by jo...@apache.org.
Output the URL being used to import tickets when verbose is turned on


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5c079303
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5c079303
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5c079303

Branch: refs/heads/cj/5963
Commit: 5c079303c38f33edb1f603ea6f4f02ccc2f01506
Parents: cbbd95e
Author: Jon Schewe <jp...@mtu.net>
Authored: Tue Mar 26 18:26:43 2013 -0500
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Mar 28 20:42:12 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/import_api.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5c079303/Allura/allura/lib/import_api.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/import_api.py b/Allura/allura/lib/import_api.py
index 365532d..ea07756 100644
--- a/Allura/allura/lib/import_api.py
+++ b/Allura/allura/lib/import_api.py
@@ -30,6 +30,9 @@ class AlluraImportApiClient(object):
 
     def call(self, url, **params):
         url = urlparse.urljoin(self.base_url, url)
+        if self.verbose:
+            print "Using URL '%s'" % (url)
+        
         params = self.sign(urlparse.urlparse(url).path, params.items())
 
         while True:


[19/40] git commit: [#2835] ticket:288 Fix failing tests due to changes in wiki pages indexation

Posted by jo...@apache.org.
[#2835] ticket:288 Fix failing tests due to changes in wiki pages indexation


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/88d7b825
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/88d7b825
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/88d7b825

Branch: refs/heads/cj/5963
Commit: 88d7b8256deb5ea2e75812eb632a1378c63c4b54
Parents: 01c9d1c
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 8 12:05:29 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:38 2013 +0000

----------------------------------------------------------------------
 .../allura/tests/functional/test_user_profile.py   |    2 +-
 Allura/allura/tests/model/test_notification.py     |    4 ++--
 Allura/allura/tests/test_globals.py                |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/88d7b825/Allura/allura/tests/functional/test_user_profile.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_user_profile.py b/Allura/allura/tests/functional/test_user_profile.py
index fcea8b4..1589a2b 100644
--- a/Allura/allura/tests/functional/test_user_profile.py
+++ b/Allura/allura/tests/functional/test_user_profile.py
@@ -38,4 +38,4 @@ class TestUserProfile(TestController):
     def test_feed(self):
         response = self.app.get('/u/test-admin/profile/feed')
         assert 'Recent posts by Test Admin' in response
-        assert 'WikiPage Home modified by Test Admin' in response
+        assert 'Home modified by Test Admin' in response

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/88d7b825/Allura/allura/tests/model/test_notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_notification.py b/Allura/allura/tests/model/test_notification.py
index 92e244f..f8f8afb 100644
--- a/Allura/allura/tests/model/test_notification.py
+++ b/Allura/allura/tests/model/test_notification.py
@@ -81,7 +81,7 @@ class TestPostNotifications(unittest.TestCase):
         flash_msgs = list(h.pop_user_notifications(u))
         assert len(flash_msgs) == 1, flash_msgs
         msg = flash_msgs[0]
-        assert msg['text'].startswith('WikiPage Home modified by Test Admin')
+        assert msg['text'].startswith('Home modified by Test Admin')
         assert msg['subject'].startswith('[test:wiki]')
         flash_msgs = list(h.pop_user_notifications(u))
         assert not flash_msgs, flash_msgs
@@ -124,7 +124,7 @@ class TestPostNotifications(unittest.TestCase):
         assert_in(str(user2._id), first_destinations)
         assert_equal(email_tasks[0].kwargs['fromaddr'], '"Test Admin" <te...@users.localhost>')
         assert_equal(email_tasks[1].kwargs['fromaddr'], '"Test Admin" <te...@users.localhost>')
-        assert email_tasks[0].kwargs['text'].startswith('WikiPage Home modified by Test Admin')
+        assert email_tasks[0].kwargs['text'].startswith('Home modified by Test Admin')
         assert 'you indicated interest in ' in email_tasks[0].kwargs['text']
 
     def test_permissions(self):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/88d7b825/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 493787c..7ad940e 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -126,7 +126,7 @@ def test_macros():
     assert_equal(r, '<div class="markdown_content"><p><span class="download-button-%s" style="margin-bottom: 1em; display: block;"></span></p>\n</div>' % p_test._id)
     h.set_context('--init--', 'wiki', neighborhood='Projects')
     r = g.markdown_wiki.convert('[[neighborhood_feeds tool_name=Wiki]]')
-    assert 'WikiPage Home modified by' in r, r
+    assert 'Home modified by' in r, r
     orig_len = len(r)
     # Make project private & verify we don't see its new feed items
     proj = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
@@ -316,7 +316,7 @@ def test_macro_include():
 def test_macro_nbhd_feeds():
     with h.push_context('--init--', 'wiki', neighborhood='Projects'):
         r = g.markdown_wiki.convert('[[neighborhood_feeds tool_name=Wiki]]')
-        assert 'WikiPage Home modified by ' in r, r
+        assert 'Home modified by ' in r, r
 
 
 def test_sort_alpha():


[22/40] git commit: [#2835] ticket:303 Get rid of `title_s`, use `title` instead

Posted by jo...@apache.org.
[#2835] ticket:303 Get rid of `title_s`, use `title` instead


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f211493f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f211493f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f211493f

Branch: refs/heads/cj/5963
Commit: f211493fef93814cbbe27209e5346e339bdc9d4a
Parents: 186cf48
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 15 10:46:49 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:39 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/helpers.py                       |   12 ++++++++++++
 Allura/allura/model/artifact.py                    |   11 +++++------
 Allura/allura/model/discuss.py                     |    6 +++---
 Allura/allura/model/notification.py                |    6 +++---
 Allura/allura/model/repository.py                  |    4 ++--
 Allura/allura/templates/search_index.html          |    2 +-
 .../allura/templates/widgets/search_results.html   |    2 +-
 Allura/allura/tests/model/test_artifact.py         |    2 +-
 Allura/allura/tests/model/test_discussion.py       |    2 +-
 Allura/allura/tests/test_helpers.py                |    9 +++++++++
 ForgeBlog/forgeblog/model/blog.py                  |    4 ++--
 ForgeBlog/forgeblog/templates/blog/search.html     |    2 +-
 ForgeChat/forgechat/command.py                     |    2 +-
 ForgeChat/forgechat/templates/chat/search.html     |    2 +-
 ForgeShortUrl/forgeshorturl/model/shorturl.py      |    2 +-
 ForgeTracker/forgetracker/model/ticket.py          |    4 ++--
 ForgeWiki/forgewiki/model/wiki.py                  |    2 --
 17 files changed, 46 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index 5e32882..eeee7bc 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -652,3 +652,15 @@ def get_tool_package(tool_name):
     "Return package for given tool (e.g. 'forgetracker' for 'tickets')"
     app = g.entry_points['tool'].get(tool_name.lower())
     return app.__module__.split('.')[0] if app else ''
+
+
+def get_first(d, key):
+    """Return value for d[key][0] if d[key] is a list with elements, else return d[key].
+
+    Useful to retrieve values from solr index (e.g. `title` and `text` fields),
+    which are stored as lists.
+    """
+    v = d.get(key)
+    if isinstance(v, list):
+        return v[0] if len(v) > 0 else None
+    return v

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index 95da7dd..aa3ddfa 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -212,7 +212,7 @@ class Artifact(MappedClass):
 
         The _s and _t suffixes, for example, follow solr dynamic field naming
         pattern.
-        You probably want to override at least title, title_s and text to have
+        You probably want to override at least title and text to have
         meaningful search results and email senders.
         """
 
@@ -220,7 +220,6 @@ class Artifact(MappedClass):
         return dict(
             id=self.index_id(),
             mod_date_dt=self.mod_date,
-            title_s='Artifact %s' % self._id,
             title='Artifact %s' % self._id,
             project_id_s=str(project._id),
             project_name_t=project.name,
@@ -268,7 +267,7 @@ class Artifact(MappedClass):
             t = Thread.new(
                 discussion_id=self.app_config.discussion_id,
                 ref_id=idx['id'],
-                subject='%s discussion' % idx['title_s'])
+                subject='%s discussion' % h.get_first(idx, 'title'))
         parent_id = None
         if data:
             in_reply_to = data.get('in_reply_to', [])
@@ -316,8 +315,8 @@ class Snapshot(Artifact):
         if original:
             original_index = original.index()
             result.update(original_index)
-            result['title_s'] = 'Version %d of %s' % (
-                    self.version, original_index['title_s'])
+            result['title'] = 'Version %d of %s' % (
+                    self.version, h.get_first(original_index, 'title'))
         result.update(
             id=self.index_id(),
             version_i=self.version,
@@ -640,7 +639,7 @@ class Feed(MappedClass):
         if author_name is None:
             author_name = author.get_pref('display_name')
         if title is None:
-            title='%s modified by %s' % (idx['title_s'], author_name)
+            title='%s modified by %s' % (h.get_first(idx, 'title'), author_name)
         if description is None: description = title
         if pubdate is None:
             pubdate = datetime.utcnow()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 9d26242..2ea6f4c 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -90,7 +90,7 @@ class Discussion(Artifact, ActivityObject):
     def index(self):
         result = Artifact.index(self)
         result.update(
-            title_s='Discussion: %s' % self.name,
+            title='Discussion: %s' % self.name,
             name_s=self.name,
             text=self.description)
         return result
@@ -339,7 +339,7 @@ class Thread(Artifact, ActivityObject):
     def index(self):
         result = Artifact.index(self)
         result.update(
-           title_s='Thread: %s' % (self.subject or '(no subject)'),
+           title='Thread: %s' % (self.subject or '(no subject)'),
            name_s=self.subject,
            views_i=self.num_views,
            text=self.subject)
@@ -459,7 +459,7 @@ class Post(Message, VersionedArtifact, ActivityObject):
     def index(self):
         result = super(Post, self).index()
         result.update(
-            title_s='Post by %s on %s' % (
+            title='Post by %s on %s' % (
                 self.author().username, self.subject),
             name_s=self.subject,
             type_s='Post',

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/model/notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
index 7003e29..c9b1e35 100644
--- a/Allura/allura/model/notification.py
+++ b/Allura/allura/model/notification.py
@@ -153,9 +153,9 @@ class Notification(MappedClass):
             return n
         else:
             subject = kwargs.pop('subject', '%s modified by %s' % (
-                    idx['title_s'],c.user.get_pref('display_name')))
+                    h.get_first(idx, 'title'),c.user.get_pref('display_name')))
             reply_to = '"%s" <%s>' % (
-                idx['title_s'],
+                h.get_first(idx, 'title'),
                 getattr(artifact, 'email_address', u'noreply@in.sf.net'))
             d = dict(
                 from_address=reply_to,
@@ -355,7 +355,7 @@ class Mailbox(MappedClass):
             artifact_index_id = None
         else:
             i = artifact.index()
-            artifact_title = i['title_s']
+            artifact_title = h.get_first(i, 'title')
             artifact_url = artifact.url()
             artifact_index_id = i['id']
             artifact_already_subscribed = cls.query.get(user_id=user_id,

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index f822cc2..d6f843d 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -426,7 +426,7 @@ class Repository(Artifact, ActivityObject):
         result.update(
             name_s=self.name,
             type_s=self.type_s,
-            title_s='Repository %s %s' % (self.project.name, self.name))
+            title='Repository %s %s' % (self.project.name, self.name))
         return result
 
     @property
@@ -614,7 +614,7 @@ class MergeRequest(VersionedArtifact, ActivityObject):
         result.update(
             name_s='Merge Request #%d' % self.request_number,
             type_s=self.type_s,
-            title_s='Merge Request #%d of %s:%s' % (
+            title='Merge Request #%d of %s:%s' % (
                 self.request_number, self.project.name, self.app.repo.name))
         return result
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/templates/search_index.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/search_index.html b/Allura/allura/templates/search_index.html
index 52033d8..6fd2107 100644
--- a/Allura/allura/templates/search_index.html
+++ b/Allura/allura/templates/search_index.html
@@ -27,7 +27,7 @@
   <ol>
   {% for doc in results %}
   <li>
-    <a href="{{doc['url_s']}}">{{doc.title_s}}</a>
+    <a href="{{doc['url_s']}}">{{h.get_first(doc, 'title')}}</a>
     {% if doc.get('snippet') %}
       <p>{{doc['snippet']|safe}}</p>
     {% endif %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/templates/widgets/search_results.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/search_results.html b/Allura/allura/templates/widgets/search_results.html
index b5b0c5a..d1067cc 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -41,7 +41,7 @@
   <div class="grid-19">
     {# TODO: mark matches in title and snippet #}
     <p>
-    <a href="{{doc['url_paginated'] or doc['url_s']}}">{{ doc.title_s }}</a>
+    <a href="{{doc['url_paginated'] or doc['url_s']}}">{{ h.get_first(doc, 'title') }}</a>
     {% if doc['type_s'] %}<span class="gray"><sup>{{ '(%s)' % doc['type_s'] }}</sup></span>{% endif %}
     <br>
     {{ doc.snippet }}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/tests/model/test_artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_artifact.py b/Allura/allura/tests/model/test_artifact.py
index 0ad9d49..ec02de9 100644
--- a/Allura/allura/tests/model/test_artifact.py
+++ b/Allura/allura/tests/model/test_artifact.py
@@ -72,7 +72,7 @@ def test_artifact():
     c.memoize_cache = {}
     assert not security.has_access(pg, 'delete')(user=u)
     idx = pg.index()
-    assert 'title_s' in idx
+    assert 'title' in idx
     assert 'url_s' in idx
     assert 'project_id_s' in idx
     assert 'mount_point_s' in idx

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/tests/model/test_discussion.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_discussion.py b/Allura/allura/tests/model/test_discussion.py
index 861f665..7efe0c9 100644
--- a/Allura/allura/tests/model/test_discussion.py
+++ b/Allura/allura/tests/model/test_discussion.py
@@ -137,7 +137,7 @@ def test_post_methods():
     assert p.link_text() == p.subject
 
     ss = p.history().first()
-    assert 'Version' in ss.index()['title_s']
+    assert 'Version' in h.get_first(ss.index(), 'title')
     assert '#' in ss.shorthand_id()
 
     jsn = p.__json__()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/Allura/allura/tests/test_helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_helpers.py b/Allura/allura/tests/test_helpers.py
index 8407ef4..4829549 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -167,3 +167,12 @@ def test_get_tool_package():
     assert h.get_tool_package('tickets') == 'forgetracker'
     assert h.get_tool_package('Wiki') == 'forgewiki'
     assert h.get_tool_package('wrong_tool') == ''
+
+
+def test_get_first():
+    assert_equals(h.get_first({}, 'title'), None)
+    assert_equals(h.get_first({'title': None}, 'title'), None)
+    assert_equals(h.get_first({'title': 'Value'}, 'title'), 'Value')
+    assert_equals(h.get_first({'title': ['Value']}, 'title'), 'Value')
+    assert_equals(h.get_first({'title': []}, 'title'), None)
+    assert_equals(h.get_first({'title': ['Value']}, 'title'), 'Value')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/ForgeBlog/forgeblog/model/blog.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/model/blog.py b/ForgeBlog/forgeblog/model/blog.py
index a2dae6c..88e2204 100644
--- a/ForgeBlog/forgeblog/model/blog.py
+++ b/ForgeBlog/forgeblog/model/blog.py
@@ -57,7 +57,7 @@ class BlogPostSnapshot(M.Snapshot):
             return None
         result = super(BlogPostSnapshot, self).index()
         result.update(
-            title_s='Version %d of %s' % (
+            title='Version %d of %s' % (
                 self.version, orig.shorthand_id()),
             type_s=self.type_s,
             text=self.data.text)
@@ -184,7 +184,7 @@ class BlogPost(M.VersionedArtifact, ActivityObject):
     def index(self):
         result = super(BlogPost, self).index()
         result.update(
-            title_s=self.slug,
+            title=self.slug,
             type_s=self.type_s,
             state_s=self.state,
             snippet_s='%s: %s' % (self.title, h.text.truncate(self.text, 200)),

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/ForgeBlog/forgeblog/templates/blog/search.html
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/templates/blog/search.html b/ForgeBlog/forgeblog/templates/blog/search.html
index a4f7129..320f265 100644
--- a/ForgeBlog/forgeblog/templates/blog/search.html
+++ b/ForgeBlog/forgeblog/templates/blog/search.html
@@ -22,7 +22,7 @@
   {% endif %}
   {% for doc in results %}
   <div>
-    <div class="grid-19"><a href="{{doc['url_s']}}">{{doc.title_s}}</a></div>
+    <div class="grid-19"><a href="{{doc['url_s']}}">{{ h.get_first(doc, 'title') }}</a></div>
     <p>{{doc.get('snippet_s', '...')}}</p>
     <hr/>
   </div>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/ForgeChat/forgechat/command.py
----------------------------------------------------------------------
diff --git a/ForgeChat/forgechat/command.py b/ForgeChat/forgechat/command.py
index 13b00fc..2a20414 100644
--- a/ForgeChat/forgechat/command.py
+++ b/ForgeChat/forgechat/command.py
@@ -146,7 +146,7 @@ class IRCBot(asynchat.async_chat):
         art = lnk.ref.artifact
         if security.has_access(art, 'read', user=M.User.anonymous())():
             index = art.index()
-            text = index['snippet_s'] or index['title_s']
+            text = index['snippet_s'] or h.get_first(index, 'title')
             url = urljoin(tg.config.get('base_url', 'http://sourceforge.net'), index['url_s'])
             self.notice(rcpt, '[%s] - [%s](%s)' % (lnk.link, text,url))
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/ForgeChat/forgechat/templates/chat/search.html
----------------------------------------------------------------------
diff --git a/ForgeChat/forgechat/templates/chat/search.html b/ForgeChat/forgechat/templates/chat/search.html
index debc1ec..bd64d04 100644
--- a/ForgeChat/forgechat/templates/chat/search.html
+++ b/ForgeChat/forgechat/templates/chat/search.html
@@ -24,7 +24,7 @@
 
   {% for doc in results %}
   <div class="grid-19">
-    <a href="{{doc['url_s']}}">{{doc.title_s}}</a><br/>
+    <a href="{{doc['url_s']}}">{{ h.get_first(doc, 'title') }}</a><br/>
     <pre>{{doc|pprint}}</pre>
     <hr/>
   </div>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/ForgeShortUrl/forgeshorturl/model/shorturl.py
----------------------------------------------------------------------
diff --git a/ForgeShortUrl/forgeshorturl/model/shorturl.py b/ForgeShortUrl/forgeshorturl/model/shorturl.py
index 7e550b7..f38894a 100644
--- a/ForgeShortUrl/forgeshorturl/model/shorturl.py
+++ b/ForgeShortUrl/forgeshorturl/model/shorturl.py
@@ -45,7 +45,7 @@ class ShortUrl(M.Artifact):
             full_url_s=self.full_url,
             short_name_s=self.short_name,
             description_s=self.description,
-            title_s='%s => %s' % (self.url(), self.full_url),
+            title='%s => %s' % (self.url(), self.full_url),
             private_b=self.private,
             type_s=self.type_s)
         return result

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index db7113a..1abeaac 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -206,7 +206,7 @@ class TicketHistory(Snapshot):
             return None
         result = Snapshot.index(self)
         result.update(
-            title_s='Version %d of %s' % (
+            title='Version %d of %s' % (
                 self.version, orig.summary),
             type_s='Ticket Snapshot',
             text=self.data.summary)
@@ -303,7 +303,7 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
     def index(self):
         result = VersionedArtifact.index(self)
         result.update(
-            title_s='Ticket %s' % self.ticket_num,
+            title='Ticket %s' % self.ticket_num,
             version_i=self.version,
             type_s=self.type_s,
             ticket_num_i=self.ticket_num,

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f211493f/ForgeWiki/forgewiki/model/wiki.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/model/wiki.py b/ForgeWiki/forgewiki/model/wiki.py
index c477b91..816a5ee 100644
--- a/ForgeWiki/forgewiki/model/wiki.py
+++ b/ForgeWiki/forgewiki/model/wiki.py
@@ -48,7 +48,6 @@ class PageHistory(Snapshot):
         result = Snapshot.index(self)
         title = '%s (version %d)' % (self.original().title, self.version)
         result.update(
-            title_s=title,
             title=title,
             type_s='WikiPage Snapshot',
             text=self.data.text)
@@ -130,7 +129,6 @@ class Page(VersionedArtifact, ActivityObject):
     def index(self):
         result = VersionedArtifact.index(self)
         result.update(
-            title_s=self.title,
             title=self.title,
             version_i=self.version,
             type_s='WikiPage',


[27/40] git commit: [#5951] Fixed AttributeError when _milestone field not of type milestone, and made behavior of all milestone-type field consistent

Posted by jo...@apache.org.
[#5951] Fixed AttributeError when _milestone field not of type milestone, and made behavior of all milestone-type field consistent

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5acf2ebe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5acf2ebe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5acf2ebe

Branch: refs/heads/cj/5963
Commit: 5acf2ebefaee838aadd465d7c76ddbeb3cb72b4a
Parents: ac4d60c
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Mar 27 18:41:35 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Mar 28 19:45:46 2013 +0000

----------------------------------------------------------------------
 .../forgetracker/templates/tracker/ticket.html     |    2 +
 ForgeTracker/forgetracker/widgets/ticket_form.py   |   18 ++++++++------
 2 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5acf2ebe/ForgeTracker/forgetracker/templates/tracker/ticket.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/ticket.html b/ForgeTracker/forgetracker/templates/tracker/ticket.html
index 1d229fe..333b371 100644
--- a/ForgeTracker/forgetracker/templates/tracker/ticket.html
+++ b/ForgeTracker/forgetracker/templates/tracker/ticket.html
@@ -88,6 +88,8 @@
                 {% else %}
                   nobody
                 {% endif %}
+              {% elif field.type == 'milestone' %}
+                <a href="{{c.app.url}}{{field.name[1:]}}/{{ticket.custom_fields[field.name]}}">{{ticket.custom_fields[field.name]}}</a>
               {% else %}
                 {{ticket.custom_fields[field.name]}}
               {% endif %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5acf2ebe/ForgeTracker/forgetracker/widgets/ticket_form.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_form.py b/ForgeTracker/forgetracker/widgets/ticket_form.py
index 465dce5..aaba037 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_form.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_form.py
@@ -37,13 +37,7 @@ class GenericTicketForm(ew.SimpleForm):
     def display_field_by_name(self, idx, ignore_errors=False):
         field = self.fields[idx]
         ctx = self.context_for(field)
-        if idx == '_milestone':
-            milestone_value = ctx.value
-            for milestone in reversed(field.options):  # reverse so del hits the correct indexes
-                if milestone.complete and (milestone.py_value != milestone_value):
-                    del field.options[field.options.index(milestone)]
-            ctx = self.context_for(field)
-        elif idx == 'assigned_to':
+        if idx == 'assigned_to':
             self._add_current_value_to_user_field(field, ctx.get('value'))
         elif idx == 'custom_fields':
             for cf in c.app.globals.custom_fields:
@@ -154,7 +148,7 @@ class TicketCustomField(object):
                 py_value=m.name,
                 complete=bool(m.complete)))
 
-        ssf = ew.SingleSelectField(
+        ssf = MilestoneField(
             label=field.label, name=str(field.name),
             options=options)
         return ssf
@@ -183,3 +177,11 @@ class TicketCustomField(object):
     def make(cls, field):
         factory = cls.SELECTOR.get(field.get('type'), cls._default)
         return factory(field)
+
+class MilestoneField(ew.SingleSelectField):
+    def display(self, *args, **kwargs):
+        milestone_value = kwargs['value']
+        for milestone in reversed(self.options):  # reverse so del hits the correct indexes
+            if milestone.complete and (milestone.py_value != milestone_value):
+                del self.options[self.options.index(milestone)]
+        return super(MilestoneField, self).display(*args, **kwargs)


[07/40] git commit: [#2835] ticket:287 Use radiobuttons for searching app/project

Posted by jo...@apache.org.
[#2835] ticket:287 Use radiobuttons for searching app/project


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/aaa1e453
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/aaa1e453
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/aaa1e453

Branch: refs/heads/cj/5963
Commit: aaa1e453a5c3533c316d0d37416d8a2459d042b3
Parents: 4ab5bda
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 11:59:28 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:34 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/widgets/search_results.html   |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aaa1e453/Allura/allura/templates/widgets/search_results.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/search_results.html b/Allura/allura/templates/widgets/search_results.html
index d6811a6..bc1cfdc 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -11,12 +11,12 @@
       Help
     </a>
   </div>
-
-
-
   <div class="grid-19">
-    <input type="submit" value="Search App">
-    <input type="submit" name="project" value="Search Entire Project">
+    {% set search_project = request.GET['project'] == '1' %}
+    <input type="radio" name="project" value="0" id="search-app" {% if not search_project %}checked{% endif %}>
+    <label for="search-app">Search {{c.app.config.options.mount_point or 'app'}}</label>
+    <input type="radio" name="project" value="1" id="search-project" {% if search_project %}checked{% endif %}>
+    <label for="search-project">Search entire project</label>
   </div>
   <div class="grid-19">
     Search history? <input type="checkbox" name="history"{% if history %} checked="checked"{% endif %}/>


[21/40] git commit: [#2835] ticket:303 Comment out help button

Posted by jo...@apache.org.
[#2835] ticket:303 Comment out help button


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/975b2093
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/975b2093
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/975b2093

Branch: refs/heads/cj/5963
Commit: 975b2093be08a993d17f55c9cdb246cb73d20ee6
Parents: fa1d3af
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 15 08:47:22 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:38 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/widgets/search_results.html   |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/975b2093/Allura/allura/templates/widgets/search_results.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/search_results.html b/Allura/allura/templates/widgets/search_results.html
index 997b5ec..b5b0c5a 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -6,10 +6,12 @@
     <input type="submit" value="Search">
   </div>
   <div class="grid-6">
+    {# TODO: when help text provided, show button
     <a href="#" class="btn search_help_modal">
       <b data-icon="{{g.icons['help'].char}}" class="ico {{g.icons['help'].css}}"></b>
       Help
     </a>
+    #}
   </div>
   <div class="grid-10">
     {% set search_project = request.GET['project'] == '1' %}


[14/40] git commit: [#2835] ticket:288 Change indexing

Posted by jo...@apache.org.
[#2835] ticket:288 Change indexing

* Don't append 'WikiPage' in title_s
* Don't append all fields into `text`


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/b5f42ced
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b5f42ced
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b5f42ced

Branch: refs/heads/cj/5963
Commit: b5f42ced3f07f5a929be1305e5e66b3c9c62eafb
Parents: c8cbb93
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 7 09:25:54 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:36 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/search.py       |    9 ++-------
 ForgeWiki/forgewiki/model/wiki.py |    2 +-
 2 files changed, 3 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b5f42ced/Allura/allura/lib/search.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/search.py b/Allura/allura/lib/search.py
index 4d73c83..44fce05 100644
--- a/Allura/allura/lib/search.py
+++ b/Allura/allura/lib/search.py
@@ -18,13 +18,8 @@ def solarize(obj):
     if obj is None: return None
     doc = obj.index()
     if doc is None: return None
-    text = doc.pop('text', '')
-    try:
-        text = text + pformat(doc.values())
-    except TypeError:
-        # log.exception('Indexing empty text: %s', doc)
-        text = pformat(doc.values())
-    doc['text'] = text
+    # if index() returned doc without text, assume empty text
+    doc['text'] = doc.pop('text', '')
     return doc
 
 class SearchError(SolrError):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b5f42ced/ForgeWiki/forgewiki/model/wiki.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/model/wiki.py b/ForgeWiki/forgewiki/model/wiki.py
index af88c04..dac92c7 100644
--- a/ForgeWiki/forgewiki/model/wiki.py
+++ b/ForgeWiki/forgewiki/model/wiki.py
@@ -129,7 +129,7 @@ class Page(VersionedArtifact, ActivityObject):
     def index(self):
         result = VersionedArtifact.index(self)
         result.update(
-            title_s='WikiPage %s' % self.title,
+            title_s=self.title,
             version_i=self.version,
             type_s='WikiPage',
             text=self.text)


[30/40] git commit: Create a new JSON object for the ticket to import

Posted by jo...@apache.org.
Create a new JSON object for the ticket to import

If the imported JSON object doesn't have the correct structure we need
to create it.


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/e8161e69
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/e8161e69
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/e8161e69

Branch: refs/heads/cj/5963
Commit: e8161e69c103daed29313d626cb358c3423e46ed
Parents: 5a3ff20
Author: Jon Schewe <jp...@mtu.net>
Authored: Tue Mar 26 18:32:18 2013 -0500
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Mar 28 20:42:12 2013 +0000

----------------------------------------------------------------------
 scripts/allura_import.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e8161e69/scripts/allura_import.py
----------------------------------------------------------------------
diff --git a/scripts/allura_import.py b/scripts/allura_import.py
index e6982b2..60858ea 100644
--- a/scripts/allura_import.py
+++ b/scripts/allura_import.py
@@ -81,8 +81,11 @@ def import_tracker(cli, project, tool, import_options, options, doc_txt, validat
                 if options.verbose:
                     print 'Ticket id %d already exists, skipping' % ticket_in['id']
                 continue
-            doc['trackers']['default']['artifacts'] = [ticket_in]
-            res = cli.call(url, doc=json.dumps(doc), options=json.dumps(import_options))
+            doc_import={}
+            doc_import['trackers'] = {}
+            doc_import['trackers']['default'] = {}
+            doc_import['trackers']['default']['artifacts'] = [ticket_in]
+            res = cli.call(url, doc=json.dumps(doc_import), options=json.dumps(import_options))
             assert res['status'] and not res['errors']
             if options.validate:
                 if res['warnings']:


[03/40] git commit: [#2835] ticket:287 Make search field bigger, add help button

Posted by jo...@apache.org.
[#2835] ticket:287 Make search field bigger, add help button


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/4ab5bda6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/4ab5bda6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/4ab5bda6

Branch: refs/heads/cj/5963
Commit: 4ab5bda6e99eb178b53cc187b51a136c75945456
Parents: db0dd9c
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 11:42:00 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:33 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/widgets/resources/css/search.css |    3 ++
 Allura/allura/lib/widgets/search.py                |    1 +
 .../allura/templates/widgets/search_results.html   |   16 +++++++++++++-
 3 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4ab5bda6/Allura/allura/lib/widgets/resources/css/search.css
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/css/search.css b/Allura/allura/lib/widgets/resources/css/search.css
new file mode 100644
index 0000000..16b792a
--- /dev/null
+++ b/Allura/allura/lib/widgets/resources/css/search.css
@@ -0,0 +1,3 @@
+input.search-query {
+  width: 95%;
+}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4ab5bda6/Allura/allura/lib/widgets/search.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/search.py b/Allura/allura/lib/widgets/search.py
index ec6ed51..fc17b3e 100644
--- a/Allura/allura/lib/widgets/search.py
+++ b/Allura/allura/lib/widgets/search.py
@@ -21,3 +21,4 @@ class SearchResults(ew_core.Widget):
         for f in self.fields:
             for r in f.resources():
                 yield r
+        yield ew.CSSLink('css/search.css')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4ab5bda6/Allura/allura/templates/widgets/search_results.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/search_results.html b/Allura/allura/templates/widgets/search_results.html
index 3e51c43..d6811a6 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -1,7 +1,19 @@
 <form method="GET" action=".">
-  <div class="grid-19">
-    <input type="text" name="q" value="{{q}}" class="defaultText" title="Search App"/>
+  <div class="grid-10">
+    <input type="text" name="q" value="{{q}}" class="search-query" title="Search App"/>
+  </div>
+  <div class="grid-3">
+    <input type="submit" value="Search">
+  </div>
+  <div class="grid-6">
+    <a href="#" class="btn search_help_modal">
+      <b data-icon="{{g.icons['help'].char}}" class="ico {{g.icons['help'].css}}"></b>
+      Help
+    </a>
   </div>
+
+
+
   <div class="grid-19">
     <input type="submit" value="Search App">
     <input type="submit" name="project" value="Search Entire Project">


[16/40] git commit: [#2835] ticket:288 Get rid of placeholders

Posted by jo...@apache.org.
[#2835] ticket:288 Get rid of placeholders


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/978b2410
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/978b2410
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/978b2410

Branch: refs/heads/cj/5963
Commit: 978b241023327b2d67b2c3343ee1494ff8283cbe
Parents: cd839bb
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 8 11:30:51 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:37 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/widgets/search_results.html   |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/978b2410/Allura/allura/templates/widgets/search_results.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/search_results.html b/Allura/allura/templates/widgets/search_results.html
index 4cfc891..997b5ec 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -43,8 +43,6 @@
     {% if doc['type_s'] %}<span class="gray"><sup>{{ '(%s)' % doc['type_s'] }}</sup></span>{% endif %}
     <br>
     {{ doc.snippet }}
-    TODO: change me to something useful! Mark <strong>matches</strong>.<br/>
-    an open source implementation of a software "forge", <strong>a web site</strong> that manages source code repositories, bug reports, discussions, mailing lists, wiki pages, blogs and more for any number of individual proje<br>
     <span class="gray">Last updated: {{ h.ago_string(doc['mod_date_dt']) }}</span>
     </p>
   </div>
@@ -55,5 +53,5 @@
 </div>
 <div class="grid-19" style="clear:both">
   {# TODO: highlight active sorting order #}
-  <p>Sort by <a href="#"><strong>relevance</strong></a> or <a href="#">date</a></p>
+  {# <p>Sort by <a href="#"><strong>relevance</strong></a> or <a href="#">date</a></p> #}
 </div>


[13/40] git commit: [#2835] ticket:288 Show artifact type next to title

Posted by jo...@apache.org.
[#2835] ticket:288 Show artifact type next to title


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/a9f0bdb9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/a9f0bdb9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/a9f0bdb9

Branch: refs/heads/cj/5963
Commit: a9f0bdb9b4af317da01f36928e43508486a78123
Parents: b5f42ce
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Mar 7 09:26:55 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:36 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/widgets/resources/css/search.css |    2 +-
 .../allura/templates/widgets/search_results.html   |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a9f0bdb9/Allura/allura/lib/widgets/resources/css/search.css
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/css/search.css b/Allura/allura/lib/widgets/resources/css/search.css
index 614bc01..f687399 100644
--- a/Allura/allura/lib/widgets/resources/css/search.css
+++ b/Allura/allura/lib/widgets/resources/css/search.css
@@ -2,7 +2,7 @@ input.search-query {
   width: 95%;
 }
 
-.date {
+.gray {
   color: #aaa;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a9f0bdb9/Allura/allura/templates/widgets/search_results.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/search_results.html b/Allura/allura/templates/widgets/search_results.html
index 92b7cb6..74eb466 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -38,11 +38,13 @@
   <div class="grid-19">
     {# TODO: mark matches in title and snippet #}
     <p>
-    <a href="{{doc['url_paginated'] or doc['url_s']}}">{{ doc.title_s }}</a><br>
+    <a href="{{doc['url_paginated'] or doc['url_s']}}">{{ doc.title_s }}</a>
+    {% if doc['type_s'] %}<span class="gray"><sup>{{ '(%s)' % doc['type_s'] }}</sup></span>{% endif %}
+    <br>
     {{ doc.snippet }}
     TODO: change me to something useful! Mark <strong>matches</strong>.<br/>
     an open source implementation of a software "forge", <strong>a web site</strong> that manages source code repositories, bug reports, discussions, mailing lists, wiki pages, blogs and more for any number of individual proje<br>
-    <span class="date">Last updated: {{ h.ago_string(doc['mod_date_dt']) }}</span>
+    <span class="gray">Last updated: {{ h.ago_string(doc['mod_date_dt']) }}</span>
     </p>
   </div>
 {% endfor %}


[15/40] git commit: [#2835] ticket:288 Always use an empty string instead of None in `text` field

Posted by jo...@apache.org.
[#2835] ticket:288 Always use an empty string instead of None in `text` field


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/01c9d1ca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/01c9d1ca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/01c9d1ca

Branch: refs/heads/cj/5963
Commit: 01c9d1caf169d237b7da99c1210ca892dbdbb789
Parents: 978b241
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 8 11:55:54 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:37 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/search.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/01c9d1ca/Allura/allura/lib/search.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/search.py b/Allura/allura/lib/search.py
index 44fce05..17fbf57 100644
--- a/Allura/allura/lib/search.py
+++ b/Allura/allura/lib/search.py
@@ -19,7 +19,8 @@ def solarize(obj):
     doc = obj.index()
     if doc is None: return None
     # if index() returned doc without text, assume empty text
-    doc['text'] = doc.pop('text', '')
+    if not doc.get('text'):
+        doc['text'] = ''
     return doc
 
 class SearchError(SolrError):


[04/40] git commit: [#2835] ticket:287 Sorting controls stub

Posted by jo...@apache.org.
[#2835] ticket:287 Sorting controls stub


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5b1eba0e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5b1eba0e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5b1eba0e

Branch: refs/heads/cj/5963
Commit: 5b1eba0ec14f7e17b5db432aae54b82f6bef3f97
Parents: 86bd80f
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 15:21:07 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:34 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/widgets/search_results.html   |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5b1eba0e/Allura/allura/templates/widgets/search_results.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/search_results.html b/Allura/allura/templates/widgets/search_results.html
index 0b1fcdf..5e66ccd 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -46,7 +46,11 @@
     </p>
   </div>
 {% endfor %}
-<div class="grid-19" style="clear:both">
+<div class="grid-19">
   {{widget.fields['page_list'].display(limit=limit, page=page, count=count)}}
   {{widget.fields['page_size'].display(limit=limit, count=count)}}
 </div>
+<div class="grid-19" style="clear:both">
+  {# TODO: highlight active sorting order #}
+  <p>Sort by <a href="#"><strong>relevance</strong></a> or <a href="#">date</a></p>
+</div>


[20/40] git commit: [#2835] ticket:288 Preserve old indexation logic for tickets

Posted by jo...@apache.org.
[#2835] ticket:288 Preserve old indexation logic for tickets


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/fa1d3aff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/fa1d3aff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/fa1d3aff

Branch: refs/heads/cj/5963
Commit: fa1d3affa3a0126028330b6c4fc27b2107de58c7
Parents: 88d7b82
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Mar 8 13:00:39 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:38 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/search.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fa1d3aff/Allura/allura/lib/search.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/search.py b/Allura/allura/lib/search.py
index 17fbf57..a6587f1 100644
--- a/Allura/allura/lib/search.py
+++ b/Allura/allura/lib/search.py
@@ -1,15 +1,12 @@
 import re
 import socket
-import cPickle as pickle
 from logging import getLogger
 from pprint import pformat
-from itertools import islice, chain
 
 import markdown
 from pylons import tmpl_context as c, app_globals as g
 from pysolr import SolrError
 
-from . import helpers as h
 from .markdown_extensions import ForgeExtension
 
 log = getLogger(__name__)
@@ -21,6 +18,10 @@ def solarize(obj):
     # if index() returned doc without text, assume empty text
     if not doc.get('text'):
         doc['text'] = ''
+    # Tracker uses search with default solr parser. It would match only on
+    # `text`, so we append all other field values into `text`, to match on it too.
+    if getattr(obj, 'type_s', '').lower() == 'ticket':
+        doc['text'] += pformat(doc.values())
     return doc
 
 class SearchError(SolrError):


[06/40] git commit: [#2835] ticket:287 Add search comments checkbox

Posted by jo...@apache.org.
[#2835] ticket:287 Add search comments checkbox


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/b7f967db
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b7f967db
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b7f967db

Branch: refs/heads/cj/5963
Commit: b7f967dbca7095ba78df3110f44fc1f74ea1a4af
Parents: aaa1e45
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Mar 5 12:06:30 2013 +0000
Committer: Dave Brondsema <db...@geek.net>
Committed: Tue Mar 26 20:57:34 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/widgets/search_results.html   |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b7f967db/Allura/allura/templates/widgets/search_results.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/search_results.html b/Allura/allura/templates/widgets/search_results.html
index bc1cfdc..6700c48 100644
--- a/Allura/allura/templates/widgets/search_results.html
+++ b/Allura/allura/templates/widgets/search_results.html
@@ -11,15 +11,20 @@
       Help
     </a>
   </div>
-  <div class="grid-19">
+  <div class="grid-10">
     {% set search_project = request.GET['project'] == '1' %}
     <input type="radio" name="project" value="0" id="search-app" {% if not search_project %}checked{% endif %}>
     <label for="search-app">Search {{c.app.config.options.mount_point or 'app'}}</label>
     <input type="radio" name="project" value="1" id="search-project" {% if search_project %}checked{% endif %}>
     <label for="search-project">Search entire project</label>
   </div>
-  <div class="grid-19">
-    Search history? <input type="checkbox" name="history"{% if history %} checked="checked"{% endif %}/>
+  <div class="grid-9">
+    {% if not search_comments_disable %}
+      <label for="search-comments">Search comments?</label>
+      <input id="search-comments" type="checkbox" name="search_comments"{% if search_comments %} checked{% endif %}>
+    {% endif %}
+    <label for="search-history">Search history?</label>
+    <input id="search-history" type="checkbox" name="history"{% if history %} checked{% endif %}>
   </div>
 </form>
 <div style="clear:both">&nbsp;</div>


[26/40] git commit: [#5951] Fixed javascript error when adding milestones on field management page

Posted by jo...@apache.org.
[#5951] Fixed javascript error when adding milestones on field management page

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ac4d60c3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ac4d60c3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ac4d60c3

Branch: refs/heads/cj/5963
Commit: ac4d60c3cd4d7b9bbb648a742d87f8f8b20c6764
Parents: 6f44f8a
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Mar 27 17:24:16 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Mar 28 19:45:45 2013 +0000

----------------------------------------------------------------------
 .../resources/js/sortable_repeated_field.js        |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ac4d60c3/Allura/allura/lib/widgets/resources/js/sortable_repeated_field.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/sortable_repeated_field.js b/Allura/allura/lib/widgets/resources/js/sortable_repeated_field.js
index 251274c..7b46bef 100644
--- a/Allura/allura/lib/widgets/resources/js/sortable_repeated_field.js
+++ b/Allura/allura/lib/widgets/resources/js/sortable_repeated_field.js
@@ -79,7 +79,7 @@
                 .removeClass(self.opts.stub_cls)
                 .addClass(self.opts.field_cls)
                 .show()
-                .find(':input[name^='+tpl_name+']').each(function() {
+                .find(':input[name^="'+tpl_name+'"]').each(function() {
                     var $this = $(this);
                     var name = $this.attr('name');
                     if(name){
@@ -120,7 +120,7 @@
             var prefix = self.fld_name() + '-';
             var regex = new RegExp(prefix + /\d+/.source)
             self.data.$flist.children().each(function(index) {
-                $(this).find(':input[name^='+prefix+']').each(function() {
+                $(this).find(':input[name^="'+prefix+'"]').each(function() {
                     var $this=$(this);
                     var name=$this.attr('name');
                     var newname = name.replace(regex, prefix + index);