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/30 01:11:55 UTC

[01/21] git commit: [#6267] ticket:360 A little more tests for wiki api

Updated Branches:
  refs/heads/cj/4994 488c5335b -> 956b6c5f1 (forced update)


[#6267] ticket:360 A little more tests for wiki api


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

Branch: refs/heads/cj/4994
Commit: 067705d61f4e28592a99904c007ea4be8a6eddce
Parents: a3e7f32
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri May 24 13:25:05 2013 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon May 27 09:02:18 2013 +0000

----------------------------------------------------------------------
 ForgeWiki/forgewiki/tests/functional/test_rest.py |   18 +++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/067705d6/ForgeWiki/forgewiki/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_rest.py b/ForgeWiki/forgewiki/tests/functional/test_rest.py
index af1080a..f6f8714 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_rest.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_rest.py
@@ -1,3 +1,4 @@
+# coding: utf-8
 import json
 
 from nose.tools import assert_equal
@@ -32,7 +33,11 @@ class TestWikiApi(TestRestApiBase):
         r = json.loads(r.body)
         assert_equal(len(r['attachments']), 2)
 
-    def test_post_page(self):
+    def test_page_does_not_exist(self):
+        r = self.api_get('/rest/p/test/wiki/fake/')
+        assert_equal(r.status_int, 404)
+
+    def test_update_page(self):
         data = {
             'text': 'Embrace the Dark Side',
             'labels': 'head hunting,dark side'
@@ -42,3 +47,14 @@ class TestWikiApi(TestRestApiBase):
         r = self.api_get('/rest/p/test/wiki/Home/')
         assert_equal(r.json['text'], data['text'])
         assert_equal(r.json['labels'], data['labels'].split(','))
+
+    def test_create_page(self):
+        data = {
+            'text': 'Embrace the Dark Side',
+            'labels': 'head hunting,dark side'
+        }
+        r = self.api_post(u'/rest/p/test/wiki/tést/'.encode('utf-8'), **data)
+        assert_equal(r.status_int, 200)
+        r = self.api_get(u'/rest/p/test/wiki/tést/'.encode('utf-8'))
+        assert_equal(r.json['text'], data['text'])
+        assert_equal(r.json['labels'], data['labels'].split(','))


[06/21] git commit: [#5913] Fixed styling of new project header

Posted by jo...@apache.org.
[#5913] Fixed styling of new project header

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

Branch: refs/heads/cj/4994
Commit: 88c6ce258bc7bbee91b35c5d29a9fb1c6bec6be3
Parents: b667a6d
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Tue May 21 20:31:22 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 29 18:40:17 2013 +0000

----------------------------------------------------------------------
 Allura/allura/nf/allura/css/site_style.css         |   29 ++++++++++++++-
 Allura/allura/templates/jinja_master/nav_menu.html |    2 +-
 2 files changed, 28 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/88c6ce25/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index 06b93ca..6623b94 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -2091,8 +2091,33 @@ nav .ico {
   vertical-align: middle;
 }
 
-.project_title {
-  line-height: 48px;
+#nav_menu_holder {
+    margin: 0 0 15px;
+}
+
+#nav_menu_holder h1.project_title {
+  line-height: 1em;
+  font-size: 32px;
+  margin-bottom: 0;
+}
+
+#nav_menu_holder h1.project_title a,
+#nav_menu_holder h1.project_title a:hover,
+#nav_menu_holder h1.project_title a:visited,
+#nav_menu_holder h1.project_title a:focus {
+    color: #555;
+    text-decoration: none;
+}
+
+#nav_menu_holder h2.project_summary {
+  line-height: 1em;
+  font-size: 16px;
+  font-weight: normal;
+  margin-bottom: 0;
+}
+
+#nav_menu_holder .brought-by.with-icon {
+  margin-left: 55px;
 }
 
 .neighborhood_icon {

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/88c6ce25/Allura/allura/templates/jinja_master/nav_menu.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/nav_menu.html b/Allura/allura/templates/jinja_master/nav_menu.html
index 15f7fac..27c7b56 100644
--- a/Allura/allura/templates/jinja_master/nav_menu.html
+++ b/Allura/allura/templates/jinja_master/nav_menu.html
@@ -43,7 +43,7 @@
     <h1 class="project_title">
       <a href="{{c.project.url()}}" class="project_link">{{ c.project.neighborhood.name if c.project.is_nbhd_project else c.project.name }}</a>
     </h1>
-    <h2>
+    <h2 class="project_summary">
         {{c.project.summary}}
     </h2>
     <div class="brought-by{% if c.project.icon %} with-icon{% endif %}">


[16/21] git commit: [#5716] make project admin's support choices configurable, and off by default

Posted by jo...@apache.org.
[#5716] make project admin's support choices configurable, and off by default


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

Branch: refs/heads/cj/4994
Commit: 4727a8b983e8220c8d2a36f9be761f72be2549fb
Parents: 4c8116d
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed May 29 14:08:58 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed May 29 19:01:56 2013 +0000

----------------------------------------------------------------------
 .../templates/admin_widgets/metadata_admin.html    |    6 +++++-
 Allura/development.ini                             |    6 ++++++
 Allura/test.ini                                    |    2 ++
 3 files changed, 13 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4727a8b9/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html b/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
index b37d638..454f33a 100644
--- a/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
+++ b/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
@@ -41,6 +41,8 @@
     {{widget.display_field(widget.fields.short_description) }}
 
     <div style="clear:both">&nbsp;</div>
+    
+    {% if tg.config.get('support_tool_choices') %}
     Preferred Support Page (for users of your project):<br>
     {% if c.form_errors.get('support_page_url') %}
         <div class="error">{{c.form_errors.get('support_page_url')}}</div>
@@ -48,7 +50,7 @@
     <input name="support_page" type="radio" value=""{% if value.support_page == '' %} checked{% endif %} id="support_page_none">
     <label for="support_page_none">None</label><br>
     {% for ac in c.project.app_configs %}
-      {% if ac.tool_name.lower() in ['wiki', 'tickets', 'discussion'] %}
+      {% if ac.tool_name.lower() in tg.config['support_tool_choices'].split() %}
         <input name="support_page" type="radio" value="{{ac.options.mount_point}}" id="support_page_{{ac.options.mount_point}}"
                {% if value.support_page == ac.options.mount_point %} checked{% endif %}>
         <label for="support_page_{{ac.options.mount_point}}">{{ac.options.mount_label}}</label><br>
@@ -60,6 +62,8 @@
            {% if value.support_page == '_url' %} checked{% endif %}>
     <label for="support_page_url_cb">URL: </label>
     <input type="text" name="support_page_url" value="{{value.support_page_url}}" style="width: 70%"><br>
+    {% endif %}
+
     {{ widget.display_label(widget.fields.twitter_handle) }}
     <br>
     {{widget.display_field(widget.fields.twitter_handle) }}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4727a8b9/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index cdde88e..b3c084f 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -141,6 +141,12 @@ scm.repos.tarball.root = /usr/share/nginx/www/
 scm.repos.tarball.url_prefix = http://localhost/
 scm.repos.tarball.zip_binary = /usr/bin/zip
 
+# space-separated list of tool names that are valid options
+# for project admins to set for their 'support_page' field
+# this field is not used by default in Allura, so this option
+# is disabled by default
+#support_tool_choices = wiki tickets discussion
+
 trovecategories.enableediting = true
 
 # ActivityStream

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4727a8b9/Allura/test.ini
----------------------------------------------------------------------
diff --git a/Allura/test.ini b/Allura/test.ini
index f749705..b3d9760 100644
--- a/Allura/test.ini
+++ b/Allura/test.ini
@@ -101,6 +101,8 @@ scm.repos.tarball.enable = true
 scm.repos.tarball.root = /tmp/tarball
 scm.repos.tarball.url_prefix = file://
 
+support_tool_choices = wiki tickets discussion
+
 #stats.sample_rate = 0
 
 disable_csrf_protection=1


[21/21] git commit: [#4994] Improved error checking around notifications to prevent lost notifications

Posted by jo...@apache.org.
[#4994] Improved error checking around notifications to prevent lost notifications

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

Branch: refs/heads/cj/4994
Commit: aef20b8c609832aec814eb5de27fbf617cc81f19
Parents: 4727a8b
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed May 29 15:44:24 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed May 29 23:10:23 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/notification.py |   67 +++++++++++++++++++++---------
 1 files changed, 47 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aef20b8c/Allura/allura/model/notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
index 3c3517f..61a5657 100644
--- a/Allura/allura/model/notification.py
+++ b/Allura/allura/model/notification.py
@@ -454,13 +454,20 @@ class Mailbox(MappedClass):
             'topic':{'$in':[None, topic]}
             }
         for mbox in cls.query.find(d):
-            mbox.query.update(
-                {'$push':dict(queue=nid),
-                 '$set':dict(last_modified=datetime.utcnow(),
-                             queue_empty=False),
-                })
-            # Make sure the mbox doesn't stick around to be flush()ed
-            session(mbox).expunge(mbox)
+            try:
+                mbox.query.update(
+                    {'$push':dict(queue=nid),
+                     '$set':dict(last_modified=datetime.utcnow(),
+                                 queue_empty=False),
+                    })
+                # Make sure the mbox doesn't stick around to be flush()ed
+                session(mbox).expunge(mbox)
+            except:
+                # log error but try to keep processing, lest all the other eligible
+                # mboxes for this notification get skipped and lost forever
+                log.exception(
+                    'Error adding notification: %s for artifact %s on project %s to user %s',
+                    nid, artifact_index_id, c.project._id, mbox.user_id)
 
     @classmethod
     def fire_ready(cls):
@@ -490,7 +497,11 @@ class Mailbox(MappedClass):
                 new=False)
 
         for mbox in take_while_true(find_and_modify_direct_mbox):
-            mbox.fire(now)
+            try:
+                mbox.fire(now)
+            except:
+                log.exception('Error firing mbox: %s with queue: [%s]', str(mbox._id), ', '.join(mbox.queue))
+                raise  # re-raise so we don't keep (destructively) trying to process mboxes
 
         for mbox in cls.query.find(q_digest):
             next_scheduled = now
@@ -519,20 +530,36 @@ class Mailbox(MappedClass):
         if self.type == 'direct':
             ngroups = defaultdict(list)
             for n in notifications:
-                if n.topic == 'message':
-                    n.send_direct(self.user_id)
-                    # Messages must be sent individually so they can be replied
-                    # to individually
-                else:
-                    key = (n.subject, n.from_address, n.reply_to_address, n.author_id)
-                    ngroups[key].append(n)
+                try:
+                    if n.topic == 'message':
+                        n.send_direct(self.user_id)
+                        # Messages must be sent individually so they can be replied
+                        # to individually
+                    else:
+                        key = (n.subject, n.from_address, n.reply_to_address, n.author_id)
+                        ngroups[key].append(n)
+                except:
+                    # log error but keep trying to deliver other notifications,
+                    # lest the other notifications (which have already been removed
+                    # from the mobx's queue in mongo) be lost
+                    log.exception(
+                        'Error sending notification: %s to mbox %s (user %s)',
+                        n._id, self._id, self.user_id)
             # Accumulate messages from same address with same subject
             for (subject, from_address, reply_to_address, author_id), ns in ngroups.iteritems():
-                if len(ns) == 1:
-                    n.send_direct(self.user_id)
-                else:
-                    Notification.send_digest(
-                        self.user_id, from_address, subject, ns, reply_to_address)
+                try:
+                    if len(ns) == 1:
+                        n.send_direct(self.user_id)
+                    else:
+                        Notification.send_digest(
+                            self.user_id, from_address, subject, ns, reply_to_address)
+                except:
+                    # log error but keep trying to deliver other notifications,
+                    # lest the other notifications (which have already been removed
+                    # from the mobx's queue in mongo) be lost
+                    log.exception(
+                        'Error sending notifications: [%s] to mbox %s (user %s)',
+                        ', '.join([n._id for n in ns]), self._id, self.user_id)
         elif self.type == 'digest':
             Notification.send_digest(
                 self.user_id, u'noreply@in.sf.net', 'Digest Email',


[07/21] git commit: [#5913] Project header should show admins, not members

Posted by jo...@apache.org.
[#5913] Project header should show admins, not members

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

Branch: refs/heads/cj/4994
Commit: 94029b503ab41d9b3b1f356b44c0d01750e81b1a
Parents: 2ff2b78
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Tue May 21 19:36:57 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 29 18:40:17 2013 +0000

----------------------------------------------------------------------
 Allura/allura/templates/jinja_master/nav_menu.html |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/94029b50/Allura/allura/templates/jinja_master/nav_menu.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/nav_menu.html b/Allura/allura/templates/jinja_master/nav_menu.html
index 1b6a8f9..67c44ab 100644
--- a/Allura/allura/templates/jinja_master/nav_menu.html
+++ b/Allura/allura/templates/jinja_master/nav_menu.html
@@ -52,12 +52,12 @@
     </a>
     <div class="brought-by{% if c.project.icon %} with-icon{% endif %}">
         Brought to you by:
-        {% set users = c.project.users()|sort(attribute='display_name') %}
-        {% for user in users[:4] %}
-            <a href="{{ user.url() }}">{{ user.username }}</a>{{ ',' if not loop.last }}
+        {% set admins = c.project.admins()|sort(attribute='username') %}
+        {% for admin in admins[:4] %}
+            <a href="{{ admin.url() }}">{{ admin.username }}</a>{{ ',' if not loop.last }}
         {%- endfor -%}
-        {% if users|length > 4 -%}
-            , and <a href="{{ c.project.url() }}_members/">{{ users|length - 4 }} others</a>
+        {% if admins|length > 4 -%}
+            , and <a href="{{ c.project.url() }}_members/">{{ admins|length - 4 }} others</a>
         {% endif %}
     </div>
 {% endif %}


[14/21] git commit: [#5716] show "Saved" message after saving main project info

Posted by jo...@apache.org.
[#5716] show "Saved" message after saving main project info


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

Branch: refs/heads/cj/4994
Commit: 8fc71796c30c5807d64987d00be6eda58376db15
Parents: 06d4a2a
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue May 28 21:58:14 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed May 29 19:01:56 2013 +0000

----------------------------------------------------------------------
 Allura/allura/ext/admin/admin_main.py |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8fc71796/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index 6f6dcea..7b188c9 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -392,6 +392,7 @@ class ProjectAdminController(BaseController):
                 square=True, thumbnail_size=(48,48),
                 thumbnail_meta=dict(project_id=c.project._id,category='icon'))
         g.post_event('project_updated')
+        flash('Saved', 'success')
         redirect('overview')
 
     def _add_trove(self, type, new_trove):


[19/21] git commit: [#4994] Fixed race condition when posting notifications

Posted by jo...@apache.org.
[#4994] Fixed race condition when posting notifications

If the thread that posts the notification takes a while to flush the
session (most easily seen on repo refreshes), then the Task can get
started before the new Notification instance is saved to mongo

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

Branch: refs/heads/cj/4994
Commit: 956b6c5f19c92b59d61298c8f11f0166b807243b
Parents: f3923bf
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed May 29 22:58:40 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed May 29 23:10:23 2013 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/956b6c5f/Allura/allura/model/notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
index ebc0eef..f5c9c6b 100644
--- a/Allura/allura/model/notification.py
+++ b/Allura/allura/model/notification.py
@@ -106,6 +106,8 @@ class Notification(MappedClass):
         import allura.tasks.notification_tasks
         n = cls._make_notification(artifact, topic, **kw)
         if n:
+            # make sure notification is flushed in time for task to process it
+            session(n).flush(n)
             allura.tasks.notification_tasks.notify.post(
                 n._id, artifact.index_id(), topic)
         return n
@@ -532,7 +534,10 @@ class Mailbox(MappedClass):
         '''
         notifications = Notification.query.find(dict(_id={'$in':self.queue}))
         notifications = notifications.all()
-        log.debug('Firing mailbox %s notifications [%s], found [%s]', str(self._id), ', '.join(self.queue), ', '.join([n._id for n in notifications]))
+        if len(notifications) != len(self.queue):
+            log.error('Mailbox queue error: Mailbox %s queued [%s], found [%s]', str(self._id), ', '.join(self.queue), ', '.join([n._id for n in notifications]))
+        else:
+            log.debug('Firing mailbox %s notifications [%s], found [%s]', str(self._id), ', '.join(self.queue), ', '.join([n._id for n in notifications]))
         if self.type == 'direct':
             ngroups = defaultdict(list)
             for n in notifications:


[12/21] git commit: [#5913] Minor IE fixes

Posted by jo...@apache.org.
[#5913] Minor IE fixes

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

Branch: refs/heads/cj/4994
Commit: f2af255e1028abfc59a115f16a7f2f71f0787012
Parents: 6fe0029
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed May 22 17:07:44 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 29 18:40:18 2013 +0000

----------------------------------------------------------------------
 Allura/allura/nf/allura/css/site_style.css |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f2af255e/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index cfbfc9e..b08330b 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -2133,6 +2133,8 @@ nav .ico {
 }
 
 #nav_menu_holder #dev-status {
+    display: inline-block;
+    line-height: 1em;
     vertical-align: top;
     text-transform: capitalize;
     font-size: 10px;


[10/21] git commit: [#5913] Added breadcrumb navigation to project header

Posted by jo...@apache.org.
[#5913] Added breadcrumb navigation to project header

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

Branch: refs/heads/cj/4994
Commit: 6fe002974a5ad4425c350ac2990b14dfa87d612f
Parents: 6618aba
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Tue May 21 23:18:06 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 29 18:40:18 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/project.py                     |   18 ++++++++++++
 Allura/allura/nf/allura/css/site_style.css         |   22 +++++++++++++++
 Allura/allura/templates/jinja_master/nav_menu.html |    2 +
 .../templates/jinja_master/theme_macros.html       |   18 ++++++++++++
 4 files changed, 60 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6fe00297/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index e98b44c..c11c148 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -117,6 +117,24 @@ class TroveCategory(MappedClass):
             trove = trove.parent_category
         return trove.shortname
 
+    @LazyProperty
+    def ancestors(self):
+        ancestors = []
+        trove = self
+        while trove:
+            ancestors.append(trove)
+            trove = trove.parent_category
+        return ancestors
+
+    @LazyProperty
+    def breadcrumbs(self):
+        url = '/directory/'
+        crumbs = []
+        for trove in reversed(self.ancestors[:-1]):
+            url += trove.shortname + '/'
+            crumbs.append((trove.fullname, url))
+        return crumbs
+
 class ProjectMapperExtension(MapperExtension):
     def after_insert(self, obj, st, sess):
         g.zarkov_event('project_create', project=obj)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6fe00297/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index b067f6d..cfbfc9e 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -2095,6 +2095,28 @@ nav .ico {
     margin: 0 0 15px;
 }
 
+#nav_menu_holder #breadcrumbs {
+    margin-bottom: 5px;
+}
+
+#nav_menu_holder #breadcrumbs ul {
+    list-style: none;
+    margin: 0;
+}
+
+#nav_menu_holder #breadcrumbs li {
+    display: inline;
+    font-size: 11px;
+}
+
+#nav_menu_holder #breadcrumbs li:after {
+    content: ' / ';
+}
+
+#nav_menu_holder #breadcrumbs li:last-child:after {
+    content: '';
+}
+
 #nav_menu_holder h1.project_title {
   line-height: 1em;
   font-size: 32px;

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6fe00297/Allura/allura/templates/jinja_master/nav_menu.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/nav_menu.html b/Allura/allura/templates/jinja_master/nav_menu.html
index 74f7509..724ca1c 100644
--- a/Allura/allura/templates/jinja_master/nav_menu.html
+++ b/Allura/allura/templates/jinja_master/nav_menu.html
@@ -17,10 +17,12 @@
        under the License.
 -#}
 {% import 'allura:templates/jinja_master/lib.html' as lib with context %}
+{% import g.theme.jinja_macros as theme_macros with context %}
 {% set n = c.project.neighborhood %}
 {% if not c.project or (n.neighborhood_project == c.project and not n.show_title) %}
   <div id="nav_menu_missing"></div>
 {% else %}
+  {{ theme_macros.breadcrumbs(c.project, c.app) }}
   {% if c.project.neighborhood.icon %}
     <a href="{{c.project.neighborhood.url()}}"><img src="{{c.project.neighborhood.url()}}/icon" class="neighborhood_icon"
        alt="Return to {{c.project.neighborhood.name}}" title="Return to {{c.project.neighborhood.name}}"></a>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6fe00297/Allura/allura/templates/jinja_master/theme_macros.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/theme_macros.html b/Allura/allura/templates/jinja_master/theme_macros.html
index e1c9903..a493075 100644
--- a/Allura/allura/templates/jinja_master/theme_macros.html
+++ b/Allura/allura/templates/jinja_master/theme_macros.html
@@ -78,3 +78,21 @@
 {%- macro extra_header(path_to_static) %}
 
 {%- endmacro %}
+
+{%- macro breadcrumbs(project, app) %}
+    <nav id="breadcrumbs">
+        <ul>
+            <li><a href="/">Home</a></li>
+            {% for label,url in project.breadcrumbs() %}
+                {% if not loop.last or app %}
+                    <li><a href="{{ url }}">{{ label }}</a></li>
+                {% else %}
+                    <li>{{ label }}</li>
+                {% endif %}
+            {% endfor %}
+            {% if app %}
+                <li>{{ app.config.options.mount_label }}</li>
+            {% endif %}
+        </ul>
+    </nav>
+{%- endmacro %}


[18/21] git commit: [#4994] Fixed bug in direct notification accumulation that could cause missing notifications

Posted by jo...@apache.org.
[#4994] Fixed bug in direct notification accumulation that could cause missing notifications

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

Branch: refs/heads/cj/4994
Commit: 9bc64c9bf99bc272e7b9862c8ff50432e2eb02db
Parents: aef20b8
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed May 29 16:38:28 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed May 29 23:10:23 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/notification.py            |    2 +-
 Allura/allura/tests/model/test_notification.py |   40 +++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9bc64c9b/Allura/allura/model/notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
index 61a5657..1ec530a 100644
--- a/Allura/allura/model/notification.py
+++ b/Allura/allura/model/notification.py
@@ -549,7 +549,7 @@ class Mailbox(MappedClass):
             for (subject, from_address, reply_to_address, author_id), ns in ngroups.iteritems():
                 try:
                     if len(ns) == 1:
-                        n.send_direct(self.user_id)
+                        ns[0].send_direct(self.user_id)
                     else:
                         Notification.send_digest(
                             self.user_id, from_address, subject, ns, reply_to_address)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9bc64c9b/Allura/allura/tests/model/test_notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_notification.py b/Allura/allura/tests/model/test_notification.py
index a894e20..6cdfbbb 100644
--- a/Allura/allura/tests/model/test_notification.py
+++ b/Allura/allura/tests/model/test_notification.py
@@ -17,10 +17,13 @@
 
 import unittest
 from datetime import timedelta
+import collections
 
 from pylons import tmpl_context as c, app_globals as g
 from nose.tools import assert_equal, assert_in
 from ming.orm import ThreadLocalORMSession
+import mock
+import bson
 
 from alluratest.controller import setup_basic_test, setup_global_objects, REGISTRY
 from allura import model as M
@@ -258,6 +261,43 @@ class TestSubscriptionTypes(unittest.TestCase):
     def _post_notification(self, text=None):
         return M.Notification.post(self.pg, 'metadata', text=text)
 
+    @mock.patch('allura.model.notification.defaultdict')
+    @mock.patch('allura.model.notification.Notification')
+    def test_direct_accumulation(self, mocked_notification, mocked_defaultdict):
+        class OrderedDefaultDict(collections.OrderedDict):
+            def __init__(self, factory=list, *a, **kw):
+                self._factory = factory
+                super(OrderedDefaultDict, self).__init__(*a, **kw)
+
+            def __getitem__(self, key):
+                if key not in self:
+                    value = self[key] = self._factory()
+                else:
+                    value = super(OrderedDefaultDict, self).__getitem__(key)
+                return value
+
+        notifications = mocked_notification.query.find.return_value.all.return_value = [
+                mock.Mock(_id='n0', topic='metadata', subject='s1', from_address='f1', reply_to_address='rt1', author_id='a1'),
+                mock.Mock(_id='n1', topic='metadata', subject='s2', from_address='f2', reply_to_address='rt2', author_id='a2'),
+                mock.Mock(_id='n2', topic='metadata', subject='s2', from_address='f2', reply_to_address='rt2', author_id='a2'),
+                mock.Mock(_id='n3', topic='message', subject='s3', from_address='f3', reply_to_address='rt3', author_id='a3'),
+                mock.Mock(_id='n4', topic='message', subject='s3', from_address='f3', reply_to_address='rt3', author_id='a3'),
+            ]
+        mocked_defaultdict.side_effect = OrderedDefaultDict
+
+        u0 = bson.ObjectId()
+        mbox = M.Mailbox(type='direct', user_id=u0, queue=['n0', 'n1', 'n2', 'n3', 'n4'])
+        mbox.fire('now')
+
+        mocked_notification.query.find.assert_called_once_with({'_id': {'$in': ['n0', 'n1', 'n2', 'n3', 'n4']}})
+        # first notification should be sent direct, as its key values are unique
+        notifications[0].send_direct.assert_called_once_with(u0)
+        # next two notifications should be sent as a digest as they have matching key values
+        mocked_notification.send_digest.assert_called_once_with(u0, 'f2', 's2', [notifications[1], notifications[2]], 'rt2')
+        # final two should be sent direct even though they matching keys, as they are messages
+        notifications[3].send_direct.assert_called_once_with(u0)
+        notifications[4].send_direct.assert_called_once_with(u0)
+
 def _clear_subscriptions():
         M.Mailbox.query.remove({})
 


[17/21] git commit: [#5716] expose tool type in _nav.json

Posted by jo...@apache.org.
[#5716] expose tool type in _nav.json


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

Branch: refs/heads/cj/4994
Commit: 06d4a2a1d7f881a3a63a346136e3abb2f819d67a
Parents: 17c0937
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue May 28 19:07:16 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed May 29 19:01:56 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/project.py        |    5 +++--
 Allura/allura/tests/functional/test_home.py |    6 +++---
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/06d4a2a1/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index cc80ad3..da39e5d 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -311,9 +311,10 @@ class ProjectController(FeedController):
     def _nav(self):
         menu = []
         for s in c.project.grouped_navbar_entries():
-            entry = dict(name=s.label, url=s.url, icon=s.ui_icon)
+            entry = dict(name=s.label, url=s.url, icon=s.ui_icon, tool_name=s.tool_name)
             if s.children:
-                entry['children'] = [dict(name=child.label, url=child.url, icon=child.ui_icon) for child in s.children]
+                entry['children'] = [dict(name=child.label, url=child.url, icon=child.ui_icon, tool_name=child.tool_name) 
+                                    for child in s.children]
             menu.append(entry)
         return dict(menu=menu)
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/06d4a2a1/Allura/allura/tests/functional/test_home.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_home.py b/Allura/allura/tests/functional/test_home.py
index 3e11437..5e9ec2e 100644
--- a/Allura/allura/tests/functional/test_home.py
+++ b/Allura/allura/tests/functional/test_home.py
@@ -50,8 +50,8 @@ class TestProjectHome(TestController):
         response = self.app.get('/p/test/_nav.json')
         menu = response.json['menu']
         assert_equal(len(menu[1]['children']), 2)
-        assert {u'url': u'/p/test/wiki/', u'name': u'Wiki', u'icon': u'tool-wiki'} in menu[1]['children'], menu[1]['children']
-        assert {u'url': u'/p/test/wiki2/', u'name': u'wiki2', u'icon': u'tool-wiki'} in menu[1]['children'], menu[1]['children']
+        assert {u'url': u'/p/test/wiki/', u'name': u'Wiki', u'icon': u'tool-wiki', 'tool_name': 'wiki'} in menu[1]['children'], menu[1]['children']
+        assert {u'url': u'/p/test/wiki2/', u'name': u'wiki2', u'icon': u'tool-wiki', 'tool_name': 'wiki'} in menu[1]['children'], menu[1]['children']
 
     @td.with_wiki
     def test_project_group_nav_more_than_ten(self):
@@ -65,7 +65,7 @@ class TestProjectHome(TestController):
         response = self.app.get('/p/test/_nav.json')
         menu = response.json['menu']
         assert_equal(len(menu[1]['children']), 11)
-        assert {u'url': u'/p/test/_list/wiki', u'name': u'More...', u'icon': u'tool-wiki'} in menu[1]['children']
+        assert {u'url': u'/p/test/_list/wiki', u'name': u'More...', u'icon': u'tool-wiki', 'tool_name': 'wiki'} in menu[1]['children']
 
     @td.with_wiki
     def test_neighborhood_home(self):


[11/21] git commit: [#5913] Add development status badge to project header

Posted by jo...@apache.org.
[#5913] Add development status badge to project header

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

Branch: refs/heads/cj/4994
Commit: 6618ababcf36eb31d0b85f662fa636a456af6be1
Parents: 88c6ce2
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Tue May 21 21:23:06 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 29 18:40:18 2013 +0000

----------------------------------------------------------------------
 Allura/allura/nf/allura/css/site_style.css         |   14 ++++++++++++++
 Allura/allura/templates/jinja_master/nav_menu.html |    5 +++++
 2 files changed, 19 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6618abab/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index 6623b94..b067f6d 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -2099,6 +2099,7 @@ nav .ico {
   line-height: 1em;
   font-size: 32px;
   margin-bottom: 0;
+  display: inline;
 }
 
 #nav_menu_holder h1.project_title a,
@@ -2109,6 +2110,19 @@ nav .ico {
     text-decoration: none;
 }
 
+#nav_menu_holder #dev-status {
+    vertical-align: top;
+    text-transform: capitalize;
+    font-size: 10px;
+    -webkit-border-radius: 2px;
+    -moz-border-radius: 2px;
+    -o-border-radius: 2px;
+    border-radius: 2px;
+    background-color: #09c;
+    color: white;
+    padding: 2px;
+}
+
 #nav_menu_holder h2.project_summary {
   line-height: 1em;
   font-size: 16px;

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6618abab/Allura/allura/templates/jinja_master/nav_menu.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/nav_menu.html b/Allura/allura/templates/jinja_master/nav_menu.html
index 27c7b56..74f7509 100644
--- a/Allura/allura/templates/jinja_master/nav_menu.html
+++ b/Allura/allura/templates/jinja_master/nav_menu.html
@@ -43,6 +43,11 @@
     <h1 class="project_title">
       <a href="{{c.project.url()}}" class="project_link">{{ c.project.neighborhood.name if c.project.is_nbhd_project else c.project.name }}</a>
     </h1>
+    {% set status = c.project.troves_by_type('developmentstatus')|sort(attribute='fullname') %}
+    {% set status = status[-1] %}
+    {% if status and status.shortname not in ['production', 'mature'] %}
+    <span id="dev-status" class="{{ status.shortname }}">{{ status.shortname }}</span>
+    {% endif %}
     <h2 class="project_summary">
         {{c.project.summary}}
     </h2>


[02/21] git commit: [#6267] ticket:360 Restore wiki API POST functionality

Posted by jo...@apache.org.
[#6267] ticket:360 Restore wiki API POST functionality


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

Branch: refs/heads/cj/4994
Commit: a3e7f320c28c641fa60905af08120faac58e5457
Parents: 1af5b40
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri May 24 13:09:46 2013 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon May 27 09:02:18 2013 +0000

----------------------------------------------------------------------
 ForgeWiki/forgewiki/wiki_main.py |   50 ++++++++++++++++-----------------
 1 files changed, 24 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a3e7f320/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 94f98a5..650d271 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -702,42 +702,40 @@ class RootRestController(BaseController):
         return PageRestController(title), remainder
 
 
-    @h.vardec
-    @expose()
-    @require_post()
-    def post(self, title, **post_data):
-        page = WM.Page.query.get(
-            app_config_id=c.app.config._id,
-            title=title,
-            deleted=False)
-        if not page:
-            require_access(c.app, 'create')
-            page = WM.Page.upsert(title)
-            page.viewable_by = ['all']
-        else:
-            require_access(page, 'edit')
-        page.text = post_data['text']
-        if 'labels' in post_data:
-            page.labels = post_data['labels'].split(',')
-        page.commit()
-
 class PageRestController(BaseController):
 
     def __init__(self, title):
-        if title is not None:
-            self.page = WM.Page.query.get(app_config_id=c.app.config._id,
-                                          title=h.really_unicode(unquote(title)),
-                                          deleted=False)
-            if self.page is None:
-                raise exc.HTTPNotFound()
+        self.title = h.really_unicode(unquote(title)) if title else None
+        self.page = WM.Page.query.get(app_config_id=c.app.config._id,
+                                      title=self.title,
+                                      deleted=False)
 
     def _check_security(self):
-        require_access(self.page, 'read')
+        if self.page:
+            require_access(self.page, 'read')
 
+    @h.vardec
     @expose('json:')
     def index(self, **kw):
+        if request.method == 'POST':
+            return self._update_page(self.title, **kw)
+        if self.page is None:
+            raise exc.HTTPNotFound()
         return self.page.__json__()
 
+    def _update_page(self, title, **post_data):
+        if not self.page:
+            require_access(c.app, 'create')
+            self.page = WM.Page.upsert(title)
+            self.page.viewable_by = ['all']
+        else:
+            require_access(self.page, 'edit')
+        self.page.text = post_data['text']
+        if 'labels' in post_data:
+            self.page.labels = post_data['labels'].split(',')
+        self.page.commit()
+        return {}
+
 
 class WikiAdminController(DefaultAdminController):
 


[13/21] git commit: [#5716] add support option for contacting members

Posted by jo...@apache.org.
[#5716] add support option for contacting members


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

Branch: refs/heads/cj/4994
Commit: 17c0937f958bdb7448e751fe8d12e7360264b5c7
Parents: 4307a3d
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue May 28 19:03:29 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed May 29 19:01:55 2013 +0000

----------------------------------------------------------------------
 .../templates/admin_widgets/metadata_admin.html    |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/17c0937f/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html b/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
index ff60ab3..c21bce8 100644
--- a/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
+++ b/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
@@ -41,7 +41,7 @@
     {{widget.display_field(widget.fields.short_description) }}
 
     <div style="clear:both">&nbsp;</div>
-    Support Page:
+    Preferred Support Page (for users of your project):
     <br>
     <input name="support_page" type="radio" value=""{% if value.support_page == '' %} checked{% endif %} id="support_page_none">
     <label for="support_page_none">None</label><br>
@@ -52,6 +52,8 @@
         <label for="support_page_{{ac.options.mount_point}}">{{ac.options.mount_label}}</label><br>
       {% endif %}
     {% endfor %}
+    <input name="support_page" type="radio" value="_members" {% if value.support_page == '_members' %} checked{% endif %} id="support_page_members">
+    <label for="support_page_members">Contact project admins</label><br>
     <input name="support_page" type="radio" value="_url" id="support_page_url_cb"
            {% if value.support_page == '_url' %} checked{% endif %}>
     <label for="support_page_url_cb">URL: </label>


[03/21] git commit: [#6267] ticket:360 Test for wiki api post

Posted by jo...@apache.org.
[#6267] ticket:360 Test for wiki api post


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

Branch: refs/heads/cj/4994
Commit: 1af5b404be848880c79864a601e57c700029398c
Parents: 82f675f
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri May 24 12:54:39 2013 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon May 27 09:02:18 2013 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1af5b404/ForgeWiki/forgewiki/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_rest.py b/ForgeWiki/forgewiki/tests/functional/test_rest.py
new file mode 100644
index 0000000..af1080a
--- /dev/null
+++ b/ForgeWiki/forgewiki/tests/functional/test_rest.py
@@ -0,0 +1,44 @@
+import json
+
+from nose.tools import assert_equal
+
+from allura.lib import helpers as h
+from allura.tests import decorators as td
+from alluratest.controller import TestRestApiBase
+
+
+class TestWikiApi(TestRestApiBase):
+
+    def setUp(self):
+        super(TestWikiApi, self).setUp()
+        self.setup_with_tools()
+
+    @td.with_wiki
+    def setup_with_tools(self):
+        h.set_context('test', 'wiki', neighborhood='Projects')
+
+    def test_get_page(self):
+        r = self.app.get('/p/test/wiki/Home/')
+        discussion_url = r.html.findAll('form')[2]['action'][:-4]
+        content = file(__file__).read()
+        self.app.post('/wiki/Home/attach', upload_files=[('file_info', 'test_root.py', content)])
+        r = self.app.get('/rest/p/test/wiki/Home/')
+        r = json.loads(r.body)
+        assert_equal(r['attachments'][0]['url'], 'http://localhost:80/p/test/wiki/Home/attachment/test_root.py')
+        assert_equal(r['discussion_thread_url'], 'http://localhost:80/rest%s' % discussion_url)
+        assert_equal(r['discussion_thread']['_id'], discussion_url.split('/')[-2])
+        self.app.post('/wiki/Home/attach', upload_files=[('file_info', '__init__.py', content),])
+        r = self.app.get('/rest/p/test/wiki/Home/')
+        r = json.loads(r.body)
+        assert_equal(len(r['attachments']), 2)
+
+    def test_post_page(self):
+        data = {
+            'text': 'Embrace the Dark Side',
+            'labels': 'head hunting,dark side'
+        }
+        r = self.api_post('/rest/p/test/wiki/Home/', **data)
+        assert_equal(r.status_int, 200)
+        r = self.api_get('/rest/p/test/wiki/Home/')
+        assert_equal(r.json['text'], data['text'])
+        assert_equal(r.json['labels'], data['labels'].split(','))

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1af5b404/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 1baa28b..362d8bd 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -621,18 +621,3 @@ class TestRootController(TestController):
     def test_user_browse_page(self):
         r = self.app.get('/wiki/browse_pages/')
         assert '<td>Test Admin (test-admin)</td>' in r
-
-    def test_rest_wiki(self):
-        r = self.app.get('/p/test/wiki/Home/')
-        discussion_url = r.html.findAll('form')[2]['action'][:-4]
-        content = file(__file__).read()
-        self.app.post('/wiki/Home/attach', upload_files=[('file_info', 'test_root.py', content)])
-        r = self.app.get('/rest/p/test/wiki/Home/')
-        r = json.loads(r.body)
-        assert_equal(r['attachments'][0]['url'], 'http://localhost:80/p/test/wiki/Home/attachment/test_root.py')
-        assert_equal(r['discussion_thread_url'], 'http://localhost:80/rest%s' % discussion_url)
-        assert_equal(r['discussion_thread']['_id'], discussion_url.split('/')[-2])
-        self.app.post('/wiki/Home/attach', upload_files=[('file_info', '__init__.py', content),])
-        r = self.app.get('/rest/p/test/wiki/Home/')
-        r = json.loads(r.body)
-        assert_equal(len(r['attachments']), 2)


[15/21] git commit: [#5716] show URL validation errors on project metadata page

Posted by jo...@apache.org.
[#5716] show URL validation errors on project metadata page


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

Branch: refs/heads/cj/4994
Commit: 4c8116d2022ee6579f07935ff78e7de66a98b63a
Parents: 8fc7179
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed May 29 01:05:52 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed May 29 19:01:56 2013 +0000

----------------------------------------------------------------------
 .../templates/admin_widgets/metadata_admin.html    |   23 +++++++++------
 Allura/allura/ext/admin/widgets.py                 |   12 +++++--
 2 files changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4c8116d2/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html b/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
index c21bce8..b37d638 100644
--- a/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
+++ b/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
@@ -21,11 +21,11 @@
     {{ widget.display_label(widget.fields.name) }}
     <br>
     {{widget.display_field(widget.fields.name) }}
-    {%if value.neighborhood.name != 'Users'%}
+    {%if c.project.neighborhood.name != 'Users'%}
     <label for="shortname">Unixname</label>
     <br>
     <input id="shortname" type="text" disabled="disabled"
-           value="{{value.shortname}}">
+           value="{{c.project.shortname}}">
 
     {{ widget.display_label(widget.fields.external_homepage) }}
     <br>
@@ -41,11 +41,13 @@
     {{widget.display_field(widget.fields.short_description) }}
 
     <div style="clear:both">&nbsp;</div>
-    Preferred Support Page (for users of your project):
-    <br>
+    Preferred Support Page (for users of your project):<br>
+    {% if c.form_errors.get('support_page_url') %}
+        <div class="error">{{c.form_errors.get('support_page_url')}}</div>
+    {% endif %}
     <input name="support_page" type="radio" value=""{% if value.support_page == '' %} checked{% endif %} id="support_page_none">
     <label for="support_page_none">None</label><br>
-    {% for ac in value.app_configs %}
+    {% for ac in c.project.app_configs %}
       {% if ac.tool_name.lower() in ['wiki', 'tickets', 'discussion'] %}
         <input name="support_page" type="radio" value="{{ac.options.mount_point}}" id="support_page_{{ac.options.mount_point}}"
                {% if value.support_page == ac.options.mount_point %} checked{% endif %}>
@@ -57,14 +59,14 @@
     <input name="support_page" type="radio" value="_url" id="support_page_url_cb"
            {% if value.support_page == '_url' %} checked{% endif %}>
     <label for="support_page_url_cb">URL: </label>
-    <input type="text" name="support_page_url" value="{{value.support_page_url}}" style="width: 70%">
+    <input type="text" name="support_page_url" value="{{value.support_page_url}}" style="width: 70%"><br>
     {{ widget.display_label(widget.fields.twitter_handle) }}
     <br>
     {{widget.display_field(widget.fields.twitter_handle) }}
     {{ widget.display_label(widget.fields.facebook_page) }}
     <br>
     {{widget.display_field(widget.fields.facebook_page) }}
-    {% if value.neighborhood.features['google_analytics'] %}
+    {% if c.project.neighborhood.features['google_analytics'] %}
     {{ widget.display_label(widget.fields.tracking_id) }}
     <br>
     {{widget.display_field(widget.fields.tracking_id) }}
@@ -94,7 +96,7 @@
           <input type="submit" value="Save" name="save" style="float: none" />
       </div>
     </div>
-    {%if value.neighborhood.name != 'Users'%}
+    {%if c.project.neighborhood.name != 'Users'%}
     <div style="clear:both">&nbsp;</div>
 
     <div id="project-status">
@@ -109,8 +111,11 @@
             Deleted
         {% endif %}
         <a href="#" title="Edit"><b data-icon="p" class="ico ico-pencil"></b></a>
-        <div id="project-status-edit" class="hidden">
+        <div id="project-status-edit" class="{% if not c.form_errors %}hidden{% endif %}">
             <br>
+            {% if c.form_errors.get('moved_to_url') %}
+                <div class="error">{{c.form_errors.get('moved_to_url')}}</div>
+            {% endif %}
             <input name="removal" type="radio" value="" id="removal_active_cb"
                    {% if value.removal == '' %} checked{% endif %}>
             <label for="removal_active_cb">Active Project</label>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4c8116d2/Allura/allura/ext/admin/widgets.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/widgets.py b/Allura/allura/ext/admin/widgets.py
index 8719c65..e663687 100644
--- a/Allura/allura/ext/admin/widgets.py
+++ b/Allura/allura/ext/admin/widgets.py
@@ -168,11 +168,14 @@ class MetadataAdmin(ff.AdminForm):
                                             V.MaxBytesValidator(max=1000)),
                                         attrs=dict(title="Add a few paragraphs describing your project to new users."))
         icon = ew.FileField(label='Icon')
-        external_homepage = ew.InputField(field_type="text", label='Homepage')
+        external_homepage = ew.InputField(field_type="text", label='Homepage',
+                                          validator=fev.URL(add_http=True))
         support_page = ew.InputField(field_type="text", label='Support Page')
-        support_page_url = ew.InputField(field_type="text", label='Support Page URL')
+        support_page_url = ew.InputField(field_type="text", label='Support Page URL',
+                                         validator=fev.URL(add_http=True, if_empty=''))
         removal = ew.InputField(field_type="text", label='Removal')
-        moved_to_url = ew.InputField(field_type="text", label='Moved Project to URL')
+        moved_to_url = ew.InputField(field_type="text", label='Moved Project to URL',
+                                     validator=fev.URL(add_http=True, if_empty=''))
         export_controlled = ew.InputField(field_type="text", label='Export Control')
         export_control_type = ew.InputField(field_type="text", label='Export Control Type')
         delete = ew.InputField(field_type="hidden", label='Delete')
@@ -180,7 +183,8 @@ class MetadataAdmin(ff.AdminForm):
         undelete = ew.InputField(field_type="hidden", label='Undelete')
         tracking_id = ew.InputField(field_type="text", label="Analytics Tracking ID")
         twitter_handle = ew.InputField(field_type="text", label='Twitter Handle')
-        facebook_page = ew.InputField(field_type="text", label='Facebook page')
+        facebook_page = ew.InputField(field_type="text", label='Facebook page',
+                                      validator=fev.URL(add_http=True))
 
 class AuditLog(ew_core.Widget):
     template='jinja:allura.ext.admin:templates/widgets/audit.html'


[04/21] git commit: [#5913] Don't link entire project header

Posted by jo...@apache.org.
[#5913] Don't link entire project header

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

Branch: refs/heads/cj/4994
Commit: b667a6ded324d050d0468c7bb2d00e11a3856e0c
Parents: 94029b5
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Tue May 21 19:53:17 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 29 18:40:17 2013 +0000

----------------------------------------------------------------------
 Allura/allura/templates/jinja_master/nav_menu.html |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b667a6de/Allura/allura/templates/jinja_master/nav_menu.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/nav_menu.html b/Allura/allura/templates/jinja_master/nav_menu.html
index 67c44ab..15f7fac 100644
--- a/Allura/allura/templates/jinja_master/nav_menu.html
+++ b/Allura/allura/templates/jinja_master/nav_menu.html
@@ -35,21 +35,17 @@
          {% endif %}
       </div>
   {% endif %}
-  <a href="{{c.project.url()}}" class="project_link">
     {% if c.project.user_project_of %}
       {{lib.gravatar(c.project.user_project_of, size=48, className='project_icon')}}
     {% elif c.project.icon %}
       <img src="{{c.project.url()}}/icon?{{c.project.icon._id.generation_time}}" class="project_icon" alt="Project Logo">
     {% endif %}
-	<h1 class="project_title">
-      {% if c.project.is_nbhd_project %}
-        {{c.project.neighborhood.name}}
-      {% else %}
-        {{c.project.name}}
-      {% endif %}
-	</h1>
+    <h1 class="project_title">
+      <a href="{{c.project.url()}}" class="project_link">{{ c.project.neighborhood.name if c.project.is_nbhd_project else c.project.name }}</a>
+    </h1>
+    <h2>
         {{c.project.summary}}
-    </a>
+    </h2>
     <div class="brought-by{% if c.project.icon %} with-icon{% endif %}">
         Brought to you by:
         {% set admins = c.project.admins()|sort(attribute='username') %}


[05/21] git commit: [#5913] Add summary and members to project header

Posted by jo...@apache.org.
[#5913] Add summary and members to project header

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

Branch: refs/heads/cj/4994
Commit: ddea323addab2b2043affd6ab667d14eeeff5f65
Parents: 067705d
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed May 15 21:48:34 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 29 18:40:17 2013 +0000

----------------------------------------------------------------------
 Allura/allura/templates/jinja_master/nav_menu.html |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ddea323a/Allura/allura/templates/jinja_master/nav_menu.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/nav_menu.html b/Allura/allura/templates/jinja_master/nav_menu.html
index 76648a1..1b6a8f9 100644
--- a/Allura/allura/templates/jinja_master/nav_menu.html
+++ b/Allura/allura/templates/jinja_master/nav_menu.html
@@ -35,7 +35,7 @@
          {% endif %}
       </div>
   {% endif %}
-  <a href="{{c.project.url()}}">
+  <a href="{{c.project.url()}}" class="project_link">
     {% if c.project.user_project_of %}
       {{lib.gravatar(c.project.user_project_of, size=48, className='project_icon')}}
     {% elif c.project.icon %}
@@ -48,5 +48,16 @@
         {{c.project.name}}
       {% endif %}
 	</h1>
-	</a>
+        {{c.project.summary}}
+    </a>
+    <div class="brought-by{% if c.project.icon %} with-icon{% endif %}">
+        Brought to you by:
+        {% set users = c.project.users()|sort(attribute='display_name') %}
+        {% for user in users[:4] %}
+            <a href="{{ user.url() }}">{{ user.username }}</a>{{ ',' if not loop.last }}
+        {%- endfor -%}
+        {% if users|length > 4 -%}
+            , and <a href="{{ c.project.url() }}_members/">{{ users|length - 4 }} others</a>
+        {% endif %}
+    </div>
 {% endif %}


[09/21] git commit: [#5913] Fixed "and 1 others" corner-case on project header admin list

Posted by jo...@apache.org.
[#5913] Fixed "and 1 others" corner-case on project header admin list

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

Branch: refs/heads/cj/4994
Commit: 4307a3da0ad469f1893e3382e9db0e1b3a11122d
Parents: f2af255
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu May 23 20:11:22 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 29 18:40:18 2013 +0000

----------------------------------------------------------------------
 Allura/allura/templates/jinja_master/nav_menu.html |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4307a3da/Allura/allura/templates/jinja_master/nav_menu.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/nav_menu.html b/Allura/allura/templates/jinja_master/nav_menu.html
index 724ca1c..a34e20a 100644
--- a/Allura/allura/templates/jinja_master/nav_menu.html
+++ b/Allura/allura/templates/jinja_master/nav_menu.html
@@ -56,11 +56,12 @@
     <div class="brought-by{% if c.project.icon %} with-icon{% endif %}">
         Brought to you by:
         {% set admins = c.project.admins()|sort(attribute='username') %}
-        {% for admin in admins[:4] %}
-            <a href="{{ admin.url() }}">{{ admin.username }}</a>{{ ',' if not loop.last }}
+        {% for admin in admins[:5] %}
+            {% if loop.last and admins|length > 5 -%}
+                and <a href="{{ c.project.url() }}_members/">{{ admins|length - 4 }} others</a>
+            {% else %}
+                <a href="{{ admin.url() }}">{{ admin.username }}</a>{{ ',' if not loop.last }}
+            {% endif %}
         {%- endfor -%}
-        {% if admins|length > 4 -%}
-            , and <a href="{{ c.project.url() }}_members/">{{ admins|length - 4 }} others</a>
-        {% endif %}
     </div>
 {% endif %}


[08/21] git commit: [#5913] Add triangle to indicate nav menus with dropdowns

Posted by jo...@apache.org.
[#5913] Add triangle to indicate nav menus with dropdowns

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

Branch: refs/heads/cj/4994
Commit: 2ff2b78620d6afee353e5575d72139de4071fd04
Parents: ddea323
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu May 16 13:43:09 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed May 29 18:40:17 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/project.py           |    2 +-
 Allura/allura/tests/unit/test_project.py |   18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2ff2b786/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index da36ada..e98b44c 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -498,7 +498,7 @@ class Project(MappedClass, ActivityNode, ActivityObject):
                 if tool_name not in grouped_nav:
                     child = deepcopy(e)
                     # change label to be the tool name (type)
-                    e.label = g.entry_points['tool'][tool_name].tool_label
+                    e.label = g.entry_points['tool'][tool_name].tool_label + u' \u25be'
                     # add tool url to list of urls that will match this nav entry
                     # have to do this before changing the url to the list page
                     e.matching_urls.append(e.url)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2ff2b786/Allura/allura/tests/unit/test_project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_project.py b/Allura/allura/tests/unit/test_project.py
index 7329dba..f83cfe9 100644
--- a/Allura/allura/tests/unit/test_project.py
+++ b/Allura/allura/tests/unit/test_project.py
@@ -38,10 +38,10 @@ class TestProject(unittest.TestCase):
         p.sitemap = Mock(return_value=sitemap_entries)
         entries = p.grouped_navbar_entries()
         expected = [
-            ('Tickets', 'proj_url/_list/tickets', 3),
-            ('wiki', 'wiki url', 0),
-            ('Discussion', 'proj_url/_list/discussion', 2),
-            ('subproject', 'subproject url', 0),
+            (u'Tickets \u25be', 'proj_url/_list/tickets', 3),
+            (u'wiki', 'wiki url', 0),
+            (u'Discussion \u25be', 'proj_url/_list/discussion', 2),
+            (u'subproject', 'subproject url', 0),
         ]
         expected_ticket_urls = ['bugs url', 'features url', 'support url']
         actual = [(e.label, e.url, len(e.matching_urls)) for e in entries]
@@ -64,11 +64,11 @@ class TestProject(unittest.TestCase):
         p.tool_data['allura'] = {'grouping_threshold': 2}
         entries = p.grouped_navbar_entries()
         expected = [
-            ('Tickets', 'proj_url/_list/tickets', 3),
-            ('wiki', 'wiki url', 0),
-            ('discuss', 'discuss url', 0),
-            ('subproject', 'subproject url', 0),
-            ('help', 'help url', 0),
+            (u'Tickets \u25be', 'proj_url/_list/tickets', 3),
+            (u'wiki', 'wiki url', 0),
+            (u'discuss', 'discuss url', 0),
+            (u'subproject', 'subproject url', 0),
+            (u'help', 'help url', 0),
         ]
         expected_ticket_urls = ['bugs url', 'features url', 'support url']
         actual = [(e.label, e.url, len(e.matching_urls)) for e in entries]


[20/21] git commit: [#4994] Added more logging when sending notifications for debugging

Posted by jo...@apache.org.
[#4994] Added more logging when sending notifications for debugging

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

Branch: refs/heads/cj/4994
Commit: f3923bf2095afaf2f0c79f8da4f151560727a105
Parents: 9bc64c9
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed May 29 17:28:25 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed May 29 23:10:23 2013 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f3923bf2/Allura/allura/model/notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
index 1ec530a..ebc0eef 100644
--- a/Allura/allura/model/notification.py
+++ b/Allura/allura/model/notification.py
@@ -237,6 +237,7 @@ class Notification(MappedClass):
     def send_direct(self, user_id):
         user = User.query.get(_id=ObjectId(user_id))
         artifact = self.ref.artifact
+        log.debug('Sending direct notification %s to user %s', self._id, user_id)
         # Don't send if user doesn't have read perms to the artifact
         if user and artifact and \
                 not security.has_access(artifact, 'read', user)():
@@ -265,6 +266,7 @@ class Notification(MappedClass):
                     security.has_access(artifact, 'read', user)()
         notifications = filter(perm_check, notifications)
 
+        log.debug('Sending digest of notifications [%s] to user %s', ', '.join([n._id for n in notifications]), user_id)
         if reply_to_address is None:
             reply_to_address = from_address
         text = [ 'Digest of %s' % subject ]
@@ -287,6 +289,7 @@ class Notification(MappedClass):
     @classmethod
     def send_summary(self, user_id, from_address, subject, notifications):
         if not notifications: return
+        log.debug('Sending summary of notifications [%s] to user %s', ', '.join([n._id for n in notifications]), user_id)
         text = [ 'Digest of %s' % subject ]
         for n in notifications:
             text.append('From: %s' % n.from_address)
@@ -453,7 +456,9 @@ class Mailbox(MappedClass):
             'artifact_index_id':{'$in':[None, artifact_index_id]},
             'topic':{'$in':[None, topic]}
             }
-        for mbox in cls.query.find(d):
+        mboxes = cls.query.find(d).all()
+        log.debug('Delivering notification %s to mailboxes [%s]', nid, ', '.join([str(m._id) for m in mboxes]))
+        for mbox in mboxes:
             try:
                 mbox.query.update(
                     {'$push':dict(queue=nid),
@@ -527,6 +532,7 @@ class Mailbox(MappedClass):
         '''
         notifications = Notification.query.find(dict(_id={'$in':self.queue}))
         notifications = notifications.all()
+        log.debug('Firing mailbox %s notifications [%s], found [%s]', str(self._id), ', '.join(self.queue), ', '.join([n._id for n in notifications]))
         if self.type == 'direct':
             ngroups = defaultdict(list)
             for n in notifications: