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

[01/13] git commit: [#2835] fix test to match search help text changes

Updated Branches:
  refs/heads/db/2835 d958fae68 -> 9eceea668


[#2835] fix test to match search help text 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/54cca78f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/54cca78f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/54cca78f

Branch: refs/heads/db/2835
Commit: 54cca78f463643b3475d1ce94755d0a57853ba19
Parents: d958fae
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Apr 24 18:38:52 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Apr 24 18:38:52 2013 +0000

----------------------------------------------------------------------
 ForgeWiki/forgewiki/tests/functional/test_root.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/54cca78f/ForgeWiki/forgewiki/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index 2b6a190..14e70c6 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -131,7 +131,7 @@ class TestRootController(TestController):
         assert btn is not None, "Can't find a help button"
         div = r.html.find('div', attrs={'id': 'lightbox_search_help_modal'})
         assert div is not None, "Can't find help text"
-        assert_in('Searching the wiki', div.text)
+        assert_in('To search for an exact phrase', div.text)
 
     def test_page_index(self):
         response = self.app.get('/wiki/tést/')


[08/13] git commit: [#6078] fix gitpython URL with our patches

Posted by br...@apache.org.
[#6078] fix gitpython URL with our patches


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

Branch: refs/heads/db/2835
Commit: 5f980b72ba2acc182999a5bb3b43aacc074660f3
Parents: 115cdad
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Mon Apr 15 20:41:58 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Apr 24 21:39:40 2013 +0000

----------------------------------------------------------------------
 requirements-sf.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5f980b72/requirements-sf.txt
----------------------------------------------------------------------
diff --git a/requirements-sf.txt b/requirements-sf.txt
index ed3e552..0923185 100644
--- a/requirements-sf.txt
+++ b/requirements-sf.txt
@@ -17,7 +17,7 @@ wsgipreload==1.2
 pyzmq==2.1.7
 html2text==3.200.3dev-20121112
 
-# use version built from https://github.com/johnsca/GitPython/commits/0.3.2-RC1-20130424
+# use version built from https://github.com/johnsca/GitPython/commits/tv/6000
 # for unmerged fixes for [#5411], [#6000], and [#6078]
 GitPython==0.3.2.RC1-20130424
 


[09/13] git commit: Pass project explicity to fix errors in setup-app

Posted by br...@apache.org.
Pass project explicity to fix errors in setup-app

Signed-off-by: Tim Van Steenburgh <tv...@gmail.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/0cccda73
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/0cccda73
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/0cccda73

Branch: refs/heads/db/2835
Commit: 0cccda7381d9e82b6e35c47323048ff1b730671f
Parents: 5f980b7
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Apr 25 03:11:31 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Apr 25 03:11:31 2013 +0000

----------------------------------------------------------------------
 ForgeUserStats/forgeuserstats/main.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0cccda73/ForgeUserStats/forgeuserstats/main.py
----------------------------------------------------------------------
diff --git a/ForgeUserStats/forgeuserstats/main.py b/ForgeUserStats/forgeuserstats/main.py
index 950dfc8..1951cee 100644
--- a/ForgeUserStats/forgeuserstats/main.py
+++ b/ForgeUserStats/forgeuserstats/main.py
@@ -106,8 +106,8 @@ class ForgeUserStatsApp(Application):
 
     def __init__(self, project, config):
         Application.__init__(self, project, config)
-        role_admin = M.ProjectRole.by_name('Admin')._id
-        role_anon = M.ProjectRole.by_name('*anonymous')._id
+        role_admin = M.ProjectRole.by_name('Admin', project)._id
+        role_anon = M.ProjectRole.by_name('*anonymous', project)._id
         self.config.acl = [
             M.ACE.allow(role_anon, 'read'),
             M.ACE.allow(role_admin, 'admin')]


[06/13] git commit: [#6000] Updated GitPython version

Posted by br...@apache.org.
[#6000] Updated GitPython version

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/51f5361f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/51f5361f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/51f5361f

Branch: refs/heads/db/2835
Commit: 51f5361f0bdacdf93b95f1a32487bb4b80f96d6e
Parents: d8a9c75
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Apr 24 21:18:08 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Apr 24 21:18:08 2013 +0000

----------------------------------------------------------------------
 requirements-sf.txt |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/51f5361f/requirements-sf.txt
----------------------------------------------------------------------
diff --git a/requirements-sf.txt b/requirements-sf.txt
index 42a1b02..ed3e552 100644
--- a/requirements-sf.txt
+++ b/requirements-sf.txt
@@ -17,9 +17,9 @@ wsgipreload==1.2
 pyzmq==2.1.7
 html2text==3.200.3dev-20121112
 
-# use version built from https://github.com/42cc/GitPython/commits/0.3.2-RC1-20130214
-# for unmerged fix for [#5411]
-GitPython==0.3.2.RC1.20130214
+# use version built from https://github.com/johnsca/GitPython/commits/0.3.2-RC1-20130424
+# for unmerged fixes for [#5411], [#6000], and [#6078]
+GitPython==0.3.2.RC1-20130424
 
 WebError==0.10.3-20130423
 


[04/13] git commit: [#4370] ticket:322 Don't redirect from API to login url

Posted by br...@apache.org.
[#4370] ticket:322 Don't redirect from API to login url


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

Branch: refs/heads/db/2835
Commit: ad54b2fde6231bf18d7489d4c67c4050e80aef24
Parents: 3207e95
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Apr 24 10:10:28 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Apr 24 20:02:25 2013 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ad54b2fd/Allura/allura/lib/custom_middleware.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/custom_middleware.py b/Allura/allura/lib/custom_middleware.py
index 6633489..6c121b4 100644
--- a/Allura/allura/lib/custom_middleware.py
+++ b/Allura/allura/lib/custom_middleware.py
@@ -93,7 +93,8 @@ class LoginRedirectMiddleware(object):
     def __call__(self, environ, start_response):
         status, headers, app_iter, exc_info = call_wsgi_application(
             self.app, environ, catch_exc_info=True)
-        if status[:3] == '401':
+        is_api_request = environ.get('PATH_INFO', '').startswith('/rest/')
+        if status[:3] == '401' and not is_api_request:
             login_url = tg.config.get('auth.login_url', '/auth/')
             if environ['REQUEST_METHOD'] == 'GET':
                 return_to = environ['PATH_INFO']


[12/13] git commit: [#5501] Restore old regex for project names

Posted by br...@apache.org.
[#5501] Restore old regex for project names

Signed-off-by: Tim Van Steenburgh <tv...@gmail.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/8ade72f0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8ade72f0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8ade72f0

Branch: refs/heads/db/2835
Commit: 8ade72f0c6049e284e0a927b55a791f4b9735134
Parents: 37c78ab
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Apr 25 14:11:25 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Apr 25 16:58:45 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/project.py               |    6 ++++--
 Allura/allura/lib/helpers.py                       |    3 ++-
 Allura/allura/model/project.py                     |    2 +-
 .../allura/tests/functional/test_neighborhood.py   |    7 +++----
 4 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8ade72f0/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index 11ef3e3..2f59a38 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -583,14 +583,16 @@ class NeighborhoodAdminController(object):
         result = True
         if anchored_tools.strip() != '':
             try:
-                validate_tools = dict((tool.split(':')[0].lower(), tool.split(':')[1]) for tool in anchored_tools.replace(' ', '').split(','))
+                validate_tools = dict(
+                    (tool.split(':')[0].lower(), tool.split(':')[1])
+                    for tool in anchored_tools.replace(' ', '').split(','))
             except Exception:
                 flash('Anchored tools "%s" is invalid' % anchored_tools,'error')
                 result = False
 
 
         for tool in validate_tools.keys():
-            if not h.re_path_portion.match(tool):
+            if not h.re_tool_mount_point.match(tool):
                 flash('Anchored tools "%s" is invalid' % anchored_tools,'error')
                 result = False
         if result:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8ade72f0/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index a941d44..ea2b4d2 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -53,7 +53,8 @@ from allura.lib import AsciiDammit
 from .security import has_access
 
 re_path_portion_fragment = re.compile(r'[a-z][-a-z0-9]*')
-re_path_portion = re.compile(r'^[a-z][-a-z0-9]{0,62}$')
+re_path_portion = re.compile(r'^[a-z][-a-z0-9]{2,}$')
+re_tool_mount_point = re.compile(r'^[a-z][-a-z0-9]{0,62}$')
 re_clean_vardec_key = re.compile(r'''\A
 ( # first part
 \w+# name...

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8ade72f0/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 137e98b..d207aab 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -547,7 +547,7 @@ class Project(MappedClass, ActivityNode, ActivityObject):
             for x in range(10):
                 if self.app_instance(mount_point) is None: break
                 mount_point = base_mount_point + '-%d' % x
-        if not h.re_path_portion.match(mount_point):
+        if not h.re_tool_mount_point.match(mount_point):
             raise exceptions.ToolError, 'Mount point "%s" is invalid' % mount_point
         # HACK: reserved url components
         if mount_point in ('feed', 'index', 'icon', '_nav.json'):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8ade72f0/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 41c7121..f91b5cb 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -741,10 +741,9 @@ class TestNeighborhood(TestController):
         assert_equal(r.json, dict(suggested_name='test'))
 
     def test_name_check(self):
-        r = self.app.get('/p/check_names?unix_name=My+Moz')
-        assert r.json['unixname_message'] == 'Please use only letters, numbers, and dashes 3-15 characters long.'
-        r = self.app.get('/p/check_names?unix_name=Te%st!')
-        assert r.json['unixname_message'] == 'Please use only letters, numbers, and dashes 3-15 characters long.'
+        for name in ('My+Moz', 'Te%st!', 'ab', 'a' * 16):
+            r = self.app.get('/p/check_names?unix_name=%s' % name)
+            assert r.json['unixname_message'] == 'Please use only letters, numbers, and dashes 3-15 characters long.'
         r = self.app.get('/p/check_names?unix_name=mymoz')
         assert_equal(r.json['unixname_message'], False)
         r = self.app.get('/p/check_names?unix_name=test')


[07/13] git commit: [#6078] Chunk processing of commits when cleaning data during repo refresh to avoid BSON doc size limits

Posted by br...@apache.org.
[#6078] Chunk processing of commits when cleaning data during repo refresh to avoid BSON doc size limits

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/115cdad1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/115cdad1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/115cdad1

Branch: refs/heads/db/2835
Commit: 115cdad111a046102abf4d8063482c6c6bf0c615
Parents: 51f5361
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Apr 11 16:18:12 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Apr 24 21:37:34 2013 +0000

----------------------------------------------------------------------
 Allura/allura/scripts/refreshrepo.py |   66 +++++++++++++++++------------
 1 files changed, 39 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/115cdad1/Allura/allura/scripts/refreshrepo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/scripts/refreshrepo.py b/Allura/allura/scripts/refreshrepo.py
index 43ff7c2..f55a054 100644
--- a/Allura/allura/scripts/refreshrepo.py
+++ b/Allura/allura/scripts/refreshrepo.py
@@ -68,42 +68,54 @@ class RefreshRepo(ScriptTask):
                     if options.clean:
                         ci_ids = list(c.app.repo.all_commit_ids())
                         log.info("Deleting mongo data for %i commits...", len(ci_ids))
-                        tree_ids = [
-                                tree_id for doc in
-                                M.repo.TreesDoc.m.find({"_id": {"$in": ci_ids}},
-                                                       {"tree_ids": 1})
-                                for tree_id in doc.get("tree_ids", [])]
-
-                        i = M.repo.CommitDoc.m.find({"_id": {"$in": ci_ids}}).count()
-                        log.info("Deleting %i CommitDoc docs...", i)
-                        M.repo.CommitDoc.m.remove({"_id": {"$in": ci_ids}})
+                        # like the tree_ids themselves below, we need to process these in
+                        # chunks to avoid hitting the BSON max size limit
+                        tree_ids = []
+                        for ci_ids_chunk in chunked_list(ci_ids, 3000):
+                            tree_ids.extend([
+                                    tree_id for doc in
+                                    M.repo.TreesDoc.m.find({"_id": {"$in": ci_ids_chunk}},
+                                                           {"tree_ids": 1})
+                                    for tree_id in doc.get("tree_ids", [])])
+
+                            i = M.repo.CommitDoc.m.find({"_id": {"$in": ci_ids_chunk}}).count()
+                            if i:
+                                log.info("Deleting %i CommitDoc docs...", i)
+                                M.repo.CommitDoc.m.remove({"_id": {"$in": ci_ids_chunk}})
 
                         # delete these in chunks, otherwise the query doc can
                         # exceed the max BSON size limit (16MB at the moment)
                         for tree_ids_chunk in chunked_list(tree_ids, 300000):
                             i = M.repo.TreeDoc.m.find({"_id": {"$in": tree_ids_chunk}}).count()
-                            log.info("Deleting %i TreeDoc docs...", i)
-                            M.repo.TreeDoc.m.remove({"_id": {"$in": tree_ids_chunk}})
+                            if i:
+                                log.info("Deleting %i TreeDoc docs...", i)
+                                M.repo.TreeDoc.m.remove({"_id": {"$in": tree_ids_chunk}})
                         del tree_ids
 
                         # delete these after TreeDoc and LastCommitDoc so that if
                         # we crash, we don't lose the ability to delete those
-                        i = M.repo.TreesDoc.m.find({"_id": {"$in": ci_ids}}).count()
-                        log.info("Deleting %i TreesDoc docs...", i)
-                        M.repo.TreesDoc.m.remove({"_id": {"$in": ci_ids}})
-
-                        # delete LastCommitDocs
-                        i = M.repo.LastCommitDoc.m.find(dict(commit_ids={'$in': ci_ids})).count()
-                        log.info("Deleting %i remaining LastCommitDoc docs, by repo id...", i)
-                        M.repo.LastCommitDoc.m.remove(dict(commit_ids={'$in': ci_ids}))
-
-                        i = M.repo.DiffInfoDoc.m.find({"_id": {"$in": ci_ids}}).count()
-                        log.info("Deleting %i DiffInfoDoc docs...", i)
-                        M.repo.DiffInfoDoc.m.remove({"_id": {"$in": ci_ids}})
-
-                        i = M.repo.CommitRunDoc.m.find({"commit_ids": {"$in": ci_ids}}).count()
-                        log.info("Deleting %i CommitRunDoc docs...", i)
-                        M.repo.CommitRunDoc.m.remove({"commit_ids": {"$in": ci_ids}})
+                        for ci_ids_chunk in chunked_list(ci_ids, 3000):
+                            # delete TreesDocs
+                            i = M.repo.TreesDoc.m.find({"_id": {"$in": ci_ids_chunk}}).count()
+                            if i:
+                                log.info("Deleting %i TreesDoc docs...", i)
+                                M.repo.TreesDoc.m.remove({"_id": {"$in": ci_ids_chunk}})
+
+                            # delete LastCommitDocs
+                            i = M.repo.LastCommitDoc.m.find(dict(commit_ids={'$in': ci_ids_chunk})).count()
+                            if i:
+                                log.info("Deleting %i remaining LastCommitDoc docs, by repo id...", i)
+                                M.repo.LastCommitDoc.m.remove(dict(commit_ids={'$in': ci_ids_chunk}))
+
+                            i = M.repo.DiffInfoDoc.m.find({"_id": {"$in": ci_ids_chunk}}).count()
+                            if i:
+                                log.info("Deleting %i DiffInfoDoc docs...", i)
+                                M.repo.DiffInfoDoc.m.remove({"_id": {"$in": ci_ids_chunk}})
+
+                            i = M.repo.CommitRunDoc.m.find({"commit_ids": {"$in": ci_ids_chunk}}).count()
+                            if i:
+                                log.info("Deleting %i CommitRunDoc docs...", i)
+                                M.repo.CommitRunDoc.m.remove({"commit_ids": {"$in": ci_ids_chunk}})
                         del ci_ids
 
                     try:


[11/13] git commit: [#5501] Add contextual doc explaining valid mount points

Posted by br...@apache.org.
[#5501] Add contextual doc explaining valid mount points

Signed-off-by: Tim Van Steenburgh <tv...@gmail.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/37c78abe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/37c78abe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/37c78abe

Branch: refs/heads/db/2835
Commit: 37c78abeaecfb75ecc1e8b07958ee506a14cac05
Parents: 14569f1
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Apr 24 20:11:16 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Apr 25 16:58:44 2013 +0000

----------------------------------------------------------------------
 .../allura/ext/admin/templates/project_tools.html  |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/37c78abe/Allura/allura/ext/admin/templates/project_tools.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/project_tools.html b/Allura/allura/ext/admin/templates/project_tools.html
index c4344cb..6516039 100644
--- a/Allura/allura/ext/admin/templates/project_tools.html
+++ b/Allura/allura/ext/admin/templates/project_tools.html
@@ -50,7 +50,9 @@
     <div class="grid-13"><input type="text" name="new.mount_label" class="new_mount_label"></div>
     <label class="grid-13">Mount Point</label>
     <div class="grid-13"><input type="text" name="new.mount_point" class="new_mount_point"></div>
-    <div class="grid-13">&nbsp;</div>
+    <div class="grid-13"><small>* The mount point is the name of the tool as it will appear in a URL.
+      A valid mount point must begin with a letter, contain only letters, numbers, and dashes,
+      and be from 1-63 characters in length.</small></div>
     <hr>
     <div class="grid-13">&nbsp;</div>
     <div class="grid-13">


[03/13] git commit: [#4370] ticket:322 Test for REST API permissions

Posted by br...@apache.org.
[#4370] ticket:322 Test for REST API permissions


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

Branch: refs/heads/db/2835
Commit: 3207e959ac1e12e98e6b55f3b6475d0e103b3a9e
Parents: 54cca78
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Apr 24 09:43:57 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Apr 24 20:02:25 2013 +0000

----------------------------------------------------------------------
 Allura/allura/tests/functional/test_rest.py |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3207e959/Allura/allura/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_rest.py b/Allura/allura/tests/functional/test_rest.py
index aaba26b..68f769f 100644
--- a/Allura/allura/tests/functional/test_rest.py
+++ b/Allura/allura/tests/functional/test_rest.py
@@ -19,9 +19,12 @@
 
 from datetime import datetime, timedelta
 
+from nose.tools import assert_equal
+
 from allura.tests import decorators as td
 from alluratest.controller import TestRestApiBase
 from allura.lib import helpers as h
+from allura import model as M
 
 class TestRestHome(TestRestApiBase):
 
@@ -77,3 +80,19 @@ class TestRestHome(TestRestApiBase):
         assert r.status_int == 200
         assert r.json['title'].encode('utf-8') == 'tést', r.json
 
+    @td.with_wiki
+    def test_deny_access(self):
+        wiki = M.Project.query.get(shortname='test').app_instance('wiki')
+        anon_read_perm = M.ACE.allow(M.ProjectRole.by_name('*anonymous')._id, 'read')
+        auth_read_perm = M.ACE.allow(M.ProjectRole.by_name('*authenticated')._id, 'read')
+        acl = wiki.config.acl
+        if anon_read_perm in acl:
+            acl.remove(anon_read_perm)
+        if auth_read_perm in acl:
+            acl.remove(auth_read_perm)
+        self.app.get('/rest/p/test/wiki/Home/',
+                     extra_environ={'username': '*anonymous'},
+                     status=401)
+        self.app.get('/rest/p/test/wiki/Home/',
+                     extra_environ={'username': 'test-user-0'},
+                     status=401)


[10/13] git commit: [#5501] Allow 1 and 2-char mount points

Posted by br...@apache.org.
[#5501] Allow 1 and 2-char mount points

Signed-off-by: Tim Van Steenburgh <tv...@gmail.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/14569f11
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/14569f11
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/14569f11

Branch: refs/heads/db/2835
Commit: 14569f1187270cd0ad43ed9c8a4938d012b5ce8f
Parents: 0cccda7
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Apr 24 19:33:03 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Apr 25 16:58:44 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/helpers.py              |    2 +-
 Allura/allura/tests/model/test_project.py |    8 ++++++++
 2 files changed, 9 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/14569f11/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index c6b144f..a941d44 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -53,7 +53,7 @@ from allura.lib import AsciiDammit
 from .security import has_access
 
 re_path_portion_fragment = re.compile(r'[a-z][-a-z0-9]*')
-re_path_portion = re.compile(r'^[a-z][-a-z0-9]{2,}$')
+re_path_portion = re.compile(r'^[a-z][-a-z0-9]{0,62}$')
 re_clean_vardec_key = re.compile(r'''\A
 ( # first part
 \w+# name...

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/14569f11/Allura/allura/tests/model/test_project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_project.py b/Allura/allura/tests/model/test_project.py
index 4f14bf0..0a218b1 100644
--- a/Allura/allura/tests/model/test_project.py
+++ b/Allura/allura/tests/model/test_project.py
@@ -72,6 +72,14 @@ def test_project():
     with td.raises(ToolError):
         # mount point reserved
         c.project.install_app('Wiki', 'feed')
+    with td.raises(ToolError):
+        # mount point too long
+        c.project.install_app('Wiki', 'a' * 64)
+    with td.raises(ToolError):
+        # mount point must begin with letter
+        c.project.install_app('Wiki', '1')
+    # single letter mount points are allowed
+    c.project.install_app('Wiki', 'a')
     # Make sure the project support page is reset if the tool it was pointing
     # to is uninstalled.
     assert c.project.support_page == ''


[13/13] git commit: [#2835] avoid double-escaping solr text by escaping it only on the way out. tests

Posted by br...@apache.org.
[#2835] avoid double-escaping solr text by escaping it only on the way out.  tests


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

Branch: refs/heads/db/2835
Commit: 9eceea6680fe97e2af57523452ade27d2a3b34dc
Parents: 8ade72f
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Apr 25 20:20:12 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Apr 25 20:20:12 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/search.py           |    4 +-
 Allura/allura/tests/unit/test_solr.py |   86 +++++++++++++++++++++++++++-
 2 files changed, 85 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9eceea66/Allura/allura/lib/search.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/search.py b/Allura/allura/lib/search.py
index 203e37a..d43af9c 100644
--- a/Allura/allura/lib/search.py
+++ b/Allura/allura/lib/search.py
@@ -46,8 +46,6 @@ def solarize(obj):
     text = doc['text']
     text = g.markdown.convert(text)
     doc['text'] = jinja2.Markup.escape(text).striptags()
-    # striptags decodes html entities, so we should escape them again
-    doc['text'] = jinja2.Markup.escape(doc['text'])
     return doc
 
 class SearchError(SolrError):
@@ -201,7 +199,7 @@ def search_app(q='', fq=None, app=True, **kw):
     score_url = url(request.path, params=params)
     params.update({'sort': date_url})
     date_url = url(request.path, params=params)
-    return dict(q=q, history=history, results=results or [],
+    return dict(q=q, history=history, results=list(results) or [],
                 count=count, limit=limit, page=page, search_error=search_error,
                 sort_score_url=score_url, sort_date_url=date_url,
                 sort_field=field)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9eceea66/Allura/allura/tests/unit/test_solr.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_solr.py b/Allura/allura/tests/unit/test_solr.py
index 5226f07..f431ea3 100644
--- a/Allura/allura/tests/unit/test_solr.py
+++ b/Allura/allura/tests/unit/test_solr.py
@@ -16,11 +16,15 @@
 #       under the License.
 
 import unittest
+
 import mock
 from nose.tools import assert_equal
+from markupsafe import Markup
 
+from allura.lib import helpers as h
+from allura.tests import decorators as td
 from allura.lib.solr import Solr
-from allura.lib.search import solarize
+from allura.lib.search import solarize, search_app
 
 class TestSolr(unittest.TestCase):
     @mock.patch('allura.lib.solr.pysolr')
@@ -72,5 +76,83 @@ class TestSolarize(unittest.TestCase):
         obj = mock.MagicMock()
         obj.index.return_value = {'text': '<script>alert(1)</script>'}
         assert_equal(solarize(obj), {'text': ''})
+
         obj.index.return_value = {'text': '&lt;script&gt;alert(1)&lt;/script&gt;'}
-        assert_equal(solarize(obj), {'text': '&lt;script&gt;alert(1)&lt;/script&gt;'})
+        assert_equal(solarize(obj), {'text': '<script>alert(1)</script>'})
+
+
+class TestSearch_app(unittest.TestCase):
+
+    @td.with_wiki
+    @mock.patch('allura.lib.search.url')
+    @mock.patch('allura.lib.search.request')
+    def test_basic(self, req, url_fn):
+        req.GET = dict()
+        req.path = '/test/search'
+        url_fn.side_effect = ['the-score-url', 'the-date-url']
+        with h.push_context('test', 'wiki', neighborhood='Projects'):
+            resp = search_app(q='foo bar')
+        assert_equal(resp, dict(
+            q='foo bar',
+            history=None,
+            results=[],
+            count=0,
+            limit=25,
+            page=0,
+            search_error=None,
+            sort_score_url='the-score-url',
+            sort_date_url='the-date-url',
+            sort_field='score',
+        ))
+
+    @td.with_wiki
+    @mock.patch('allura.lib.search.g.solr.search')
+    @mock.patch('allura.lib.search.url')
+    @mock.patch('allura.lib.search.request')
+    def test_escape_solr_text(self, req, url_fn, solr_search):
+        req.GET = dict()
+        req.path = '/test/wiki/search'
+        url_fn.side_effect = ['the-score-url', 'the-date-url']
+        results = mock.Mock(hits=2, docs=[
+                {'id': 123, 'type_s':'WikiPage Snapshot', 'url_s':'/test/wiki/Foo', 'version_i':2},
+                {'id': 321, 'type_s':'Post'},
+            ], highlighting={
+                123: dict(title='some #ALLURA-HIGHLIGHT-START#Foo#ALLURA-HIGHLIGHT-END# stuff',
+                         text='scary <script>alert(1)</script> bar'),
+                321: dict(title='blah blah',
+                         text='less scary but still dangerous &lt;script&gt;alert(1)&lt;/script&gt; '
+                              'blah #ALLURA-HIGHLIGHT-START#bar#ALLURA-HIGHLIGHT-END# foo foo'),
+            },
+        )
+        results.__iter__ = lambda self: iter(results.docs)
+        solr_search.return_value = results
+        with h.push_context('test', 'wiki', neighborhood='Projects'):
+            resp = search_app(q='foo bar')
+
+        assert_equal(resp, dict(
+            q='foo bar',
+            history=None,
+            count=2,
+            limit=25,
+            page=0,
+            search_error=None,
+            sort_score_url='the-score-url',
+            sort_date_url='the-date-url',
+            sort_field='score',
+            results=[{
+                'id': 123,
+                'type_s': 'WikiPage Snapshot',
+                'version_i': 2,
+                'url_s': '/test/wiki/Foo?version=2',
+                # highlighting works
+                'title_match': Markup('some <strong>Foo</strong> stuff'),
+                # HTML in the solr plaintext results get escaped
+                'text_match': Markup('scary &lt;script&gt;alert(1)&lt;/script&gt; bar'),
+                }, {
+                'id': 321,
+                'type_s': 'Post',
+                'title_match': Markup('blah blah'),
+                # highlighting in text
+                'text_match': Markup('less scary but still dangerous &amp;lt;script&amp;gt;alert(1)&amp;lt;/script&amp;gt; blah <strong>bar</strong> foo foo'),
+                }]
+        ))


[02/13] git commit: [#4370] ticket:322 Fix test failing due to changes in API permissions handling

Posted by br...@apache.org.
[#4370] ticket:322 Fix test failing due to changes in API permissions handling


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

Branch: refs/heads/db/2835
Commit: a1029bfc57c530cbad6909997e18595e1f429239
Parents: ad54b2f
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Apr 24 10:41:18 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Apr 24 20:02:25 2013 +0000

----------------------------------------------------------------------
 .../forgetracker/tests/functional/test_root.py     |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a1029bfc/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 23c0890..e193a10 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -328,9 +328,7 @@ class TestFunctionalController(TrackerTestController):
         r = self.app.get('/p/test/bugs/feed.atom')
         assert 'Private Ticket' not in r
         # ... or in the API ...
-        r = self.app.get('/rest/p/test/bugs/2/')
-        assert 'Private Ticket' not in r
-        assert '/auth/?return_to' in r.headers['Location']
+        r = self.app.get('/rest/p/test/bugs/2/', status=401)
         r = self.app.get('/rest/p/test/bugs/')
         assert 'Private Ticket' not in r
 


[05/13] git commit: add a few missed license headers; ignore a few build & test dirs

Posted by br...@apache.org.
add a few missed license headers; ignore a few build & test dirs


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

Branch: refs/heads/db/2835
Commit: d8a9c75db5bb2bea13a807bcedf0a1adec822d2d
Parents: a1029bf
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Apr 24 16:23:04 2013 -0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Apr 24 16:23:04 2013 -0400

----------------------------------------------------------------------
 Allura/allura/templates/members.html             |   18 ++++++++++++
 Allura/allura/templates/widgets/search_help.html |   20 +++++++++++++-
 rat-excludes.txt                                 |    4 +++
 vagrant/compress.sh                              |   25 ++++++++++++++---
 4 files changed, 62 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d8a9c75d/Allura/allura/templates/members.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/members.html b/Allura/allura/templates/members.html
index f709d78..2eac1d0 100644
--- a/Allura/allura/templates/members.html
+++ b/Allura/allura/templates/members.html
@@ -1,3 +1,21 @@
+{#-
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-#}
 {% set hide_left_bar = True %}
 {% extends g.theme.master %}
 {% block title %}Members{% endblock %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d8a9c75d/Allura/allura/templates/widgets/search_help.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/search_help.html b/Allura/allura/templates/widgets/search_help.html
index 89a4fbc..ab701db 100644
--- a/Allura/allura/templates/widgets/search_help.html
+++ b/Allura/allura/templates/widgets/search_help.html
@@ -1,5 +1,23 @@
+{#-
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-#}
 <div style="height:400px; overflow:auto;">
-    
+
 <h1>Searching</h1>
 <p>To search for an exact phrase, put it in quotes.  Example: "getting started docs"</p>
 <p>To exclude a word or phrase, put a dash in front of it.  Example: docs -help</p>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d8a9c75d/rat-excludes.txt
----------------------------------------------------------------------
diff --git a/rat-excludes.txt b/rat-excludes.txt
index 10a862f..bae4984 100644
--- a/rat-excludes.txt
+++ b/rat-excludes.txt
@@ -2,9 +2,12 @@ rat-excludes.txt
 **/setup.cfg
 **/*.json
 **/*.git/
+**/*.egg-info/
 requirements*
 **/MANIFEST.in
+**/test.log
 Allura/allura/controllers/controller.template
+Allura/docs/_build/
 Allura/allura/etc/mime.types
 Allura/allura/lib/AsciiDammit.py
 Allura/allura/lib/widgets/resources/css/autocomplete.css
@@ -31,3 +34,4 @@ ForgeSVN/forgesvn/tests/data/testsvn/
 solr_config/core0/conf/spellings.txt
 solr_config/core1/conf/spellings.txt
 solr_config/solr.xml
+

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d8a9c75d/vagrant/compress.sh
----------------------------------------------------------------------
diff --git a/vagrant/compress.sh b/vagrant/compress.sh
index c9bcd77..4fd9936 100755
--- a/vagrant/compress.sh
+++ b/vagrant/compress.sh
@@ -1,19 +1,36 @@
 #!/bin/bash
 
+#       Licensed to the Apache Software Foundation (ASF) under one
+#       or more contributor license agreements.  See the NOTICE file
+#       distributed with this work for additional information
+#       regarding copyright ownership.  The ASF licenses this file
+#       to you under the Apache License, Version 2.0 (the
+#       "License"); you may not use this file except in compliance
+#       with the License.  You may obtain a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#       Unless required by applicable law or agreed to in writing,
+#       software distributed under the License is distributed on an
+#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#       KIND, either express or implied.  See the License for the
+#       specific language governing permissions and limitations
+#       under the License.
+
 echo 'Cleanup bash history'
 unset HISTFILE
 [ -f /root/.bash_history ] && rm /root/.bash_history
 [ -f /home/vagrant/.bash_history ] && rm /home/vagrant/.bash_history
- 
+
 echo 'Cleanup log files'
 find /var/log -type f | while read f; do echo -ne '' > $f; done;
- 
+
 echo 'Whiteout root'
-count=`df --sync -kP / | tail -n1  | awk -F ' ' '{print $4}'`; 
+count=`df --sync -kP / | tail -n1  | awk -F ' ' '{print $4}'`;
 let count--
 dd if=/dev/zero of=/tmp/whitespace bs=1024 count=$count;
 rm /tmp/whitespace;
- 
+
 echo 'Whiteout /boot'
 count=`df --sync -kP /boot | tail -n1 | awk -F ' ' '{print $4}'`;
 let count--