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/05/14 20:03:30 UTC

[01/13] git commit: [#6212] omit LOC data from templates, when disabled

Updated Branches:
  refs/heads/cj/5571 d27706e61 -> aacd198d1 (forced update)


[#6212] omit LOC data from templates, when disabled


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

Branch: refs/heads/cj/5571
Commit: b20122df3e5b2ef6040fcaf62571b205eab3b47e
Parents: c7d03b3
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Mon May 13 21:56:02 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon May 13 21:56:19 2013 +0000

----------------------------------------------------------------------
 .../forgeuserstats/templates/commits.html          |   14 +++++++++-----
 ForgeUserStats/forgeuserstats/templates/index.html |    2 ++
 2 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b20122df/ForgeUserStats/forgeuserstats/templates/commits.html
----------------------------------------------------------------------
diff --git a/ForgeUserStats/forgeuserstats/templates/commits.html b/ForgeUserStats/forgeuserstats/templates/commits.html
index 6f8c2b1..b7ee786 100644
--- a/ForgeUserStats/forgeuserstats/templates/commits.html
+++ b/ForgeUserStats/forgeuserstats/templates/commits.html
@@ -40,15 +40,19 @@
           <tr>
             <th>Category</th>
             <th>Number of commits</th>
-            <th>Lines of code</th>
+            {% if h.asbool(config.get('userstats.count_lines_of_code', True)) %}
+                <th>Lines of code</th>
+            {% endif %}
           </tr>
         </thead>
-        <tbody> 
+        <tbody>
           {% for cat, el in data.items() %}
             <tr>
               <td>{% if cat %}{{cat.fullname}}{% else %}All categories{% endif %}</td>
               <td>{{el.number}}</td>
-              <td>{{el.lines}}</td>
+              {% if h.asbool(config.get('userstats.count_lines_of_code', True)) %}
+                <td>{{el.lines}}</td>
+              {% endif %}
             {% endfor %}
           </tr>
         </tbody>
@@ -58,13 +62,13 @@
   {% else %}
     {% if user %}
       <h2>Statistics not available</h2>
-      <div class="grid-20"> 
+      <div class="grid-20">
         This user has set his or her preferences so that personal statistics are not visible
         to other users of the forge.
       </div>
     {% else %}
       <h2>Invalid user</h2>
-      <div class="grid-20"> 
+      <div class="grid-20">
         You are looking for personal statistics of a user which doesn't exist on this forge. Check your url.
       </div>
     {% endif %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b20122df/ForgeUserStats/forgeuserstats/templates/index.html
----------------------------------------------------------------------
diff --git a/ForgeUserStats/forgeuserstats/templates/index.html b/ForgeUserStats/forgeuserstats/templates/index.html
index d171677..08fd14c 100644
--- a/ForgeUserStats/forgeuserstats/templates/index.html
+++ b/ForgeUserStats/forgeuserstats/templates/index.html
@@ -118,6 +118,7 @@
             </td>
           {% endif %}
         </tr>
+        {% if h.asbool(config.get('userstats.count_lines_of_code', True)) %}
         <tr>
           <td>
             {% if totcommits.lines > 0 %}
@@ -141,6 +142,7 @@
             </td>
           {% endif %}
         </tr>
+        {% endif %}
         <tr>
           <td>
             {% if totartifacts.created > 0 %}


[05/13] git commit: [#6212] Fixed datetime.now to datetime.utcnow

Posted by jo...@apache.org.
[#6212] Fixed datetime.now to datetime.utcnow

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

Branch: refs/heads/cj/5571
Commit: fdadc228381f5558c24f4e293829fea50ee19677
Parents: b20122d
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Mon May 13 22:22:00 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Mon May 13 22:22:00 2013 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fdadc228/ForgeUserStats/forgeuserstats/tests/test_model.py
----------------------------------------------------------------------
diff --git a/ForgeUserStats/forgeuserstats/tests/test_model.py b/ForgeUserStats/forgeuserstats/tests/test_model.py
index dd77b32..cc67e27 100644
--- a/ForgeUserStats/forgeuserstats/tests/test_model.py
+++ b/ForgeUserStats/forgeuserstats/tests/test_model.py
@@ -418,7 +418,7 @@ class TestUserStats(unittest.TestCase):
         newcommit.tree.get_blob_by_path.return_value.__iter__.return_value = ['one']
         newcommit.repo.commit().tree.get_blob_by_path.return_value = mock.MagicMock()
         newcommit.repo.commit().tree.get_blob_by_path.return_value.__iter__.return_value = ['two']
-        commit_datetime = datetime.now()
+        commit_datetime = datetime.utcnow()
         project = mock.Mock(
                 trove_topic=[],
                 trove_language=[],


[12/13] git commit: [#5571] ticket:302 added submit ham

Posted by jo...@apache.org.
[#5571] ticket:302 added submit ham


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

Branch: refs/heads/cj/5571
Commit: aacd198d1a39426e3e39cef409f3c2ff23343d32
Parents: e792691
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Tue Apr 9 18:09:43 2013 +0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Tue May 14 18:03:12 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/discuss.py               |    5 +-
 Allura/allura/lib/spam/__init__.py                 |    3 +
 Allura/allura/lib/spam/akismetfilter.py            |   11 +++--
 Allura/allura/lib/spam/mollomfilter.py             |    3 +
 Allura/allura/model/discuss.py                     |   19 +++------
 Allura/allura/tests/model/test_discussion.py       |   16 ++++----
 Allura/allura/tests/unit/spam/test_akismet.py      |    7 +++
 Allura/allura/tests/unit/spam/test_mollom.py       |   30 ++++----------
 Allura/allura/tests/unit/spam/test_spam_filter.py  |    5 --
 .../forgetracker/tests/functional/test_root.py     |    6 +-
 10 files changed, 49 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aacd198d/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index e3284fc..5f65515 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -328,10 +328,10 @@ class PostController(BaseController):
         if kw.pop('delete', None):
             self.post.delete()
         elif kw.pop('spam', None):
-            self.post.status = 'spam'
-            g.spam_checker.submit_spam(self.post.text, artifact=self.post, user=c.user)
+            self.post.spam()
         elif kw.pop('approve', None):
             self.post.status = 'ok'
+            g.spam_checker.submit_ham(self.post.text, artifact=self.post, user=c.user)
         self.thread.update_stats()
         return dict(result ='success')
 
@@ -437,6 +437,7 @@ class ModerationController(BaseController):
                         posted.spam()
                     elif approve and posted.status != 'ok':
                         posted.status = 'ok'
+                        g.spam_checker.submit_ham(posted.text, artifact=posted, user=c.user)
                         posted.thread.last_post_date = max(
                             posted.thread.last_post_date,
                             posted.mod_date)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aacd198d/Allura/allura/lib/spam/__init__.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/spam/__init__.py b/Allura/allura/lib/spam/__init__.py
index d8b52aa..8e6607a 100644
--- a/Allura/allura/lib/spam/__init__.py
+++ b/Allura/allura/lib/spam/__init__.py
@@ -35,6 +35,9 @@ class SpamFilter(object):
     def submit_spam(self, text, artifact=None, user=None, content_type='comment', **kw):
         log.info("No spam checking enabled")
 
+    def submit_ham(self, text, artifact=None, user=None, content_type='comment', **kw):
+        log.info("No spam checking enabled")
+
     @classmethod
     def get(cls, config, entry_points):
         """Return an instance of the SpamFilter impl specified in ``config``.

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aacd198d/Allura/allura/lib/spam/akismetfilter.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/spam/akismetfilter.py b/Allura/allura/lib/spam/akismetfilter.py
index 13e0032..25cc82c 100644
--- a/Allura/allura/lib/spam/akismetfilter.py
+++ b/Allura/allura/lib/spam/akismetfilter.py
@@ -85,7 +85,10 @@ class AkismetSpamFilter(SpamFilter):
                                                     content_type=content_type),
                                  build_data=False)
 
-
-
-
-
+    def submit_ham(self, text, artifact=None, user=None, content_type='comment'):
+        self.service.submit_ham(text,
+                                 data=self.get_data(text=text,
+                                                    artifact=artifact,
+                                                    user=user,
+                                                    content_type=content_type),
+                                 build_data=False)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aacd198d/Allura/allura/lib/spam/mollomfilter.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/spam/mollomfilter.py b/Allura/allura/lib/spam/mollomfilter.py
index a9d586b..e0b2922 100644
--- a/Allura/allura/lib/spam/mollomfilter.py
+++ b/Allura/allura/lib/spam/mollomfilter.py
@@ -79,3 +79,6 @@ class MollomSpamFilter(SpamFilter):
 
     def submit_spam(self, text, artifact=None, user=None, content_type='comment', **kw):
         self.service.sendFeedback(artifact.spam_check_id, 'spam')
+
+    def submit_ham(self, *args, **kw):
+        log.info("Mollom doesn't support reporting a ham")

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aacd198d/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 544865c..8698de7 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -233,17 +233,11 @@ class Thread(Artifact, ActivityObject):
             Feed.post(self.primary(), title=p.subject, description=p.text, link=link)
         return p
 
-    def check_spam(self, post):
-        result = True
-        for role in c.user.project_role(c.project).roles:
-            if ((ProjectRole.query.get(_id=role).name == 'Admin') or
-                    (ProjectRole.query.get(_id=role).name == 'Developer')):
-                return True
-
-        if g.spam_checker.check('%s\n%s' % (post.subject, post.text), artifact=post, user=c.user):
-            result = False
-        return result
-
+    def is_spam(self, post):
+        if c.user in c.project.users_with_role('Admin', 'Developer'):
+            return False
+        else:
+            return g.spam_checker.check('%s\n%s' % (post.subject, post.text), artifact=post, user=c.user)
 
     def post(self, text, message_id=None, parent_id=None,
              timestamp=None, ignore_security=False, **kw):
@@ -268,8 +262,7 @@ class Thread(Artifact, ActivityObject):
         if message_id is not None:
             kwargs['_id'] = message_id
         post = self.post_class()(**kwargs)
-
-        if ignore_security or self.check_spam(post):
+        if ignore_security or not self.is_spam(post):
             log.info('Auto-approving message from %s', c.user.username)
             file_info = kw.get('file_info', None)
             post.approve(file_info, notify=kw.get('notify', True))

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aacd198d/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 68611b3..6b1cca3 100644
--- a/Allura/allura/tests/model/test_discussion.py
+++ b/Allura/allura/tests/model/test_discussion.py
@@ -358,23 +358,23 @@ def test_post_notify():
             assert False, 'send_simple must not be called'
 
 @with_setup(setUp, tearDown)
-def test_check_spam_for_admin():
+@patch('allura.model.discuss.c.project.users_with_role')
+def test_is_spam_for_admin(users):
+    users.return_value = [c.user,]
     d = M.Discussion(shortname='test', name='test')
     t = M.Thread(discussion_id=d._id, subject='Test Thread')
     t.post('This is a post')
     post = M.Post.query.get(text='This is a post')
-    assert t.check_spam(post), t.check_spam(post)
+    assert not t.is_spam(post), t.is_spam(post)
 
 @with_setup(setUp, tearDown)
-@patch('allura.model.discuss.c.user.project_role')
-def test_check_spam(role):
+@patch('allura.model.discuss.c.project.users_with_role')
+def test_is_spam(role):
     d = M.Discussion(shortname='test', name='test')
     t = M.Thread(discussion_id=d._id, subject='Test Thread')
-    role.roles.return_value = []
+    role.return_value = []
     with mock.patch('allura.controllers.discuss.g.spam_checker') as spam_checker:
         spam_checker.check.return_value = True
         post = mock.Mock()
-        assert not t.check_spam(post)
+        assert t.is_spam(post), t.is_spam(post)
         assert spam_checker.check.call_count == 1, spam_checker.call_count
-
-

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aacd198d/Allura/allura/tests/unit/spam/test_akismet.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/spam/test_akismet.py b/Allura/allura/tests/unit/spam/test_akismet.py
index bb9a90e..e49e46b 100644
--- a/Allura/allura/tests/unit/spam/test_akismet.py
+++ b/Allura/allura/tests/unit/spam/test_akismet.py
@@ -129,3 +129,10 @@ class TestAkismet(unittest.TestCase):
         self.akismet.submit_spam(self.content)
         self.akismet.service.submit_spam.assert_called_once_with(self.content, data=self.expected_data, build_data=False)
 
+    @mock.patch('allura.lib.spam.akismetfilter.c')
+    @mock.patch('allura.lib.spam.akismetfilter.request')
+    def test_submit_ham(self, request, c):
+        request.headers = self.fake_headers
+        c.user = None
+        self.akismet.submit_ham(self.content)
+        self.akismet.service.submit_ham.assert_called_once_with(self.content, data=self.expected_data, build_data=False)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aacd198d/Allura/allura/tests/unit/spam/test_mollom.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/spam/test_mollom.py b/Allura/allura/tests/unit/spam/test_mollom.py
index 7828908..e1ee1fe 100644
--- a/Allura/allura/tests/unit/spam/test_mollom.py
+++ b/Allura/allura/tests/unit/spam/test_mollom.py
@@ -52,25 +52,23 @@ class TestMollom(unittest.TestCase):
         self.expected_data = dict(
             postBody=self.content.encode('utf8'),
             authorIP='some ip')
+        self.artifact = mock.Mock()
+        self.artifact.spam_check_id = 'test_id'
 
     @mock.patch('allura.lib.spam.mollomfilter.c')
     @mock.patch('allura.lib.spam.mollomfilter.request')
     def test_check(self, request, c):
         request.headers = self.fake_headers
         c.user = None
-        artifact = mock.Mock()
-        artifact.spam_check_id = 'test_id'
-        self.mollom.check(self.content, artifact = artifact)
+        self.mollom.check(self.content, artifact = self.artifact)
         self.mollom.service.checkContent.assert_called_once_with(**self.expected_data)
 
     @mock.patch('allura.lib.spam.mollomfilter.c')
     @mock.patch('allura.lib.spam.mollomfilter.request')
     def test_check_with_user(self, request, c):
-        artifact = mock.Mock()
-        artifact.spam_check_id = 'test_id'
         request.headers = self.fake_headers
         c.user = None
-        self.mollom.check(self.content, user=self.fake_user, artifact=artifact)
+        self.mollom.check(self.content, user=self.fake_user, artifact=self.artifact)
         expected_data = self.expected_data
         expected_data.update(authorName=u'Søme User'.encode('utf8'),
                 authorMail='user@domain')
@@ -79,11 +77,9 @@ class TestMollom(unittest.TestCase):
     @mock.patch('allura.lib.spam.mollomfilter.c')
     @mock.patch('allura.lib.spam.mollomfilter.request')
     def test_check_with_implicit_user(self, request, c):
-        artifact = mock.Mock()
-        artifact.spam_check_id = 'test_id'
         request.headers = self.fake_headers
         c.user = self.fake_user
-        self.mollom.check(self.content, artifact=artifact)
+        self.mollom.check(self.content, artifact=self.artifact)
         expected_data = self.expected_data
         expected_data.update(authorName=u'Søme User'.encode('utf8'),
                 authorMail='user@domain')
@@ -92,22 +88,14 @@ class TestMollom(unittest.TestCase):
     @mock.patch('allura.lib.spam.mollomfilter.c')
     @mock.patch('allura.lib.spam.mollomfilter.request')
     def test_check_with_fallback_ip(self, request, c):
-        artifact = mock.Mock()
-        artifact.spam_check_id = 'test_id'
         self.expected_data['authorIP'] = 'fallback ip'
         self.fake_headers.pop('X_FORWARDED_FOR')
         request.headers = self.fake_headers
         request.remote_addr = self.fake_headers['REMOTE_ADDR']
         c.user = None
-        self.mollom.check(self.content, artifact=artifact)
+        self.mollom.check(self.content, artifact=self.artifact)
         self.mollom.service.checkContent.assert_called_once_with(**self.expected_data)
 
-    @mock.patch('allura.lib.spam.mollomfilter.c')
-    @mock.patch('allura.lib.spam.mollomfilter.request')
-    def test_submit_spam(self, request, c):
-        request.headers = self.fake_headers
-        c.user = None
-        artifact = mock.Mock()
-        artifact.spam_check_id = 'test_id'
-        self.mollom.submit_spam('test', artifact=artifact)
-        assert 'test_id' in self.mollom.service.sendFeedback.call_args[0]
+    def test_submit_spam(self):
+        self.mollom.submit_spam('test', artifact=self.artifact)
+        assert self.mollom.service.sendFeedback.call_args[0] == ('test_id', 'spam'), self.mollom.service.sendFeedback.call_args[0]

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aacd198d/Allura/allura/tests/unit/spam/test_spam_filter.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/spam/test_spam_filter.py b/Allura/allura/tests/unit/spam/test_spam_filter.py
index a871aaa..5255503 100644
--- a/Allura/allura/tests/unit/spam/test_spam_filter.py
+++ b/Allura/allura/tests/unit/spam/test_spam_filter.py
@@ -34,9 +34,6 @@ class TestSpamFilter(unittest.TestCase):
         # default no-op impl always returns False
         self.assertFalse(SpamFilter({}).check('foo'))
 
-    def test_submit_spam(self):
-        SpamFilter({}).submit_spam('foo')
-
     def test_get_default(self):
         config = {}
         entry_points = None
@@ -57,5 +54,3 @@ class TestSpamFilter(unittest.TestCase):
         result = checker.check()
         self.assertFalse(result)
         self.assertTrue(log.exception.called)
-
-

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aacd198d/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 d57a503..5ca370b 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -1772,9 +1772,9 @@ class TestEmailMonitoring(TrackerTestController):
 
     @td.with_tool('test', 'Tickets', 'doc-bugs', post_install_hook=post_install_hook)
     @patch('forgetracker.model.ticket.Notification.send_direct')
-    @patch('allura.model.discuss.Thread.check_spam')
-    def test_notifications_moderators(self, check_spam, send_direct):
-        check_spam.return_value = False
+    @patch('allura.model.discuss.Thread.is_spam')
+    def test_notifications_moderators(self, is_spam, send_direct):
+        is_spam.return_value = True
         self.new_ticket(summary='test moderation', mount_point='/doc-bugs/')
         self.app.post('/doc-bugs/1/update_ticket',{
             'summary':'test moderation',


[07/13] git commit: Adds documentation for the [[members]] macro.

Posted by jo...@apache.org.
Adds documentation for the [[members]] macro.


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

Branch: refs/heads/cj/5571
Commit: e4054d94662f98dd7171e0d7843d790dd2ac0395
Parents: 909a2e5
Author: Rich Bowen <rb...@geek.net>
Authored: Fri Apr 26 12:12:36 2013 -0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue May 14 14:32:32 2013 +0000

----------------------------------------------------------------------
 Allura/allura/templates/jinja_master/lib.html |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e4054d94/Allura/allura/templates/jinja_master/lib.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/lib.html b/Allura/allura/templates/jinja_master/lib.html
index 48934d3..d34fe03 100644
--- a/Allura/allura/templates/jinja_master/lib.html
+++ b/Allura/allura/templates/jinja_master/lib.html
@@ -153,6 +153,7 @@
     <li><a href="#md_ex_includes{{id}}">Includes</a></li>
     <li><a href="#md_ex_neighborhood_notes{{id}}">Neighborhood Notifications</a></li>
     <li><a href="#md_ex_download_button{{id}}">Download Button</a></li>
+    <li><a href="#md_ex_members{{id}}">Project Member List</a></li>
     <li><a href="#md_ex_project_screenshots{{id}}">Project Screenshots</a></li>
     <li><a href="#md_ex_thanks{{id}}">Thanks</a></li>
 </ul>
@@ -687,6 +688,14 @@ allowed, permitting basic styling and layout: &lt;div markdown style="float:left
 </pre></div>
 </div>
 
+<div class="markdown_syntax_section hidden_in_modal md_ex_member{{id}}">
+<h2 id="md_ex_member{{id}}">Project Member List</h2>
+<p>You can display a list of project members. By default the list is limited to 20 members, and a link is provided to a page with the full list.</p>
+<div class="codehilite"><pre>
+[[members]]
+</pre></div>
+</div>
+
 <div class="markdown_syntax_section hidden_in_modal md_ex_project_screenshots{{id}}">
 <h2 id="md_ex_project_screenshots{{id}}">Project Screenshots</h2>
 <p>You can show all the screenshots for the current project as thumbnails that are linked to the full-size image.</p>


[04/13] git commit: [#6212] Support config option to disable counting lines-of-code

Posted by jo...@apache.org.
[#6212] Support config option to disable counting lines-of-code

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

Branch: refs/heads/cj/5571
Commit: c7d03b33a30f9d9ed474b41773ee4240e1fae47c
Parents: 9912f31
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Mon May 13 20:44:53 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon May 13 21:56:19 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/stats.py                      |   28 ++++++++-------
 ForgeUserStats/forgeuserstats/tests/test_model.py |   30 ++++++++++++++++
 2 files changed, 45 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c7d03b33/Allura/allura/model/stats.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/stats.py b/Allura/allura/model/stats.py
index 166933e..3946557 100644
--- a/Allura/allura/model/stats.py
+++ b/Allura/allura/model/stats.py
@@ -20,6 +20,7 @@ import pymongo
 from pylons import tmpl_context as c, app_globals as g
 from pylons import request
 from tg import config
+from paste.deploy.converters import asbool
 
 import bson
 from ming import schema as S
@@ -501,19 +502,20 @@ class Stats(MappedClass):
             oldcommit = newcommit.repo.commit(newcommit.parent_ids[0])
 
         totlines = 0
-        for changed in d.changed:
-            newblob = newcommit.tree.get_blob_by_path(changed)
-            oldblob = oldcommit.tree.get_blob_by_path(changed)
-            totlines+=_computeLines(newblob, oldblob)
-
-        for copied in d.copied:
-            newblob = newcommit.tree.get_blob_by_path(copied['new'])
-            oldblob = oldcommit.tree.get_blob_by_path(copied['old'])
-            totlines+=_computeLines(newblob, oldblob)
-
-        for added in d.added:
-            newblob = newcommit.tree.get_blob_by_path(added)
-            totlines+=_computeLines(newblob)
+        if asbool(config.get('userstats.count_lines_of_code', True)):
+            for changed in d.changed:
+                newblob = newcommit.tree.get_blob_by_path(changed)
+                oldblob = oldcommit.tree.get_blob_by_path(changed)
+                totlines+=_computeLines(newblob, oldblob)
+
+            for copied in d.copied:
+                newblob = newcommit.tree.get_blob_by_path(copied['new'])
+                oldblob = oldcommit.tree.get_blob_by_path(copied['old'])
+                totlines+=_computeLines(newblob, oldblob)
+
+            for added in d.added:
+                newblob = newcommit.tree.get_blob_by_path(added)
+                totlines+=_computeLines(newblob)
 
         _addCommitData(self, topics, languages, totlines)
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c7d03b33/ForgeUserStats/forgeuserstats/tests/test_model.py
----------------------------------------------------------------------
diff --git a/ForgeUserStats/forgeuserstats/tests/test_model.py b/ForgeUserStats/forgeuserstats/tests/test_model.py
index 2da99e1..dd77b32 100644
--- a/ForgeUserStats/forgeuserstats/tests/test_model.py
+++ b/ForgeUserStats/forgeuserstats/tests/test_model.py
@@ -21,6 +21,7 @@ from datetime import datetime, timedelta
 
 from pylons import tmpl_context as c
 from tg import config
+import mock
 
 from alluratest.controller import setup_basic_test, setup_global_objects
 from allura.tests import decorators as td
@@ -400,3 +401,32 @@ class TestUserStats(unittest.TestCase):
             self.assertEqual(stats.start_date, datetime(2013,04,01))
         with h.push_config(config, **{'userstats.start_date': '2011-04-01'}):
             self.assertEqual(stats.start_date, datetime(2012,04,01))
+
+    @mock.patch('allura.model.stats.difflib.unified_diff')
+    def test_count_loc(self, unified_diff):
+        stats = USM.UserStats()
+        newcommit = mock.Mock(
+                parent_ids=['deadbeef'],
+                diffs=mock.Mock(
+                    changed=[mock.MagicMock()],
+                    copied=[mock.MagicMock()],
+                    added=[mock.MagicMock()],
+                ),
+            )
+        unified_diff.return_value = ['+++','---','+line']
+        newcommit.tree.get_blob_by_path.return_value = mock.MagicMock()
+        newcommit.tree.get_blob_by_path.return_value.__iter__.return_value = ['one']
+        newcommit.repo.commit().tree.get_blob_by_path.return_value = mock.MagicMock()
+        newcommit.repo.commit().tree.get_blob_by_path.return_value.__iter__.return_value = ['two']
+        commit_datetime = datetime.now()
+        project = mock.Mock(
+                trove_topic=[],
+                trove_language=[],
+            )
+        stats.addCommit(newcommit, commit_datetime, project)
+        self.assertEqual(stats.general[0].commits[0], {'lines': 3, 'number': 1, 'language': None})
+        unified_diff.reset_mock()
+        with h.push_config(config, **{'userstats.count_lines_of_code': 'false'}):
+            stats.addCommit(newcommit, commit_datetime, project)
+        self.assertEqual(stats.general[0].commits[0], {'lines': 3, 'number': 2, 'language': None})
+        unified_diff.assert_not_called()


[10/13] git commit: Fixes #6166

Posted by jo...@apache.org.
Fixes #6166


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

Branch: refs/heads/cj/5571
Commit: 2c7aa4157ea5d5f0a970c707c9d4fe70e18334d1
Parents: e4054d9
Author: Rich Bowen <rb...@geek.net>
Authored: Fri Apr 26 13:58:54 2013 -0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue May 14 14:32:32 2013 +0000

----------------------------------------------------------------------
 Allura/allura/templates/jinja_master/lib.html |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2c7aa415/Allura/allura/templates/jinja_master/lib.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/lib.html b/Allura/allura/templates/jinja_master/lib.html
index d34fe03..c511352 100644
--- a/Allura/allura/templates/jinja_master/lib.html
+++ b/Allura/allura/templates/jinja_master/lib.html
@@ -148,7 +148,7 @@
     <li><a href="#md_ex_img{{id}}">Images</a></li>
     <li><a href="#md_ex_escapes{{id}}">Escapes and HTML</a></li>
     <li><a href="#md_ex_moreheaders{{id}}">More Headers</a></li>
-    <li><a href="#md_ex_toc{{id}}">Table of Contents</a></li>
+    <li><a href="#md_ex_toc1{{id}}">Table of Contents</a></li>
     <li><a href="#md_ex_code{{id}}">Code Highlighting</a></li>
     <li><a href="#md_ex_includes{{id}}">Includes</a></li>
     <li><a href="#md_ex_neighborhood_notes{{id}}">Neighborhood Notifications</a></li>
@@ -583,8 +583,8 @@ allowed, permitting basic styling and layout: &lt;div markdown style="float:left
 </div>
 
 
-<div class="markdown_syntax_section hidden_in_modal md_ex_toc{{id}}">
-<h2 id="md_ex_toc{{id}}">Table of Contents</h2>
+<div class="markdown_syntax_section hidden_in_modal md_ex_toc1{{id}}">
+<h2 id="md_ex_toc1{{id}}">Table of Contents</h2>
 <p>You can display a list of links to jump to headers in a document. Sub-headers will be nested.</p>
 <div class="codehilite"><pre>[TOC]
 


[02/13] git commit: [#6212] Support configurable start date for counting user stats

Posted by jo...@apache.org.
[#6212] Support configurable start date for counting user stats

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

Branch: refs/heads/cj/5571
Commit: 9912f31257c3be2bb6a6cc35f1801245071fd1c0
Parents: bffea80
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Mon May 13 19:30:40 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon May 13 21:56:19 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/stats.py                       |   15 +++++++++++++--
 .../forgeuserstats/controllers/userstats.py        |    2 +-
 ForgeUserStats/forgeuserstats/tests/test_model.py  |   13 ++++++++++++-
 3 files changed, 26 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9912f312/Allura/allura/model/stats.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/stats.py b/Allura/allura/model/stats.py
index cff1abc..166933e 100644
--- a/Allura/allura/model/stats.py
+++ b/Allura/allura/model/stats.py
@@ -15,9 +15,11 @@
 #       specific language governing permissions and limitations
 #       under the License.
 
+from datetime import datetime
 import pymongo
 from pylons import tmpl_context as c, app_globals as g
 from pylons import request
+from tg import config
 
 import bson
 from ming import schema as S
@@ -79,8 +81,17 @@ class Stats(MappedClass):
             programming_languages=[S.ObjectId],
             lines=int)]))
 
+    @property
+    def start_date(self):
+        """Date from which stats should be calculated.
+
+        The user may have registered before stats were collected,
+        making calculations based on registration date unfair."""
+        min_date = config.get('userstats.start_date', '0001-1-1')
+        return max(datetime.strptime(min_date,'%Y-%m-%d'), self.registration_date)
+
     def getCodeContribution(self):
-        days=(datetime.today() - self.registration_date).days
+        days=(datetime.today() - self.start_date).days
         if not days:
             days=1
         for val in self['general']:
@@ -94,7 +105,7 @@ class Stats(MappedClass):
         return 0
 
     def getDiscussionContribution(self):
-        days=(datetime.today() - self.registration_date).days
+        days=(datetime.today() - self.start_date).days
         if not days:
             days=1
         for val in self['general']:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9912f312/ForgeUserStats/forgeuserstats/controllers/userstats.py
----------------------------------------------------------------------
diff --git a/ForgeUserStats/forgeuserstats/controllers/userstats.py b/ForgeUserStats/forgeuserstats/controllers/userstats.py
index 85b26df..0624a31 100644
--- a/ForgeUserStats/forgeuserstats/controllers/userstats.py
+++ b/ForgeUserStats/forgeuserstats/controllers/userstats.py
@@ -212,7 +212,7 @@ def _getDataForCategory(category, stats):
 
     averagetime = lm_tickets.get('averagesolvingtime')
 
-    days = (datetime.utcnow() - stats.registration_date).days
+    days = (datetime.utcnow() - stats.start_date).days
     if days >= 30:
         pmartifacts = dict(
             created = round(totartifacts['created']*30.0/days,2),

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9912f312/ForgeUserStats/forgeuserstats/tests/test_model.py
----------------------------------------------------------------------
diff --git a/ForgeUserStats/forgeuserstats/tests/test_model.py b/ForgeUserStats/forgeuserstats/tests/test_model.py
index 4b123eb..2da99e1 100644
--- a/ForgeUserStats/forgeuserstats/tests/test_model.py
+++ b/ForgeUserStats/forgeuserstats/tests/test_model.py
@@ -20,14 +20,18 @@ import unittest
 from datetime import datetime, timedelta
 
 from pylons import tmpl_context as c
+from tg import config
 
 from alluratest.controller import setup_basic_test, setup_global_objects
 from allura.tests import decorators as td
 from allura.model import User, Project, TroveCategory
+from allura.lib import helpers as h
 from allura import model as M
 
 from forgegit.tests import with_git
 
+from forgeuserstats.model import stats as USM
+
 class TestUserStats(unittest.TestCase):
 
     def setUp(self):
@@ -339,7 +343,7 @@ class TestUserStats(unittest.TestCase):
         assert init_commits['number'] == 4
         init_lmcommits = self.user.stats.getLastMonthCommits()
         assert init_lmcommits['number'] == 4
- 
+
         p.trove_topic = [topic._id]
         self.user.stats.addCommit(commit, datetime.utcnow(), p)
         commits = self.user.stats.getCommits()
@@ -389,3 +393,10 @@ class TestUserStats(unittest.TestCase):
         assert lm_logins == init_lm_logins + 1 
         assert abs(self.user.stats.last_login - login_datetime) < timedelta(seconds=1)
 
+    def test_start_date(self):
+        stats = USM.UserStats(registration_date=datetime(2012,04,01))
+        self.assertEqual(stats.start_date, datetime(2012,04,01))
+        with h.push_config(config, **{'userstats.start_date': '2013-04-01'}):
+            self.assertEqual(stats.start_date, datetime(2013,04,01))
+        with h.push_config(config, **{'userstats.start_date': '2011-04-01'}):
+            self.assertEqual(stats.start_date, datetime(2012,04,01))


[03/13] git commit: [#6212] don't show login stats if the system doesn't record them (alternate auth system)

Posted by jo...@apache.org.
[#6212] don't show login stats if the system doesn't record them (alternate auth system)


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

Branch: refs/heads/cj/5571
Commit: bffea80ff01870a3f55bc3ae0b61de259b6756bc
Parents: ac7e003
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue May 7 20:05:14 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon May 13 21:56:19 2013 +0000

----------------------------------------------------------------------
 ForgeUserStats/forgeuserstats/templates/index.html |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bffea80f/ForgeUserStats/forgeuserstats/templates/index.html
----------------------------------------------------------------------
diff --git a/ForgeUserStats/forgeuserstats/templates/index.html b/ForgeUserStats/forgeuserstats/templates/index.html
index 406fb20..d171677 100644
--- a/ForgeUserStats/forgeuserstats/templates/index.html
+++ b/ForgeUserStats/forgeuserstats/templates/index.html
@@ -76,7 +76,7 @@
         </tr>
       </thead>
       <tbody>
-        {% if not category %}
+        {% if not category and last_login %}
           <tr>
             <td>Logins</td>
             <td>{{totlogins}}</td>


[06/13] git commit: Typo

Posted by jo...@apache.org.
Typo


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

Branch: refs/heads/cj/5571
Commit: 909a2e56cf20576aac7e065685aaa5d8d0bf5747
Parents: a6e48be
Author: Rich Bowen <rb...@rcbowen.com>
Authored: Wed Oct 12 10:01:07 2011 -0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue May 14 14:32:32 2013 +0000

----------------------------------------------------------------------
 Allura/docs/platform_tour.rst |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/909a2e56/Allura/docs/platform_tour.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/platform_tour.rst b/Allura/docs/platform_tour.rst
index 6360420..73a0a14 100644
--- a/Allura/docs/platform_tour.rst
+++ b/Allura/docs/platform_tour.rst
@@ -34,7 +34,7 @@ robust and open platform.  Some of the services provided by the platform include
 - Tool administration
 
 Tools, on the other hand, provide the actual user interface and logic to
-manipulate forge artifacts.  Some of the tools currently impemented include:
+manipulate forge artifacts.  Some of the tools currently implemented include:
 
 admin
   This tool is installed in all projects, and allows the administration of the


[09/13] git commit: Combines the various project info macros into a single subsection.

Posted by jo...@apache.org.
Combines the various project info macros into a single subsection.


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

Branch: refs/heads/cj/5571
Commit: 76763615db3b42ed7b58fd736cef99ff6c8e93ea
Parents: 2c7aa41
Author: Rich Bowen <rb...@geek.net>
Authored: Fri Apr 26 14:30:04 2013 -0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue May 14 14:32:32 2013 +0000

----------------------------------------------------------------------
 Allura/allura/templates/jinja_master/lib.html |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/76763615/Allura/allura/templates/jinja_master/lib.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/lib.html b/Allura/allura/templates/jinja_master/lib.html
index c511352..3897e5f 100644
--- a/Allura/allura/templates/jinja_master/lib.html
+++ b/Allura/allura/templates/jinja_master/lib.html
@@ -152,9 +152,7 @@
     <li><a href="#md_ex_code{{id}}">Code Highlighting</a></li>
     <li><a href="#md_ex_includes{{id}}">Includes</a></li>
     <li><a href="#md_ex_neighborhood_notes{{id}}">Neighborhood Notifications</a></li>
-    <li><a href="#md_ex_download_button{{id}}">Download Button</a></li>
-    <li><a href="#md_ex_members{{id}}">Project Member List</a></li>
-    <li><a href="#md_ex_project_screenshots{{id}}">Project Screenshots</a></li>
+    <li><a href="#md_ex_project_macros{{id}}">Project Info Macros</a></li>
     <li><a href="#md_ex_thanks{{id}}">Thanks</a></li>
 </ul>
 </div>
@@ -680,28 +678,26 @@ allowed, permitting basic styling and layout: &lt;div markdown style="float:left
 </pre></div>
 </div>
 
-<div class="markdown_syntax_section hidden_in_modal md_ex_download_button{{id}}">
+<div class="markdown_syntax_section hidden_in_modal md_ex_project_macros{{id}}">
+
 <h2 id="md_ex_download_button{{id}}">Download Button</h2>
 <p>You can display a download button that links to the best download available for the active project. Please note that if you use this macro and there is no download associated with your project, the button will not appear.</p>
 <div class="codehilite"><pre>
 [[download_button]]
 </pre></div>
-</div>
 
-<div class="markdown_syntax_section hidden_in_modal md_ex_member{{id}}">
 <h2 id="md_ex_member{{id}}">Project Member List</h2>
 <p>You can display a list of project members. By default the list is limited to 20 members, and a link is provided to a page with the full list.</p>
 <div class="codehilite"><pre>
 [[members]]
 </pre></div>
-</div>
 
-<div class="markdown_syntax_section hidden_in_modal md_ex_project_screenshots{{id}}">
 <h2 id="md_ex_project_screenshots{{id}}">Project Screenshots</h2>
 <p>You can show all the screenshots for the current project as thumbnails that are linked to the full-size image.</p>
 <div class="codehilite"><pre>
 [[project_screenshots]]
 </pre></div>
+
 </div>
 
 <div class="markdown_syntax_section hidden_in_modal md_ex_thanks{{id}}">


[13/13] git commit: [#5571] ticket:302 Spam moderation: comments

Posted by jo...@apache.org.
[#5571] ticket:302 Spam moderation: comments


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

Branch: refs/heads/cj/5571
Commit: e79269172fdb3962d3d0f6709a7a16b47256287e
Parents: bf43535
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Mon Apr 1 12:08:26 2013 +0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Tue May 14 18:03:12 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/discuss.py               |    4 +--
 Allura/allura/lib/spam/__init__.py                 |    3 ++
 Allura/allura/lib/spam/akismetfilter.py            |   27 +++++++++++++--
 Allura/allura/lib/spam/mollomfilter.py             |    3 ++
 Allura/allura/model/discuss.py                     |   18 +++++++++-
 Allura/allura/tests/functional/test_discuss.py     |    8 +++-
 Allura/allura/tests/model/test_discussion.py       |   22 ++++++++++++
 Allura/allura/tests/unit/spam/test_akismet.py      |   10 +++++
 Allura/allura/tests/unit/spam/test_mollom.py       |   26 ++++++++++++--
 Allura/allura/tests/unit/spam/test_spam_filter.py  |    3 ++
 .../forgediscussion/controllers/root.py            |    1 -
 .../forgediscussion/tests/functional/test_forum.py |   13 +++----
 .../forgetracker/tests/functional/test_root.py     |    4 ++-
 13 files changed, 119 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7926917/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index 96f8979..e3284fc 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -200,7 +200,6 @@ class ThreadController(BaseController, FeedController):
 
         file_info = kw.get('file_info', None)
         p = self.thread.add_post(**kw)
-        is_spam = g.spam_checker.check(kw['text'], artifact=p, user=c.user)
         p.add_attachment(file_info)
         if self.thread.artifact:
             self.thread.artifact.mod_date = datetime.utcnow()
@@ -317,7 +316,6 @@ class PostController(BaseController):
         require_access(self.thread, 'post')
         kw = self.W.edit_post.to_python(kw, None)
         p = self.thread.add_post(parent_id=self.post._id, **kw)
-        is_spam = g.spam_checker.check(kw['text'], artifact=p, user=c.user)
         p.add_attachment(file_info)
         redirect(request.referer)
 
@@ -331,6 +329,7 @@ class PostController(BaseController):
             self.post.delete()
         elif kw.pop('spam', None):
             self.post.status = 'spam'
+            g.spam_checker.submit_spam(self.post.text, artifact=self.post, user=c.user)
         elif kw.pop('approve', None):
             self.post.status = 'ok'
         self.thread.update_stats()
@@ -458,7 +457,6 @@ class PostRestController(PostController):
         require_access(self.thread, 'post')
         kw = self.W.edit_post.to_python(kw, None)
         post = self.thread.post(parent_id=self.post._id, **kw)
-        is_spam = g.spam_checker.check(kw['text'], artifact=post, user=c.user)
         self.thread.num_replies += 1
         redirect(post.slug.split('/')[-1] + '/')
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7926917/Allura/allura/lib/spam/__init__.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/spam/__init__.py b/Allura/allura/lib/spam/__init__.py
index 869e6fd..d8b52aa 100644
--- a/Allura/allura/lib/spam/__init__.py
+++ b/Allura/allura/lib/spam/__init__.py
@@ -32,6 +32,9 @@ class SpamFilter(object):
         log.info("No spam checking enabled")
         return False
 
+    def submit_spam(self, text, artifact=None, user=None, content_type='comment', **kw):
+        log.info("No spam checking enabled")
+
     @classmethod
     def get(cls, config, entry_points):
         """Return an instance of the SpamFilter impl specified in ``config``.

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7926917/Allura/allura/lib/spam/akismetfilter.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/spam/akismetfilter.py b/Allura/allura/lib/spam/akismetfilter.py
index bd2e89e..13e0032 100644
--- a/Allura/allura/lib/spam/akismetfilter.py
+++ b/Allura/allura/lib/spam/akismetfilter.py
@@ -47,8 +47,7 @@ class AkismetSpamFilter(SpamFilter):
         self.service = akismet.Akismet(config.get('spam.key'), config.get('base_url'))
         self.service.verify_key()
 
-    def check(self, text, artifact=None, user=None, content_type='comment', **kw):
-        log_msg = text
+    def get_data(self, text, artifact=None, user=None, content_type='comment', **kw):
         kw['comment_content'] = text
         kw['comment_type'] = content_type
         if artifact:
@@ -65,6 +64,28 @@ class AkismetSpamFilter(SpamFilter):
         # kw will be urlencoded, need to utf8-encode
         for k, v in kw.items():
             kw[k] = h.really_unicode(v).encode('utf8')
-        res = self.service.comment_check(text, data=kw, build_data=False)
+        return kw
+
+    def check(self, text, artifact=None, user=None, content_type='comment', **kw):
+        log_msg = text
+        res = self.service.comment_check(text,
+                                         data=self.get_data(text=text,
+                                                            artifact=artifact,
+                                                            user=user,
+                                                            content_type=content_type),
+                                         build_data=False)
         log.info("spam=%s (akismet): %s" % (str(res), log_msg))
         return res
+
+    def submit_spam(self, text, artifact=None, user=None, content_type='comment'):
+        self.service.submit_spam(text,
+                                 data=self.get_data(text=text,
+                                                    artifact=artifact,
+                                                    user=user,
+                                                    content_type=content_type),
+                                 build_data=False)
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7926917/Allura/allura/lib/spam/mollomfilter.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/spam/mollomfilter.py b/Allura/allura/lib/spam/mollomfilter.py
index 7852fda..a9d586b 100644
--- a/Allura/allura/lib/spam/mollomfilter.py
+++ b/Allura/allura/lib/spam/mollomfilter.py
@@ -73,6 +73,9 @@ class MollomSpamFilter(SpamFilter):
             kw[k] = h.really_unicode(v).encode('utf8')
         cc = self.service.checkContent(**kw)
         res = cc['spam'] == 2
+        artifact.spam_check_id = cc.get('session_id','')
         log.info("spam=%s (mollom): %s" % (str(res), log_msg))
         return res
 
+    def submit_spam(self, text, artifact=None, user=None, content_type='comment', **kw):
+        self.service.sendFeedback(artifact.spam_check_id, 'spam')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7926917/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 4375077..544865c 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -33,6 +33,7 @@ from allura.lib import security
 from allura.lib.security import require_access, has_access
 from allura.lib import utils
 from allura.model.notification import Notification, Mailbox
+from allura.model.auth import ProjectRole
 from .artifact import Artifact, ArtifactReference, VersionedArtifact, Snapshot, Message, Feed
 from .attachments import BaseAttachment
 from .auth import User
@@ -232,6 +233,18 @@ class Thread(Artifact, ActivityObject):
             Feed.post(self.primary(), title=p.subject, description=p.text, link=link)
         return p
 
+    def check_spam(self, post):
+        result = True
+        for role in c.user.project_role(c.project).roles:
+            if ((ProjectRole.query.get(_id=role).name == 'Admin') or
+                    (ProjectRole.query.get(_id=role).name == 'Developer')):
+                return True
+
+        if g.spam_checker.check('%s\n%s' % (post.subject, post.text), artifact=post, user=c.user):
+            result = False
+        return result
+
+
     def post(self, text, message_id=None, parent_id=None,
              timestamp=None, ignore_security=False, **kw):
         if not ignore_security:
@@ -255,7 +268,8 @@ class Thread(Artifact, ActivityObject):
         if message_id is not None:
             kwargs['_id'] = message_id
         post = self.post_class()(**kwargs)
-        if ignore_security or has_access(self, 'unmoderated_post')():
+
+        if ignore_security or self.check_spam(post):
             log.info('Auto-approving message from %s', c.user.username)
             file_info = kw.get('file_info', None)
             post.approve(file_info, notify=kw.get('notify', True))
@@ -436,6 +450,7 @@ class Post(Message, VersionedArtifact, ActivityObject):
     last_edit_date = FieldProperty(datetime, if_missing=None)
     last_edit_by_id = ForeignIdProperty(User)
     edit_count = FieldProperty(int, if_missing=0)
+    spam_check_id = FieldProperty(str, if_missing='')
 
     thread = RelationProperty(Thread)
     discussion = RelationProperty(Discussion)
@@ -645,6 +660,7 @@ class Post(Message, VersionedArtifact, ActivityObject):
     def spam(self):
         self.status = 'spam'
         self.thread.num_replies = max(0, self.thread.num_replies - 1)
+        g.spam_checker.submit_spam(self.text, artifact=self, user=c.user)
 
 
 class DiscussionAttachment(BaseAttachment):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7926917/Allura/allura/tests/functional/test_discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_discuss.py b/Allura/allura/tests/functional/test_discuss.py
index 633f078..8a51ac4 100644
--- a/Allura/allura/tests/functional/test_discuss.py
+++ b/Allura/allura/tests/functional/test_discuss.py
@@ -70,7 +70,8 @@ class TestDiscuss(TestController):
         r = r.follow()
         return r
 
-    def test_post(self):
+    @patch('allura.controllers.discuss.g.spam_checker.submit_spam')
+    def test_post(self, submit_spam):
         home = self.app.get('/wiki/_discuss/')
         thread_link = [ a for a in home.html.findAll('a')
                  if 'thread' in a['href'] ][0]['href']
@@ -109,6 +110,7 @@ class TestDiscuss(TestController):
         self.app.post(permalinks[1]+'flag')
         self.app.post(permalinks[1]+'moderate', params=dict(delete='delete'))
         self.app.post(permalinks[0]+'moderate', params=dict(spam='spam'))
+        assert submit_spam.call_args[0] ==('This is a new post',), submit_spam.call_args[0]
 
     def test_permissions(self):
         home = self.app.get('/wiki/_discuss/')
@@ -136,12 +138,14 @@ class TestDiscuss(TestController):
         self.app.get(thread_url, status=403, # forbidden
                      extra_environ=dict(username=non_admin))
 
-    def test_moderate(self):
+    @patch('allura.controllers.discuss.g.spam_checker.submit_spam')
+    def test_moderate(self, submit_spam):
         r = self._make_post('Test post')
         post_link = str(r.html.find('div', {'class': 'edit_post_form reply'}).find('form')['action'])
         post = M.Post.query.find().first()
         post.status = 'pending'
         self.app.post(post_link + 'moderate', params=dict(spam='spam'))
+        assert submit_spam.call_args[0] ==('Test post',), submit_spam.call_args[0]
         post = M.Post.query.find().first()
         assert post.status == 'spam'
         self.app.post(post_link + 'moderate', params=dict(approve='approve'))

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7926917/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 35c5594..68611b3 100644
--- a/Allura/allura/tests/model/test_discussion.py
+++ b/Allura/allura/tests/model/test_discussion.py
@@ -356,3 +356,25 @@ def test_post_notify():
             pass  # method not called as expected
         else:
             assert False, 'send_simple must not be called'
+
+@with_setup(setUp, tearDown)
+def test_check_spam_for_admin():
+    d = M.Discussion(shortname='test', name='test')
+    t = M.Thread(discussion_id=d._id, subject='Test Thread')
+    t.post('This is a post')
+    post = M.Post.query.get(text='This is a post')
+    assert t.check_spam(post), t.check_spam(post)
+
+@with_setup(setUp, tearDown)
+@patch('allura.model.discuss.c.user.project_role')
+def test_check_spam(role):
+    d = M.Discussion(shortname='test', name='test')
+    t = M.Thread(discussion_id=d._id, subject='Test Thread')
+    role.roles.return_value = []
+    with mock.patch('allura.controllers.discuss.g.spam_checker') as spam_checker:
+        spam_checker.check.return_value = True
+        post = mock.Mock()
+        assert not t.check_spam(post)
+        assert spam_checker.check.call_count == 1, spam_checker.call_count
+
+

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7926917/Allura/allura/tests/unit/spam/test_akismet.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/spam/test_akismet.py b/Allura/allura/tests/unit/spam/test_akismet.py
index a03b148..bb9a90e 100644
--- a/Allura/allura/tests/unit/spam/test_akismet.py
+++ b/Allura/allura/tests/unit/spam/test_akismet.py
@@ -59,6 +59,7 @@ class TestAkismet(unittest.TestCase):
     def test_check(self, request, c):
         request.headers = self.fake_headers
         c.user = None
+        self.akismet.service.comment_check.side_effect({'side_effect':''})
         self.akismet.check(self.content)
         self.akismet.service.comment_check.assert_called_once_with(self.content,
                 data=self.expected_data, build_data=False)
@@ -119,3 +120,12 @@ class TestAkismet(unittest.TestCase):
         self.akismet.check(self.content)
         self.akismet.service.comment_check.assert_called_once_with(self.content,
                 data=self.expected_data, build_data=False)
+
+    @mock.patch('allura.lib.spam.akismetfilter.c')
+    @mock.patch('allura.lib.spam.akismetfilter.request')
+    def test_submit_spam(self, request, c):
+        request.headers = self.fake_headers
+        c.user = None
+        self.akismet.submit_spam(self.content)
+        self.akismet.service.submit_spam.assert_called_once_with(self.content, data=self.expected_data, build_data=False)
+

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7926917/Allura/allura/tests/unit/spam/test_mollom.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/spam/test_mollom.py b/Allura/allura/tests/unit/spam/test_mollom.py
index 63b0b6d..7828908 100644
--- a/Allura/allura/tests/unit/spam/test_mollom.py
+++ b/Allura/allura/tests/unit/spam/test_mollom.py
@@ -58,15 +58,19 @@ class TestMollom(unittest.TestCase):
     def test_check(self, request, c):
         request.headers = self.fake_headers
         c.user = None
-        self.mollom.check(self.content)
+        artifact = mock.Mock()
+        artifact.spam_check_id = 'test_id'
+        self.mollom.check(self.content, artifact = artifact)
         self.mollom.service.checkContent.assert_called_once_with(**self.expected_data)
 
     @mock.patch('allura.lib.spam.mollomfilter.c')
     @mock.patch('allura.lib.spam.mollomfilter.request')
     def test_check_with_user(self, request, c):
+        artifact = mock.Mock()
+        artifact.spam_check_id = 'test_id'
         request.headers = self.fake_headers
         c.user = None
-        self.mollom.check(self.content, user=self.fake_user)
+        self.mollom.check(self.content, user=self.fake_user, artifact=artifact)
         expected_data = self.expected_data
         expected_data.update(authorName=u'Søme User'.encode('utf8'),
                 authorMail='user@domain')
@@ -75,9 +79,11 @@ class TestMollom(unittest.TestCase):
     @mock.patch('allura.lib.spam.mollomfilter.c')
     @mock.patch('allura.lib.spam.mollomfilter.request')
     def test_check_with_implicit_user(self, request, c):
+        artifact = mock.Mock()
+        artifact.spam_check_id = 'test_id'
         request.headers = self.fake_headers
         c.user = self.fake_user
-        self.mollom.check(self.content)
+        self.mollom.check(self.content, artifact=artifact)
         expected_data = self.expected_data
         expected_data.update(authorName=u'Søme User'.encode('utf8'),
                 authorMail='user@domain')
@@ -86,10 +92,22 @@ class TestMollom(unittest.TestCase):
     @mock.patch('allura.lib.spam.mollomfilter.c')
     @mock.patch('allura.lib.spam.mollomfilter.request')
     def test_check_with_fallback_ip(self, request, c):
+        artifact = mock.Mock()
+        artifact.spam_check_id = 'test_id'
         self.expected_data['authorIP'] = 'fallback ip'
         self.fake_headers.pop('X_FORWARDED_FOR')
         request.headers = self.fake_headers
         request.remote_addr = self.fake_headers['REMOTE_ADDR']
         c.user = None
-        self.mollom.check(self.content)
+        self.mollom.check(self.content, artifact=artifact)
         self.mollom.service.checkContent.assert_called_once_with(**self.expected_data)
+
+    @mock.patch('allura.lib.spam.mollomfilter.c')
+    @mock.patch('allura.lib.spam.mollomfilter.request')
+    def test_submit_spam(self, request, c):
+        request.headers = self.fake_headers
+        c.user = None
+        artifact = mock.Mock()
+        artifact.spam_check_id = 'test_id'
+        self.mollom.submit_spam('test', artifact=artifact)
+        assert 'test_id' in self.mollom.service.sendFeedback.call_args[0]

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7926917/Allura/allura/tests/unit/spam/test_spam_filter.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/spam/test_spam_filter.py b/Allura/allura/tests/unit/spam/test_spam_filter.py
index 3f29247..a871aaa 100644
--- a/Allura/allura/tests/unit/spam/test_spam_filter.py
+++ b/Allura/allura/tests/unit/spam/test_spam_filter.py
@@ -34,6 +34,9 @@ class TestSpamFilter(unittest.TestCase):
         # default no-op impl always returns False
         self.assertFalse(SpamFilter({}).check('foo'))
 
+    def test_submit_spam(self):
+        SpamFilter({}).submit_spam('foo')
+
     def test_get_default(self):
         config = {}
         entry_points = None

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7926917/ForgeDiscussion/forgediscussion/controllers/root.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/controllers/root.py b/ForgeDiscussion/forgediscussion/controllers/root.py
index 8e074aa..0fd34b5 100644
--- a/ForgeDiscussion/forgediscussion/controllers/root.py
+++ b/ForgeDiscussion/forgediscussion/controllers/root.py
@@ -118,7 +118,6 @@ class RootController(BaseController, DispatchIndex, FeedController):
         thd = discussion.get_discussion_thread(dict(
                 headers=dict(Subject=subject)))[0]
         post = thd.post(subject, text)
-        is_spam = g.spam_checker.check('%s\n%s' % (subject, text), artifact=post, user=c.user)
         flash('Message posted')
         redirect(thd.url())
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7926917/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py b/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
index 73b6682..6395b52 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
@@ -385,8 +385,7 @@ class TestForum(TestController):
                 'delete': 'Delete Marked'})
         _check()
 
-    @mock.patch('forgediscussion.controllers.root.g.spam_checker')
-    def test_posting(self, spam_checker):
+    def test_posting(self):
         r = self.app.get('/discussion/create_topic/')
         f = r.html.find('form',{'action':'/p/test/discussion/save_new_topic'})
         params = dict()
@@ -398,8 +397,6 @@ class TestForum(TestController):
         params[f.find('select')['name']] = 'testforum'
         params[f.find('input',{'style':'width: 90%'})['name']] = 'Test Thread'
         r = self.app.post('/discussion/save_new_topic', params=params)
-        assert spam_checker.check.call_args[0] == ('Test Thread\nThis is a *test thread*',), \
-            spam_checker.check.call_args[0]
         r = self.app.get('/admin/discussion/forums')
         assert 'Message posted' in r
         r = self.app.get('/discussion/testforum/moderate/')
@@ -410,7 +407,9 @@ class TestForum(TestController):
         assert 'noreply' not in n.reply_to_address, n
         assert 'testforum@discussion.test.p' in n.reply_to_address, n
 
-    def test_anonymous_post(self):
+    @mock.patch('allura.model.discuss.g.spam_checker')
+    def test_anonymous_post(self, spam_checker):
+        spam_checker.check.return_value = True
         r = self.app.get('/admin/discussion/permissions')
         select = r.html.find('select', {'name': 'card-3.new'})
         opt_anon = select.find(text='*anonymous').parent
@@ -456,8 +455,7 @@ class TestForum(TestController):
         link = '<a href="%s">[%s]</a>' % (post.thread.url() + '?limit=25#' + post.slug, post.shorthand_id())
         assert link in r, link
 
-    @mock.patch('forgediscussion.controllers.root.g.spam_checker')
-    def test_thread(self, spam_checker):
+    def test_thread(self):
         r = self.app.get('/discussion/create_topic/')
         f = r.html.find('form',{'action':'/p/test/discussion/save_new_topic'})
         params = dict()
@@ -481,7 +479,6 @@ class TestForum(TestController):
                 params[field['name']] = field.has_key('value') and field['value'] or ''
         params[f.find('textarea')['name']] = 'bbb'
         thread = self.app.post(str(rep_url), params=params)
-        assert spam_checker.check.call_args[0] == ('bbb',), spam_checker.check.call_args[0]
         thread = self.app.get(url)
         # beautiful soup is getting some unicode error here - test without it
         assert thread.html.findAll('div',{'class':'display_post'})[0].find('p').string == 'aaa'

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e7926917/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 dfaaba1..d57a503 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -1772,7 +1772,9 @@ class TestEmailMonitoring(TrackerTestController):
 
     @td.with_tool('test', 'Tickets', 'doc-bugs', post_install_hook=post_install_hook)
     @patch('forgetracker.model.ticket.Notification.send_direct')
-    def test_notifications_moderators(self, send_direct):
+    @patch('allura.model.discuss.Thread.check_spam')
+    def test_notifications_moderators(self, check_spam, send_direct):
+        check_spam.return_value = False
         self.new_ticket(summary='test moderation', mount_point='/doc-bugs/')
         self.app.post('/doc-bugs/1/update_ticket',{
             'summary':'test moderation',


[08/13] git commit: Typo (the the)

Posted by jo...@apache.org.
Typo (the the)


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

Branch: refs/heads/cj/5571
Commit: a6e48be41217bb88c243fd7e6b206c5d2f7b2a04
Parents: fdadc22
Author: Rich Bowen <rb...@rcbowen.com>
Authored: Wed Oct 12 09:56:46 2011 -0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue May 14 14:32:32 2013 +0000

----------------------------------------------------------------------
 Allura/docs/guides/email.rst |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a6e48be4/Allura/docs/guides/email.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/guides/email.rst b/Allura/docs/guides/email.rst
index b26b7f2..d238321 100644
--- a/Allura/docs/guides/email.rst
+++ b/Allura/docs/guides/email.rst
@@ -60,7 +60,7 @@ Users are allowed to register that they want plain text only.
 We will also include some text in the footer of the e-mail message with a
 link to the message online.   We can use this link to guess where in the
 thread the message belongs in the case of a messed up e-mail client that
-does not set the the headers for the reply properly.
+does not set the headers for the reply properly.
 
 The nice thing about this is that it's pretty much already implemented
 for us via the meta tool.


[11/13] git commit: [#6195] Changed tool list page to used defined capitalization instead of .title()

Posted by jo...@apache.org.
[#6195] Changed tool list page to used defined capitalization instead of .title()

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

Branch: refs/heads/cj/5571
Commit: bf43535c86470c8640d1be0615e9d6d0511adc5a
Parents: 7676361
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Mon May 6 18:47:44 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue May 14 14:55:58 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/project.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bf43535c/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index d47caf4..cc80ad3 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -298,7 +298,7 @@ class ToolListController(object):
         tool_name = tool_name.lower()
         entries = [e for e in c.project.sitemap()
                 if e.tool_name and e.tool_name.lower() == tool_name]
-        return dict(entries=entries, type=entries[0].tool_name.capitalize() if entries else None)
+        return dict(entries=entries, type=g.entry_points['tool'][tool_name].tool_label if entries else None)
 
 class ProjectController(FeedController):