You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2014/01/21 23:09:16 UTC
[01/22] git commit: [#6484] this MediawikiImporter pkg has templates
in it
Updated Branches:
refs/heads/tv/6393 72886f0b6 -> 5c71f2ac1 (forced update)
[#6484] this MediawikiImporter pkg has templates in it
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/fa7e4067
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/fa7e4067
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/fa7e4067
Branch: refs/heads/tv/6393
Commit: fa7e4067f3ae1ddb9aef7d747dc6f6aba4af5cd5
Parents: f824160
Author: Dave Brondsema <da...@brondsema.net>
Authored: Tue Jan 14 15:22:41 2014 -0500
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Tue Jan 14 15:22:41 2014 -0500
----------------------------------------------------------------------
requirements-sf.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fa7e4067/requirements-sf.txt
----------------------------------------------------------------------
diff --git a/requirements-sf.txt b/requirements-sf.txt
index 1ce0f99..8dd935a 100644
--- a/requirements-sf.txt
+++ b/requirements-sf.txt
@@ -21,7 +21,7 @@ pyzmq==2.1.7
html2text==3.200.3dev-20121112
PyMollom==0.1
TracWikiImporter==0.3.5
-MediawikiImporter==0.0.1
+MediawikiImporter==0.0.2
Unidecode==0.04.14
# use version built from https://github.com/johnsca/GitPython/commits/tv/6000
[12/22] git commit: [#7065] remove dead code for promoting post to
its own thread
Posted by tv...@apache.org.
[#7065] remove dead code for promoting post to its own thread
We haven't exposed this code to promote a post into its own thread
for a long time. And it called ForumPost.move() which did an unindexed
query by slug, which is the reason to clean it up now.
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/4b4c1476
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/4b4c1476
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/4b4c1476
Branch: refs/heads/tv/6393
Commit: 4b4c1476f65e8632b8604c2e379cca39108361af
Parents: 8facd54
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Jan 16 17:24:42 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Jan 16 18:02:47 2014 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/discuss.py | 9 +---
.../allura/templates/widgets/post_thread.html | 2 +-
.../allura/templates/widgets/post_widget.html | 6 ---
.../allura/templates/widgets/thread_widget.html | 2 +-
.../forgediscussion/controllers/forum.py | 6 ---
ForgeDiscussion/forgediscussion/model/forum.py | 46 --------------------
.../tests/functional/test_forum.py | 14 +-----
.../forgediscussion/widgets/__init__.py | 2 +-
.../forgediscussion/widgets/forum_widgets.py | 18 --------
9 files changed, 6 insertions(+), 99 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4b4c1476/Allura/allura/lib/widgets/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/discuss.py b/Allura/allura/lib/widgets/discuss.py
index 70a1d15..7ca7d81 100644
--- a/Allura/allura/lib/widgets/discuss.py
+++ b/Allura/allura/lib/widgets/discuss.py
@@ -298,7 +298,7 @@ class Post(HierWidget):
page=0,
limit=25,
show_subject=False,
- suppress_promote=False)
+ )
widgets = dict(
moderate_post=ModeratePost(),
edit_post=EditPost(submit_text='Post'),
@@ -373,12 +373,6 @@ class Post(HierWidget):
return false;
});
}
- if($('.promote_to_thread', post)){
- $('.promote_to_thread', post).click(function (ele) {
- $('.promote_to_thread_form', post).show();
- return false;
- });
- }
if($('.shortlink', post)){
var popup = $('.shortlink_popup', post);
$('.shortlink', post).click(function(evt){
@@ -407,7 +401,6 @@ class PostThread(ew_core.Widget):
page=0,
limit=25,
show_subject=False,
- suppress_promote=False,
parent=None,
children=None)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4b4c1476/Allura/allura/templates/widgets/post_thread.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/post_thread.html b/Allura/allura/templates/widgets/post_thread.html
index 3877500..5930122 100644
--- a/Allura/allura/templates/widgets/post_thread.html
+++ b/Allura/allura/templates/widgets/post_thread.html
@@ -20,7 +20,7 @@
<li>
{{widget.parent_widget.widgets.post.display(
value=value, show_subject=show_subject, indent=indent,
- supress_promote=supress_promote, page=page, limit=limit)}}
+ page=page, limit=limit)}}
<!-- post_thread replies -->
<ul>
{%- if children %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4b4c1476/Allura/allura/templates/widgets/post_widget.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/post_widget.html b/Allura/allura/templates/widgets/post_widget.html
index f85fc4b..193161b 100644
--- a/Allura/allura/templates/widgets/post_widget.html
+++ b/Allura/allura/templates/widgets/post_widget.html
@@ -148,12 +148,6 @@
</li>
</ul>
</div>
-
- {% if h.has_access(value.thread, 'moderate')() and 'promote_to_thread' in widgets and not supress_promote %}
- <div class="promote_to_thread_form push-{{3+indent}} span-{{16-indent}} last clear" style="display:none">
- {{widgets.promote_to_thread.display(value=value, action=value.url()+'moderate')}}
- </div>
- {% endif %}
</div>
{% block extra_css %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4b4c1476/Allura/allura/templates/widgets/thread_widget.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/thread_widget.html b/Allura/allura/templates/widgets/thread_widget.html
index 863fd8f..256ad00 100644
--- a/Allura/allura/templates/widgets/thread_widget.html
+++ b/Allura/allura/templates/widgets/thread_widget.html
@@ -31,7 +31,7 @@
<ul>
{{widgets.post_thread.display(value=t['post'], children=t['children'],
indent=0, show_subject=show_subject,
- supress_promote=True, page=page, limit=limit)}}
+ page=page, limit=limit)}}
</ul>
{% endfor %}
{% endif %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4b4c1476/ForgeDiscussion/forgediscussion/controllers/forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/controllers/forum.py b/ForgeDiscussion/forgediscussion/controllers/forum.py
index fd2b816..c83adaf 100644
--- a/ForgeDiscussion/forgediscussion/controllers/forum.py
+++ b/ForgeDiscussion/forgediscussion/controllers/forum.py
@@ -59,7 +59,6 @@ class WidgetConfig(object):
subscription_form = DW.SubscriptionForm()
subscribe_form = SubscribeForm()
edit_post = DW.EditPost(show_subject=True)
- moderate_post = FW.ModeratePost()
moderate_thread = FW.ModerateThread()
flag_post = DW.FlagPost()
post_filter = DW.PostFilter()
@@ -183,13 +182,8 @@ class ForumPostController(PostController):
require_access(self.post.thread, 'moderate')
if self.thread.discussion.deleted and not has_access(c.app, 'configure')():
redirect(self.thread.discussion.url() + 'deleted')
- args = self.W.moderate_post.validate(kw, None)
tasks.calc_thread_stats.post(self.post.thread._id)
tasks.calc_forum_stats(self.post.discussion.shortname)
- if args.pop('promote', None):
- new_thread = self.post.promote()
- tasks.calc_thread_stats.post(new_thread._id)
- redirect(request.referer)
super(ForumPostController, self).moderate(**kw)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4b4c1476/ForgeDiscussion/forgediscussion/model/forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/model/forum.py b/ForgeDiscussion/forgediscussion/model/forum.py
index 1d74375..5545cf0 100644
--- a/ForgeDiscussion/forgediscussion/model/forum.py
+++ b/ForgeDiscussion/forgediscussion/model/forum.py
@@ -239,52 +239,6 @@ class ForumPost(M.Post):
def primary(self):
return self
- def promote(self):
- '''Make the post its own thread head'''
- thd = self.thread_class()(
- discussion_id=self.discussion_id,
- subject=self.subject,
- first_post_id=self._id)
- self.move(thd, None)
- return thd
-
- def move(self, thread, new_parent_id):
- # Add a placeholder to note the move
- placeholder = self.thread.post(
- subject='Discussion moved',
- text='',
- parent_id=self.parent_id)
- placeholder.slug = self.slug
- placeholder.full_slug = self.full_slug
- placeholder.approve()
- if new_parent_id:
- parent = self.post_class().query.get(_id=new_parent_id)
- else:
- parent = None
- # Set the thread ID on my replies and attachments
- old_slug = self.slug + '/', self.full_slug + '/'
- reply_re = re.compile(self.slug + '/.*')
- self.slug, self.full_slug = self.make_slugs(
- parent=parent, timestamp=self.timestamp)
- placeholder.text = 'Discussion moved to [here](%s#post-%s)' % (
- thread.url(), self.slug)
- new_slug = self.slug + '/', self.full_slug + '/'
- self.discussion_id = thread.discussion_id
- self.thread_id = thread._id
- self.parent_id = new_parent_id
- self.text = 'Discussion moved from [here](%s#post-%s)\n\n%s' % (
- placeholder.thread.url(), placeholder.slug, self.text)
- reply_tree = self.query.find(dict(slug=reply_re)).all()
- for post in reply_tree:
- post.slug = new_slug[0] + post.slug[len(old_slug[0]):]
- post.full_slug = new_slug[1] + post.slug[len(old_slug[1]):]
- post.discussion_id = self.discussion_id
- post.thread_id = self.thread_id
- for post in [self] + reply_tree:
- for att in post.attachments:
- att.discussion_id = self.discussion_id
- att.thread_id = self.thread_id
-
class ForumAttachment(M.DiscussionAttachment):
DiscussionClass = Forum
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4b4c1476/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 e23f38a..a42a025 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
@@ -246,18 +246,10 @@ class TestForumAsync(TestController):
if 'attachment' in link.get('href', ''):
self.app.get(str(link['href']))
self.app.post(str(link['href']), params=dict(delete='on'))
- # Moderate
- r = self.app.post(url + 'moderate',
- params=dict(subject='New Thread', delete='', promote='on'))
- # Find new location
- r = self.app.get(url)
- link = [a for a in r.html.findAll('a')
- if a.renderContents() == 'here']
- url, slug = str(link[0]['href']).split('#')
- slug = slug.split('-')[-1]
- reply_slug = slug + str(reply.slug[4:])
+ reply_slug = str(reply.slug)
r = self.app.post(url + reply_slug + '/moderate',
params=dict(subject='', delete='on'))
+ slug = reply_slug[:4]
r = self.app.post(url + slug + '/moderate',
params=dict(subject='', delete='on'))
@@ -532,8 +524,6 @@ class TestForum(TestController):
assert thread.html.findAll(
'div', {'class': 'display_post'})[1].find('p').string == 'bbb'
assert thread.response.body.count(
- '<div class="promote_to_thread_form') == 1
- assert thread.response.body.count(
'<div class="row reply_post_form') == 2
assert thread.response.body.count('<div class="edit_post_form') == 2
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4b4c1476/ForgeDiscussion/forgediscussion/widgets/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/widgets/__init__.py b/ForgeDiscussion/forgediscussion/widgets/__init__.py
index e1f6dd5..f733ddb 100644
--- a/ForgeDiscussion/forgediscussion/widgets/__init__.py
+++ b/ForgeDiscussion/forgediscussion/widgets/__init__.py
@@ -16,5 +16,5 @@
# under the License.
from forum_widgets import ForumSubscriptionForm, ThreadSubscriptionForm, AnnouncementsTable
-from forum_widgets import ModerateThread, ModeratePost, PromoteToThread, ForumHeader, ThreadHeader
+from forum_widgets import ModerateThread, ForumHeader, ThreadHeader
from forum_widgets import Post, Thread, Forum
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4b4c1476/ForgeDiscussion/forgediscussion/widgets/forum_widgets.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/widgets/forum_widgets.py b/ForgeDiscussion/forgediscussion/widgets/forum_widgets.py
index 7e9debb..f11d240 100644
--- a/ForgeDiscussion/forgediscussion/widgets/forum_widgets.py
+++ b/ForgeDiscussion/forgediscussion/widgets/forum_widgets.py
@@ -127,21 +127,6 @@ class ModerateThread(CsrfForm):
delete = ew.SubmitButton(label='Delete Thread')
-class ModeratePost(CsrfForm):
- submit_text = None
- fields = [
- ew.FieldSet(legend='Promote post to its own thread', fields=[
- ew.TextField(name='subject', label='Thread title'),
- ew.SubmitButton(name='promote', label='Promote to thread')])]
-
-
-class PromoteToThread(CsrfForm):
- submit_text = None
- fields = [
- ew.TextField(name='subject', label='Thread title'),
- ew.SubmitButton(name='promote', label='Promote to thread')]
-
-
class ForumHeader(DW.DiscussionHeader):
template = 'jinja:forgediscussion:templates/discussion_widgets/forum_header.html'
widgets = dict(DW.DiscussionHeader.widgets,
@@ -161,9 +146,6 @@ class ThreadHeader(DW.ThreadHeader):
class Post(DW.Post):
show_subject = False
- widgets = dict(DW.Post.widgets,
- promote_to_thread=PromoteToThread())
-
class Thread(DW.Thread):
defaults = dict(
[21/22] git commit: [#6393] Load macros from external packages
Posted by tv...@apache.org.
[#6393] Load macros from external packages
* Moved download_button macro out of allura
* Fixed/cleaned up tests that rely on pylons globals
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/aa457bdd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/aa457bdd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/aa457bdd
Branch: refs/heads/tv/6393
Commit: aa457bdd5378e1967a583704db2c1e3f85347d23
Parents: ffbb420
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Jan 14 18:06:46 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Jan 21 21:52:59 2014 +0000
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 1 +
Allura/allura/lib/macro.py | 20 ------------
Allura/allura/lib/widgets/macros.py | 11 -------
.../templates/widgets/download_button.html | 19 ------------
Allura/allura/tests/model/test_openid.py | 9 ++----
Allura/allura/tests/test_app.py | 7 ++---
Allura/allura/tests/test_globals.py | 32 +++++++++-----------
Allura/allura/tests/test_utils.py | 1 -
AlluraTest/alluratest/controller.py | 5 +--
9 files changed, 24 insertions(+), 81 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa457bdd/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 8bc929e..9917dd4 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -254,6 +254,7 @@ class Globals(object):
stats=_cache_eps('allura.stats'),
site_stats=_cache_eps('allura.site_stats'),
admin=_cache_eps('allura.admin'),
+ macros=_cache_eps('allura.macros'),
)
# Zarkov logger
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa457bdd/Allura/allura/lib/macro.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/macro.py b/Allura/allura/lib/macro.py
index d22b431..957fcb8 100644
--- a/Allura/allura/lib/macro.py
+++ b/Allura/allura/lib/macro.py
@@ -318,26 +318,6 @@ def gittip_button(username):
response = button.display(username=username)
return response
-# FIXME: this is SourceForge specific - need to provide a way for macros
-# to come from other packages
-
-
-@macro()
-def download_button():
- from allura.lib.widgets.macros import DownloadButton
- button = DownloadButton(project=c.project)
- try:
- res_mgr = g.resource_manager
- except TypeError:
- # e.g. "TypeError: No object (name: widget_context) has been registered for this thread"
- # this is an ugly way to check to see if we're outside of a web request
- # and avoid errors
- return '[[download_button]]'
- else:
- res_mgr.register(button)
- response = button.display(project=c.project)
- return response
-
@macro()
def include(ref=None, **kw):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa457bdd/Allura/allura/lib/widgets/macros.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/macros.py b/Allura/allura/lib/widgets/macros.py
index 18268cb..77c329a 100644
--- a/Allura/allura/lib/widgets/macros.py
+++ b/Allura/allura/lib/widgets/macros.py
@@ -33,17 +33,6 @@ class GittipButton(ew.Widget):
project = None
-class DownloadButton(ew.Widget):
- template = 'jinja:allura:templates/widgets/download_button.html'
- params = ['project']
- project = None
-
- def resources(self):
- yield ew.jinja2_ew.JSScript('''
- $(function(){$(".download-button-%s").load("%s");
- });''' % (self.project._id, self.project.best_download_url()))
-
-
class NeighborhoodFeeds(ew.Widget):
template = 'jinja:allura:templates/macro/neighborhood_feeds.html'
params = ['feeds']
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa457bdd/Allura/allura/templates/widgets/download_button.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/download_button.html b/Allura/allura/templates/widgets/download_button.html
deleted file mode 100644
index 44e3b36..0000000
--- a/Allura/allura/templates/widgets/download_button.html
+++ /dev/null
@@ -1,19 +0,0 @@
-{#-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--#}
-<p><span class="download-button-{{project._id}}" style="margin-bottom: 1em; display: block;"></span></p>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa457bdd/Allura/allura/tests/model/test_openid.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_openid.py b/Allura/allura/tests/model/test_openid.py
index 056f030..30dcdb4 100644
--- a/Allura/allura/tests/model/test_openid.py
+++ b/Allura/allura/tests/model/test_openid.py
@@ -23,22 +23,17 @@ Model tests for openid_model
import time
import mock
-from pylons import tmpl_context as c, app_globals as g
-from pylons import request
-from webob import Request
from openid.association import Association
from ming.orm.ormsession import ThreadLocalORMSession
-from allura.lib.app_globals import Globals
+from alluratest.controller import setup_unit_test
from allura import model as M
from allura.lib import helpers as h
def setUp():
- g._push_object(Globals())
- c._push_object(mock.Mock())
- request._push_object(Request.blank('/'))
+ setup_unit_test()
ThreadLocalORMSession.close_all()
M.EmailAddress.query.remove({})
M.OpenIdNonce.query.remove({})
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa457bdd/Allura/allura/tests/test_app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_app.py b/Allura/allura/tests/test_app.py
index f5f5ac4..a31f112 100644
--- a/Allura/allura/tests/test_app.py
+++ b/Allura/allura/tests/test_app.py
@@ -15,17 +15,16 @@
# specific language governing permissions and limitations
# under the License.
-from pylons import tmpl_context as c, app_globals as g
+from pylons import tmpl_context as c
import mock
from ming.base import Object
+from alluratest.controller import setup_unit_test
from allura import app
-from allura.lib.app_globals import Globals
def setUp():
- g._push_object(Globals())
- c._push_object(mock.Mock())
+ setup_unit_test()
c.user._id = None
c.project = mock.Mock()
c.project.name = 'Test Project'
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa457bdd/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index ea7313d..f3adc87 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -26,12 +26,15 @@ import hashlib
from mock import patch
from bson import ObjectId
-
from nose.tools import with_setup, assert_equal, assert_in
from pylons import tmpl_context as c, app_globals as g
from ming.orm import ThreadLocalORMSession
-from alluratest.controller import setup_basic_test, setup_global_objects
+from alluratest.controller import (
+ setup_basic_test,
+ setup_global_objects,
+ setup_unit_test,
+ )
from allura import model as M
from allura.lib import helpers as h
@@ -45,9 +48,14 @@ from forgeblog import model as BM
def setUp():
"""Method called by nose once before running the package. Some functions need it run again to reset data"""
setup_basic_test()
+ setup_unit_test()
setup_with_tools()
+def tearDown():
+ setUp()
+
+
@td.with_wiki
def setup_with_tools():
setup_global_objects()
@@ -65,7 +73,7 @@ def test_app_globals():
assert g.url('/foo') == 'http://localhost/foo', g.url('/foo')
-@with_setup(teardown=setUp) # reset everything we changed
+@with_setup(setUp)
def test_macro_projects():
file_name = 'neo-icon-set-454545-256x350.png'
file_path = os.path.join(
@@ -152,16 +160,6 @@ def test_macro_projects():
assert '<img alt="Test Project Logo"' not in r
-def test_macro_download_button():
- p_nbhd = M.Neighborhood.query.get(name='Projects')
- p_test = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
- with h.push_config(c, project=p_test):
- r = g.markdown_wiki.convert('[[download_button]]')
- assert_equal(
- r, '<div class="markdown_content"><p><span class="download-button-%s" style="margin-bottom: 1em; display: block;"></span></p>\n</div>' %
- p_test._id)
-
-
def test_macro_gittip_button():
p_nbhd = M.Neighborhood.query.get(name='Projects')
p_test = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
@@ -203,7 +201,7 @@ def test_macro_neighborhood_feeds():
assert 'test content' in r
-@with_setup(setUp, setUp) # start clean and reset everything we change
+@with_setup(setUp)
def test_macro_members():
p_nbhd = M.Neighborhood.query.get(name='Projects')
p_test = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
@@ -219,7 +217,7 @@ def test_macro_members():
'</div>')
-@with_setup(teardown=setUp) # reset everything we changed
+@with_setup(setUp)
def test_macro_members_escaping():
user = M.User.by_username('test-admin')
user.display_name = u'Test Admin <script>'
@@ -230,7 +228,7 @@ def test_macro_members_escaping():
u'</ul>\n</div>')
-@with_setup(teardown=setUp) # reset everything we changed
+@with_setup(setUp)
def test_macro_project_admins():
user = M.User.by_username('test-admin')
user.display_name = u'Test Ã…dmin <script>'
@@ -240,7 +238,7 @@ def test_macro_project_admins():
r, u'<div class="markdown_content"><h6>Project Admins:</h6>\n<ul class="md-users-list">\n<li><a href="/u/test-admin/">Test \xc5dmin <script></a></li>\n</ul>\n</div>')
-@with_setup(teardown=setUp) # reset everything we changed
+@with_setup(setUp)
def test_macro_project_admins_one_br():
p_nbhd = M.Neighborhood.query.get(name='Projects')
p_test = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa457bdd/Allura/allura/tests/test_utils.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_utils.py b/Allura/allura/tests/test_utils.py
index 232763a..92f1e28 100644
--- a/Allura/allura/tests/test_utils.py
+++ b/Allura/allura/tests/test_utils.py
@@ -96,7 +96,6 @@ class TestAntispam(unittest.TestCase):
def setUp(self):
setup_unit_test()
- pylons.request._push_object(Request.blank('/'))
pylons.request.remote_addr = '127.0.0.1'
self.a = utils.AntiSpam()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aa457bdd/AlluraTest/alluratest/controller.py
----------------------------------------------------------------------
diff --git a/AlluraTest/alluratest/controller.py b/AlluraTest/alluratest/controller.py
index 8386d0b..dcd7c53 100644
--- a/AlluraTest/alluratest/controller.py
+++ b/AlluraTest/alluratest/controller.py
@@ -26,9 +26,9 @@ from paste.deploy import loadapp
from paste.deploy.converters import asbool
from paste.script.appinstall import SetupCommand
from pylons import tmpl_context as c, app_globals as g
-from pylons import url, response, session
+from pylons import url, request, response, session
import tg
-from webob import Response
+from webob import Response, Request
import ew
from ming.orm import ThreadLocalORMSession
import ming.orm
@@ -101,6 +101,7 @@ def setup_unit_test():
REGISTRY.register(g, Globals())
REGISTRY.register(c, mock.Mock())
REGISTRY.register(url, lambda: None)
+ REGISTRY.register(request, Request.blank('/'))
REGISTRY.register(response, Response())
REGISTRY.register(session, beaker.session.SessionObject({}))
REGISTRY.register(allura.credentials, allura.lib.security.Credentials())
[03/22] git commit: [#6947] Skip activity creation for meta comments
Posted by tv...@apache.org.
[#6947] Skip activity creation for meta comments
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/fedb1ec0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/fedb1ec0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/fedb1ec0
Branch: refs/heads/tv/6393
Commit: fedb1ec03a275f4c59f6690470262c0f530bc03b
Parents: cbf7ee0
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Jan 14 14:49:42 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Jan 14 22:34:06 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/discuss.py | 9 ++++++---
.../forgetracker/tests/functional/test_root.py | 15 +++++++++++----
ForgeTracker/forgetracker/tracker_main.py | 2 +-
3 files changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fedb1ec0/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 884f736..9d27470 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -255,7 +255,7 @@ class Thread(Artifact, ActivityObject):
return g.spam_checker.check(post.text, artifact=post, user=c.user)
def post(self, text, message_id=None, parent_id=None,
- timestamp=None, ignore_security=False, **kw):
+ timestamp=None, ignore_security=False, is_meta=False, **kw):
if not ignore_security:
require_access(self, 'post')
if self.ref_id and self.artifact:
@@ -271,7 +271,8 @@ class Thread(Artifact, ActivityObject):
thread_id=self._id,
parent_id=parent_id,
text=text,
- status='pending')
+ status='pending',
+ is_meta=is_meta)
if timestamp is not None:
kwargs['timestamp'] = timestamp
if message_id is not None:
@@ -462,6 +463,8 @@ class Post(Message, VersionedArtifact, ActivityObject):
edit_count = FieldProperty(int, if_missing=0)
spam_check_id = FieldProperty(str, if_missing='')
text_cache = FieldProperty(MarkdownCache)
+ # meta comment - system generated, describes changes to an artifact
+ is_meta = FieldProperty(bool, if_missing=False)
thread = RelationProperty(Thread)
discussion = RelationProperty(Discussion)
@@ -673,7 +676,7 @@ class Post(Message, VersionedArtifact, ActivityObject):
self.thread.update_stats()
if hasattr(artifact, 'update_stats'):
artifact.update_stats()
- if self.text:
+ if self.text and not self.is_meta:
g.director.create_activity(author, 'posted', self, target=artifact,
related_nodes=[self.app_config.project])
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fedb1ec0/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 8860b3b..d6ec7e0 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -281,10 +281,7 @@ class TestFunctionalController(TrackerTestController):
'summary': 'my ticket',
'description': 'new description',
})
- # create_activity is called twice here:
- # - once for the ticket modification
- # - once for the auto-comment that's created for the ticket diff
- assert create_activity.call_count == 2
+ assert create_activity.call_count == 1
assert create_activity.call_args[0][1] == 'modified'
def test_new_ticket(self):
@@ -672,6 +669,16 @@ class TestFunctionalController(TrackerTestController):
assert '<span class="gd">-2</span>' in r, r.showbrowser()
assert '<span class="gi">+4</span>' in r, r.showbrowser()
+ def test_meta_comment(self):
+ self.new_ticket(summary="foo")
+ self.app.post('/bugs/1/update_ticket', {
+ 'summary': 'bar',
+ 'comment': 'user comment',
+ })
+ t = tm.Ticket.query.get(ticket_num=1)
+ assert_true(t.discussion_thread.first_post.is_meta)
+ assert_false(t.discussion_thread.last_post.is_meta)
+
def test_ticket_label_unlabel(self):
summary = 'test labeling and unlabeling a ticket'
self.new_ticket(summary=summary)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fedb1ec0/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index cb8db76..0ae0cad 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -1430,7 +1430,7 @@ class TicketController(BaseController, FeedController):
change_text = h.render_genshi_plaintext(
tpl_fn,
changelist=changes.get_changed())
- post = thread.add_post(text=change_text)
+ thread.add_post(text=change_text, is_meta=True)
self.ticket.commit()
if comment:
self.ticket.discussion_thread.post(text=comment)
[13/22] git commit: [#7065] remove unindexed query to find slug in a
different thread
Posted by tv...@apache.org.
[#7065] remove unindexed query to find slug in a different thread
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/8facd54e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8facd54e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8facd54e
Branch: refs/heads/tv/6393
Commit: 8facd54e7f78ca1469979154bb19d3e3adf1b1e3
Parents: 6479701
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Jan 16 16:48:41 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Jan 16 18:02:47 2014 +0000
----------------------------------------------------------------------
Allura/allura/controllers/discuss.py | 3 ---
1 file changed, 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8facd54e/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index 88ec552..aefd472 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -278,9 +278,6 @@ class PostController(BaseController):
slug=self._post_slug, thread_id=self.thread._id)
if post:
return post
- post = self.M.Post.query.get(slug=self._post_slug)
- if post:
- return post
else:
redirect('..')
[17/22] git commit: [#7006] ticket:511 Added Modernizr to suppress
canvas error message
Posted by tv...@apache.org.
[#7006] ticket:511 Added Modernizr to suppress canvas error message
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/2b25b864
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/2b25b864
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/2b25b864
Branch: refs/heads/tv/6393
Commit: 2b25b864f08899250d8b8e58811006d406086461
Parents: f6b77b8
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Thu Jan 16 17:37:55 2014 +0200
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Mon Jan 20 17:11:16 2014 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/resources/js/commit_browser.js | 10 ++++++++++
Allura/allura/public/nf/js/modernizr.js | 4 ++++
Allura/allura/templates/jinja_master/master.html | 1 +
3 files changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2b25b864/Allura/allura/lib/widgets/resources/js/commit_browser.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/commit_browser.js b/Allura/allura/lib/widgets/resources/js/commit_browser.js
index 37c4408..0ba78b7 100644
--- a/Allura/allura/lib/widgets/resources/js/commit_browser.js
+++ b/Allura/allura/lib/widgets/resources/js/commit_browser.js
@@ -88,6 +88,16 @@ if($('#commit_graph')){
highlighter.height = canvas.height;
highlighter_ctx.fillStyle = "#ccc";
+ // Hide error message
+ Modernizr.load([
+ {
+ test: Modernizr.canvas,
+ yep: function() {
+ $('#commit_browser_canvas_message').hide();
+ }
+ }
+ ]);
+
function setHeight(cnt) {
/*
* Set proper canvas height for cnt commits.
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2b25b864/Allura/allura/public/nf/js/modernizr.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/modernizr.js b/Allura/allura/public/nf/js/modernizr.js
new file mode 100644
index 0000000..f4a54e2
--- /dev/null
+++ b/Allura/allura/public/nf/js/modernizr.js
@@ -0,0 +1,4 @@
+/* Modernizr 2.7.1 (Custom Build) | MIT & BSD
+ * Build: http://modernizr.com/download/#-canvas-canvastext-cssclasses-load
+ */
+;window.Modernizr=function(a,b,c){function u(a){j.cssText=a}function v(a,b){return u(prefixes.join(a+";")+(b||""))}function w(a,b){return typeof a===b}function x(a,b){return!!~(""+a).indexOf(b)}function y(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:w(f,"function")?f.bind(d||b):f}return!1}var d="2.7.1",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m={},n={},o={},p=[],q=p.slice,r,s={}.hasOwnProperty,t;!w(s,"undefined")&&!w(s.call,"undefined")?t=function(a,b){return s.call(a,b)}:t=function(a,b){return b in a&&w(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=q.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(q.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(q.call(arguments)))};return e}),m.canvas=function()
{var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},m.canvastext=function(){return!!e.canvas&&!!w(b.createElement("canvas").getContext("2d").fillText,"function")};for(var z in m)t(m,z)&&(r=z.toLowerCase(),e[r]=m[z](),p.push((e[r]?"":"no-")+r));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)t(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},u(""),i=k=null,e._version=d,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+p.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){funct
ion k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isAr
ray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&
&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadyst
atechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2b25b864/Allura/allura/templates/jinja_master/master.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/master.html b/Allura/allura/templates/jinja_master/master.html
index 723e56e..dd9c313 100644
--- a/Allura/allura/templates/jinja_master/master.html
+++ b/Allura/allura/templates/jinja_master/master.html
@@ -24,6 +24,7 @@
{% endif %}
{% do g.register_forge_js('js/jquery-base.js') %}
{% do g.register_forge_js('js/jquery.notify.js') %}
+{% do g.register_forge_js('js/modernizr.js') %}
{% do g.register_forge_js('js/sylvester.js') %}
{% do g.register_forge_js('js/pb.transformie.min.js') %}
{% do g.register_forge_js('js/allura-base.js') %}
[10/22] git commit: [#6963] Disable import activities;
create post-import activity
Posted by tv...@apache.org.
[#6963] Disable import activities; create post-import activity
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ae5437a4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ae5437a4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ae5437a4
Branch: refs/heads/tv/6393
Commit: ae5437a4a6413a473c1abdfaa5ac6bf32455cc5b
Parents: 45d4fc0
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Jan 14 01:48:49 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Jan 16 17:50:38 2014 +0000
----------------------------------------------------------------------
Allura/allura/lib/helpers.py | 4 ++--
Allura/allura/model/project.py | 6 +++++-
Allura/allura/model/timeline.py | 5 +++++
ForgeImporters/forgeimporters/base.py | 3 +++
ForgeImporters/forgeimporters/tests/test_base.py | 3 +++
5 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ae5437a4/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index ca1d386..4f84813 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -972,13 +972,13 @@ def split_select_field_options(field_options):
@contextmanager
-def notifications_disabled(project):
+def notifications_disabled(project, disabled=True):
"""Temporarily disable email notifications on a project.
"""
orig = project.notifications_disabled
try:
- project.notifications_disabled = True
+ project.notifications_disabled = disabled
yield
finally:
project.notifications_disabled = orig
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ae5437a4/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 6d40cd8..9b2024c 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -961,7 +961,7 @@ class Project(MappedClass, ActivityNode, ActivityObject):
)
-class AppConfig(MappedClass):
+class AppConfig(MappedClass, ActivityObject):
"""
Configuration information for an instantiated :class:`Application <allura.app.Application>`
@@ -992,6 +992,10 @@ class AppConfig(MappedClass):
acl = FieldProperty(ACL())
+ @property
+ def activity_name(self):
+ return self.options.mount_label
+
def get_tool_data(self, tool, key, default=None):
return self.tool_data.get(tool, {}).get(key, default)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ae5437a4/Allura/allura/model/timeline.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/timeline.py b/Allura/allura/model/timeline.py
index 7b350aa..be538a2 100644
--- a/Allura/allura/model/timeline.py
+++ b/Allura/allura/model/timeline.py
@@ -17,7 +17,9 @@
import bson
import logging
+
from ming.odm import Mapper
+from pylons import tmpl_context as c
from activitystream import ActivityDirector
from activitystream.base import NodeBase, ActivityObjectBase
@@ -38,6 +40,9 @@ class Director(ActivityDirector):
def create_activity(self, actor, verb, obj, target=None,
related_nodes=None):
+ if c.project and c.project.notifications_disabled:
+ return
+
from allura.model.project import Project
super(Director, self).create_activity(actor, verb, obj,
target=target, related_nodes=related_nodes)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ae5437a4/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index 9be397b..9698082 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -127,6 +127,9 @@ def import_tool(importer_path, project_name=None, mount_point=None, mount_label=
M.artifact_orm_session.flush()
M.session.BatchIndexer.flush()
if app:
+ with h.notifications_disabled(c.project, disabled=False):
+ g.director.create_activity(c.user, "imported", app.config,
+ related_nodes=[c.project])
handler.success(app)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ae5437a4/ForgeImporters/forgeimporters/tests/test_base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/test_base.py b/ForgeImporters/forgeimporters/tests/test_base.py
index 2156471..f7a810c 100644
--- a/ForgeImporters/forgeimporters/tests/test_base.py
+++ b/ForgeImporters/forgeimporters/tests/test_base.py
@@ -57,9 +57,12 @@ def test_import_tool(g, c, object_from_path):
base.import_tool(
'forgeimporters.base.ToolImporter', project_name='project_name',
mount_point='mount_point', mount_label='mount_label')
+ app = importer.return_value.import_tool.return_value
importer.return_value.import_tool.assert_called_once_with(c.project,
c.user, project_name='project_name', mount_point='mount_point',
mount_label='mount_label')
+ g.director.create_activity.assert_called_once_with(c.user, "imported",
+ app.config, related_nodes=[c.project])
g.post_event.assert_called_once_with(
'import_tool_task_succeeded',
'source',
[07/22] git commit: [#7046] Using different published date format.
Fixes FF/Mozilla
Posted by tv...@apache.org.
[#7046] Using different published date format. Fixes FF/Mozilla
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/2d459762
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/2d459762
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/2d459762
Branch: refs/heads/tv/6393
Commit: 2d459762463ed2eddcc999a9da2e387151d3712b
Parents: 05f5804
Author: Wayne Witzel III <ww...@slashdotmedia.com>
Authored: Wed Jan 15 22:02:25 2014 +0000
Committer: Wayne Witzel III <ww...@slashdotmedia.com>
Committed: Wed Jan 15 23:31:58 2014 +0000
----------------------------------------------------------------------
ForgeActivity/forgeactivity/main.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2d459762/ForgeActivity/forgeactivity/main.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index a1bb21d..6bf1199 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -16,6 +16,7 @@
# under the License.
import logging
+import calendar
from pylons import tmpl_context as c, app_globals as g
from pylons import request, response
@@ -191,7 +192,7 @@ class ForgeActivityRestController(BaseController):
'activity_extras': {},
},
'timeline': [{
- 'published': '%s UTC' % a.published,
+ 'published': calendar.timegm(a.published.timetuple()) * 1000,
'actor': a.actor._deinstrument(),
'verb': a.verb,
'obj': a.obj._deinstrument(),
[02/22] git commit: [#4812] ticket:517 Remove "Create Ticket:" label
from edit mode
Posted by tv...@apache.org.
[#4812] ticket:517 Remove "Create Ticket:" label from edit mode
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/cbf7ee07
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/cbf7ee07
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/cbf7ee07
Branch: refs/heads/tv/6393
Commit: cbf7ee07ca92754cc3b144bd7a75b91c43672b1c
Parents: fa7e406
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Tue Jan 14 14:29:04 2014 +0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Jan 14 22:09:09 2014 +0000
----------------------------------------------------------------------
ForgeTracker/forgetracker/templates/tracker/ticket.html | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cbf7ee07/ForgeTracker/forgetracker/templates/tracker/ticket.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/ticket.html b/ForgeTracker/forgetracker/templates/tracker/ticket.html
index 4592f72..2e374c7 100644
--- a/ForgeTracker/forgetracker/templates/tracker/ticket.html
+++ b/ForgeTracker/forgetracker/templates/tracker/ticket.html
@@ -200,6 +200,7 @@
title_actions.appendTo(document.body);
title_holder.text('\u00A0');
vote.hide();
+ $('div.new-ticket-title label').hide();
$('a.edit_ticket').addClass('btn_activate');
$('textarea[name="ticket_form.description"]').trigger('editticket.forgetracker').focus();
$('textarea[name="ticket_form.comment"]').val(not_posted_comment);
[15/22] git commit: [#7006] Added modernizr to LICENSE
Posted by tv...@apache.org.
[#7006] Added modernizr to LICENSE
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/9b199817
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/9b199817
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/9b199817
Branch: refs/heads/tv/6393
Commit: 9b19981770c5f25380f91e0ca4bd7a37b252dc2e
Parents: 2b25b86
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Mon Jan 20 17:04:03 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Mon Jan 20 17:11:16 2014 +0000
----------------------------------------------------------------------
Allura/LICENSE | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9b199817/Allura/LICENSE
----------------------------------------------------------------------
diff --git a/Allura/LICENSE b/Allura/LICENSE
index 13b7b54..7e0be3d 100644
--- a/Allura/LICENSE
+++ b/Allura/LICENSE
@@ -241,3 +241,6 @@ For details, see allura/public/nf/js/spin.min.js
Sylvester, which is available under the MIT license.
For details, see allura/public/nf/js/sylvester.js
+
+Modernizr, which is available under the MIT license.
+For details, see allura/public/nf/js/modernizr.js
[09/22] git commit: [#7059] Removed unnecessary status check on
tarball download page
Posted by tv...@apache.org.
[#7059] Removed unnecessary status check on tarball download page
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/45d4fc0b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/45d4fc0b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/45d4fc0b
Branch: refs/heads/tv/6393
Commit: 45d4fc0b346fb996121f9ed2d767358871bf81d7
Parents: 39fc30c
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Jan 16 17:05:45 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Jan 16 17:05:45 2014 +0000
----------------------------------------------------------------------
Allura/allura/templates/repo/tarball.html | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/45d4fc0b/Allura/allura/templates/repo/tarball.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/tarball.html b/Allura/allura/templates/repo/tarball.html
index 2338be1..04dd5d2 100644
--- a/Allura/allura/templates/repo/tarball.html
+++ b/Allura/allura/templates/repo/tarball.html
@@ -35,7 +35,7 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
window.location.href = '{{c.app.repo.tarball_url(revision, path)}}';
});
{% endif %}
- {% else %}
+ {% elif status in ('ready', 'busy') %}
var opts = {
lines: 9, // The number of lines to draw
length: 4, // The length of each line
@@ -54,7 +54,6 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
};
var spinner = new Spinner(opts).spin($('#snapshot_status')[0]);
var delay = 500;
- $('#snapshot_status h2.checking').show();
function check_status() {
$.get('{{commit.url()}}tarball_status?path={{path}}', function(data) {
if (data.status === 'complete') {
@@ -91,10 +90,9 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
{% block content %}
{% set path = request.params.get('path', '') %}
<div id='snapshot_status'>
- <h2 class="checking">Checking snapshot status...</h2>
- <h2 class="busy">Generating snapshot...</h2>
+ <h2 class="busy ready">Generating snapshot...</h2>
<h2 class="complete">Your download will begin shortly, or use this <a href="{{c.app.repo.tarball_url(revision, path)}}">direct link</a>.</h2>
- <form action="tarball" method="post">
+ <form action="tarball" method="post" class="None">
<p>We're having trouble finding that snapshot. Would you like to resubmit?</p>
<input type="hidden" name="path" value="{{path}}" />
<input type="submit" value="Resubmit Snapshot Request" />
[20/22] git commit: [#6393] Remove download button from default wik
text
Posted by tv...@apache.org.
[#6393] Remove download button from default wik text
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/b92873ce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b92873ce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b92873ce
Branch: refs/heads/tv/6393
Commit: b92873cefa927abd215c0f4eb1990006d14dbc39
Parents: 6c96721
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Jan 21 21:43:58 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Jan 21 21:52:59 2014 +0000
----------------------------------------------------------------------
ForgeWiki/forgewiki/wiki_main.py | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b92873ce/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 7a90a3b..ce1e2b7 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -146,6 +146,16 @@ class ForgeWikiApp(Application):
if globals is not None:
session(globals).flush(globals)
+ def default_root_page_text(self):
+ return """Welcome to your wiki!
+
+This is the default page, edit it as you see fit. To add a new page simply reference it within brackets, e.g.: [SamplePage].
+
+The wiki uses [Markdown](%s) syntax.
+
+[[members limit=20]]
+""" % (self.url + 'markdown_syntax/')
+
@Property
def show_discussion():
def fget(self):
@@ -272,16 +282,7 @@ class ForgeWikiApp(Application):
with h.push_config(c, app=self):
p = WM.Page.upsert(new_root)
p.viewable_by = ['all']
- url = c.app.url + 'markdown_syntax' + '/'
- p.text = """Welcome to your wiki!
-
-This is the default page, edit it as you see fit. To add a new page simply reference it within brackets, e.g.: [SamplePage].
-
-The wiki uses [Markdown](%s) syntax.
-
-[[members limit=20]]
-[[download_button]]
-""" % url
+ p.text = self.default_root_page_text()
p.commit()
def uninstall(self, project):
[11/22] git commit: [#7047] quieter debugging when no request
Posted by tv...@apache.org.
[#7047] quieter debugging when no request
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/6479701c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6479701c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6479701c
Branch: refs/heads/tv/6393
Commit: 6479701cb81d9dc73d61bcbe54a34de71cd8f31b
Parents: ae5437a
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Jan 16 16:46:50 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Jan 16 18:02:46 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/session.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6479701c/Allura/allura/model/session.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/session.py b/Allura/allura/model/session.py
index ff960a2..f52d164 100644
--- a/Allura/allura/model/session.py
+++ b/Allura/allura/model/session.py
@@ -101,7 +101,7 @@ class ArtifactSessionExtension(SessionExtension):
l.debug('objects_deleted: %s', [o._id for o in self.objects_deleted])
l.debug('add_artifacts task: %s', add_task)
except:
- log.info('error running extra debug', exc_info=True)
+ pass
class BatchIndexer(ArtifactSessionExtension):
[04/22] git commit: [#6938] check that a forked repo's project exists
Posted by tv...@apache.org.
[#6938] check that a forked repo's project exists
>From Igor Bondarenko
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/3d7741fe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/3d7741fe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/3d7741fe
Branch: refs/heads/tv/6393
Commit: 3d7741fe940d162f0caecfe6457583dc57edd644
Parents: fedb1ec
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Jan 15 17:02:25 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Jan 15 17:02:25 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/repository.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3d7741fe/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index a328b3e..b6cfb9a 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -626,7 +626,9 @@ class Repository(Artifact, ActivityObject):
@property
def forks(self):
all_forks = self.query.find({'upstream_repo.name': self.url()}).all()
- return filter(lambda fork: fork.app_config is not None, all_forks)
+ return filter(lambda fork: fork.app_config is not None
+ and fork.app_config.project is not None,
+ all_forks)
def tarball(self, revision, path=None):
if path:
[19/22] git commit: [#6393] Cleanup
Posted by tv...@apache.org.
[#6393] Cleanup
* Removed download button test
* Changed show_download_button macro default to False
* Added docs for extending Allura with macros
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/6c967212
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6c967212
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6c967212
Branch: refs/heads/tv/6393
Commit: 6c967212568aafc49ebe830ea29d6b7e1b7a1044
Parents: aa457bd
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Jan 16 13:11:51 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Jan 21 21:52:59 2014 +0000
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 2 +
Allura/allura/lib/macro.py | 6 +--
Allura/allura/templates/neighborhood_help.html | 2 +-
Allura/allura/tests/test_globals.py | 8 ----
Allura/docs/extending.rst | 41 +++++++++++++++++++++
5 files changed, 47 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6c967212/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 9917dd4..fffe3d0 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -254,6 +254,8 @@ class Globals(object):
stats=_cache_eps('allura.stats'),
site_stats=_cache_eps('allura.site_stats'),
admin=_cache_eps('allura.admin'),
+ # macro eps are used solely for ensuring that external macros are
+ # imported (after load, the ep itself is not used)
macros=_cache_eps('allura.macros'),
)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6c967212/Allura/allura/lib/macro.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/macro.py b/Allura/allura/lib/macro.py
index 957fcb8..efb1433 100644
--- a/Allura/allura/lib/macro.py
+++ b/Allura/allura/lib/macro.py
@@ -164,7 +164,7 @@ def project_blog_posts(max_number=5, sort='timestamp', summary=False, mount_poin
def get_projects_for_macro(
category=None, display_mode='grid', sort='last_updated',
show_total=False, limit=100, labels='', award='', private=False,
- columns=1, show_proj_icon=True, show_download_button=True, show_awards_banner=True,
+ columns=1, show_proj_icon=True, show_download_button=False, show_awards_banner=True,
grid_view_tools='',
initial_q={}):
from allura.lib.widgets.project_list import ProjectList
@@ -267,7 +267,7 @@ def get_projects_for_macro(
@macro('neighborhood-wiki')
def projects(category=None, display_mode='grid', sort='last_updated',
show_total=False, limit=100, labels='', award='', private=False,
- columns=1, show_proj_icon=True, show_download_button=True, show_awards_banner=True,
+ columns=1, show_proj_icon=True, show_download_button=False, show_awards_banner=True,
grid_view_tools=''):
initial_q = dict(neighborhood_id=c.project.neighborhood_id)
return get_projects_for_macro(
@@ -281,7 +281,7 @@ def projects(category=None, display_mode='grid', sort='last_updated',
@macro('userproject-wiki')
def my_projects(category=None, display_mode='grid', sort='last_updated',
show_total=False, limit=100, labels='', award='', private=False,
- columns=1, show_proj_icon=True, show_download_button=True, show_awards_banner=True,
+ columns=1, show_proj_icon=True, show_download_button=False, show_awards_banner=True,
grid_view_tools=''):
myproj_user = c.project.user_project_of
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6c967212/Allura/allura/templates/neighborhood_help.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/neighborhood_help.html b/Allura/allura/templates/neighborhood_help.html
index ed57b53..5c5d27a 100644
--- a/Allura/allura/templates/neighborhood_help.html
+++ b/Allura/allura/templates/neighborhood_help.html
@@ -45,7 +45,7 @@
<li><code>display_mode</code> = grid/list. Default is 'grid'</li>
<li><code>show_proj_icon</code> = yes/no. Default 'yes'</li>
<li><code>grid_view_tools</code> = git,hg,svn,tickets,wiki... Limit the tools shown in project list. Multivalue option (example grid_view_tools=git,wiki). Default ''</li>
- <li><code>show_download_button</code> = yes/no. Default 'yes'</li>
+ <li><code>show_download_button</code> = yes/no. Default 'no'</li>
<li><code>show_awards_banner</code> = yes/no. Default 'yes'</li>
<li><code>sort</code> = last_updated/alpha/random/last_registered. Default 'last_updated'</li>
<li><code>show_total</code> = yes/no. Adds a sentence with a total count of how many projects are listed. Default 'no'</li>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6c967212/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index f3adc87..0eb7723 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -493,14 +493,6 @@ def test_projects_macro():
r = g.markdown_wiki.convert('[[projects display_mode=list columns=3]]')
assert two_column_style not in r
- # test project download button
- r = g.markdown_wiki.convert(
- '[[projects display_mode=list show_download_button=True]]')
- assert 'download-button' in r
- r = g.markdown_wiki.convert(
- '[[projects display_mode=list show_download_button=False]]')
- assert 'download-button' not in r
-
@td.with_wiki
def test_limit_tools_macro():
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6c967212/Allura/docs/extending.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/extending.rst b/Allura/docs/extending.rst
index 7fb46da..c39d572 100644
--- a/Allura/docs/extending.rst
+++ b/Allura/docs/extending.rst
@@ -64,3 +64,44 @@ The events that allura publishes are:
* repo_cloned
* repo_refreshed
* repo_clone_task_failed
+
+
+Markdown Macros
+===============
+
+Most text inputs in Allura accept Markdown text which is parsed and turned into
+HTML before being rendered. The Markdown text may contain "macros" - custom
+commands which extend the Markdown language. Here's an example of a macro
+that comes with Allura::
+
+ [[project_admins]]
+
+Include this macro in a wiki page or other Markdown content, and when rendered
+it will be replaced by an actual list of the project's admin users.
+
+Extending Allura with your own macros is simple, requiring two basic steps:
+
+1. Decide on a name for your macro, then create a function with that name, and
+ decorate it with the `macro()` decorator from Allura. The function can
+ accept keyword arguments, and must return text or HTML. For example::
+
+ from allura.lib.macro import macro
+
+ @macro()
+ def hello(name='World'):
+ return "<p>Hello {}!</p>".format(name)
+
+2. Add an entry point for your macro to the `setup.py` for your package::
+
+ [allura.macros]
+ hello_macro = mypkg.mymodule:hello
+
+Note that the key name (`hello_macro` in this case) doesn't matter - the macro
+is named after the function name. Our example macro could be used in a couple
+ways::
+
+ [[hello]]
+ [[hello name=Universe]]
+
+For more help with macros, consult the source code for the macros that ship
+with Allura. You can find them in the `allura.lib.macro` package.
[14/22] git commit: [#7063] Added last_edited field to discussion REST
Posted by tv...@apache.org.
[#7063] Added last_edited field to discussion REST
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/f6b77b8b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f6b77b8b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f6b77b8b
Branch: refs/heads/tv/6393
Commit: f6b77b8b74475b1665b54c0f3820cd26895e436e
Parents: 4b4c147
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Jan 16 16:29:09 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Jan 16 20:23:29 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/discuss.py | 2 ++
ForgeDiscussion/forgediscussion/tests/functional/test_rest.py | 1 +
2 files changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f6b77b8b/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 4303c66..1fddf91 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -173,6 +173,7 @@ class Thread(Artifact, ActivityObject):
subject=p.subject,
author=p.author().username,
timestamp=p.timestamp,
+ last_edited=p.last_edit_date,
attachments=[dict(bytes=attach.length,
url=h.absurl(attach.url())) for attach in p.attachments])
for p in self.query_posts(status='ok', style='chronological', limit=limit, page=page)
@@ -480,6 +481,7 @@ class Post(Message, VersionedArtifact, ActivityObject):
text=self.text,
flagged_by=map(str, self.flagged_by),
timestamp=self.timestamp,
+ last_edited=self.last_edit_date,
author_id=str(author._id),
author=author.username)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f6b77b8b/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py b/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
index dd02429..1b7d080 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
@@ -142,6 +142,7 @@ class TestRootRestController(TestDiscussionApiBase):
assert_equal(topic['posts'][0]['text'], 'Hi boys and girls')
assert_equal(topic['posts'][0]['subject'], 'Hi guys')
assert_in('timestamp', topic['posts'][0])
+ assert_in('last_edited', topic['posts'][0])
def test_forum_list_pagination(self):
resp = self.app.get('/rest/p/test/discussion/?limit=1')
[16/22] git commit: [#7006] Removed unnecessary message logic
Posted by tv...@apache.org.
[#7006] Removed unnecessary message logic
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/afdf5052
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/afdf5052
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/afdf5052
Branch: refs/heads/tv/6393
Commit: afdf5052374837b43fe78c0db5c14087cbd4ce21
Parents: 9b19981
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Mon Jan 20 17:11:04 2014 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Mon Jan 20 17:11:16 2014 +0000
----------------------------------------------------------------------
Allura/allura/lib/widgets/resources/js/commit_browser.js | 10 ----------
1 file changed, 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/afdf5052/Allura/allura/lib/widgets/resources/js/commit_browser.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/commit_browser.js b/Allura/allura/lib/widgets/resources/js/commit_browser.js
index 0ba78b7..37c4408 100644
--- a/Allura/allura/lib/widgets/resources/js/commit_browser.js
+++ b/Allura/allura/lib/widgets/resources/js/commit_browser.js
@@ -88,16 +88,6 @@ if($('#commit_graph')){
highlighter.height = canvas.height;
highlighter_ctx.fillStyle = "#ccc";
- // Hide error message
- Modernizr.load([
- {
- test: Modernizr.canvas,
- yep: function() {
- $('#commit_browser_canvas_message').hide();
- }
- }
- ]);
-
function setHeight(cnt) {
/*
* Set proper canvas height for cnt commits.
[06/22] git commit: [#7026] Handle detached artifacts more gracefully
Posted by tv...@apache.org.
[#7026] Handle detached artifacts more gracefully
On the off chance that an Artifact or AppConfig gets detached
from its project, we want to handle it a bit more gracefully.
This situtation shouldn't really come up in production, as it
means the data is bad, but it can happen on a sandbox.
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/84309dd7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/84309dd7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/84309dd7
Branch: refs/heads/tv/6393
Commit: 84309dd77d32d07bbfe19d6745c5a4c6a46b71c9
Parents: 3d7741f
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Jan 15 19:36:51 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Jan 15 20:06:55 2014 +0000
----------------------------------------------------------------------
Allura/allura/model/artifact.py | 2 +-
Allura/allura/model/discuss.py | 4 ++++
Allura/allura/model/timeline.py | 2 ++
3 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/84309dd7/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index 8a01c42..56c7643 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -265,7 +265,7 @@ class Artifact(MappedClass):
this Artifact belongs.
"""
- return self.app_config.project
+ return getattr(self.app_config, 'project', None)
@property
def project_id(self):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/84309dd7/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 9d27470..4303c66 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -499,8 +499,12 @@ class Post(Message, VersionedArtifact, ActivityObject):
not have access to a 'comment' activity unless he also has access to
the artifact on which it was posted (if there is one).
"""
+ if self.project is None:
+ return False
artifact_access = True
if self.thread.artifact:
+ if self.thread.artifact.project is None:
+ return False
artifact_access = security.has_access(self.thread.artifact, perm,
user, self.thread.artifact.project)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/84309dd7/Allura/allura/model/timeline.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/timeline.py b/Allura/allura/model/timeline.py
index 3487b9c..7b350aa 100644
--- a/Allura/allura/model/timeline.py
+++ b/Allura/allura/model/timeline.py
@@ -89,6 +89,8 @@ class ActivityObject(ActivityObjectBase):
"""Return True if user has perm access to this object, otherwise
return False.
"""
+ if self.project is None:
+ return False
return security.has_access(self, perm, user, self.project)
[18/22] git commit: [#7047] further debugging to see if BatchIndexer
is in use
Posted by tv...@apache.org.
[#7047] further debugging to see if BatchIndexer is in use
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ffbb4201
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ffbb4201
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ffbb4201
Branch: refs/heads/tv/6393
Commit: ffbb4201aa4922335d0bfa3760199cfa22c07c87
Parents: afdf505
Author: Dave Brondsema <da...@brondsema.net>
Authored: Tue Jan 21 14:30:56 2014 -0500
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Tue Jan 21 14:30:56 2014 -0500
----------------------------------------------------------------------
Allura/allura/model/session.py | 34 +++++++++++++++++++++++++++-------
1 file changed, 27 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ffbb4201/Allura/allura/model/session.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/session.py b/Allura/allura/model/session.py
index f52d164..5354f87 100644
--- a/Allura/allura/model/session.py
+++ b/Allura/allura/model/session.py
@@ -70,6 +70,22 @@ class ArtifactSessionExtension(SessionExtension):
except Exception:
log.exception(
"Failed to update artifact references. Is this a borked project migration?")
+ try:
+ l = logging.getLogger('allura.debug7047')
+ from tg import request
+ task = request.environ.get('task')
+ except:
+ pass
+ else:
+ try:
+ if task and task.task_name == 'forgetracker.tasks.bulk_edit':
+ l.debug('this extension: %s', type(self))
+ l.debug('active session extensions are: %s', artifact_orm_session._kwargs.get('extensions'))
+ l.debug('threadlocal session is for: %s', [s.impl.db for s in artifact_orm_session._session_registry.values()])
+ l.debug('current session is: %s', self.session.impl.db)
+ except Exception:
+ log.info('error running extra debug pt1', exc_info=True)
+
self.update_index(self.objects_deleted, arefs)
for obj in self.objects_added:
g.zarkov_event('create', extra=obj.index_id())
@@ -93,15 +109,19 @@ class ArtifactSessionExtension(SessionExtension):
l = logging.getLogger('allura.debug7047')
from tg import request
task = request.environ.get('task')
- if task and task.task_name == 'forgetracker.tasks.bulk_edit':
- l.debug('session: %s %s', self.session.impl.db, self.session)
- l.debug('arefs: %s', arefs)
- l.debug('objects_added: %s', [o._id for o in self.objects_added])
- l.debug('objects_modified: %s', [o._id for o in self.objects_modified])
- l.debug('objects_deleted: %s', [o._id for o in self.objects_deleted])
- l.debug('add_artifacts task: %s', add_task)
except:
pass
+ else:
+ try:
+ if task and task.task_name == 'forgetracker.tasks.bulk_edit':
+ #l.debug('session: %s %s', self.session.impl.db, self.session)
+ l.debug('arefs: %s', arefs)
+ l.debug('objects_added: %s', [o._id for o in self.objects_added])
+ l.debug('objects_modified: %s', [o._id for o in self.objects_modified])
+ l.debug('objects_deleted: %s', [o._id for o in self.objects_deleted])
+ l.debug('add_artifacts task: %s', add_task)
+ except Exception:
+ log.info('error running extra debug pt2', exc_info=True)
class BatchIndexer(ArtifactSessionExtension):
[05/22] git commit: [#7026] Require POST for follow/unfollow actions
Posted by tv...@apache.org.
[#7026] Require POST for follow/unfollow actions
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/05f5804e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/05f5804e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/05f5804e
Branch: refs/heads/tv/6393
Commit: 05f5804e53d1ed8147282a6bf2a4049e4d614870
Parents: 84309dd
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Jan 15 19:38:54 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Jan 15 20:06:55 2014 +0000
----------------------------------------------------------------------
Allura/allura/templates/jinja_master/lib.html | 8 +++++++-
ForgeActivity/forgeactivity/main.py | 2 ++
ForgeActivity/forgeactivity/templates/widgets/follow.html | 3 ++-
ForgeActivity/forgeactivity/tests/functional/test_root.py | 4 ++--
.../forgeactivity/widgets/resources/js/follow.js | 10 ++++++----
5 files changed, 19 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/05f5804e/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 4162368..f83e23c 100644
--- a/Allura/allura/templates/jinja_master/lib.html
+++ b/Allura/allura/templates/jinja_master/lib.html
@@ -17,9 +17,15 @@
under the License.
-#}
+{% macro csrf() -%}
+ {% if request -%}
+ {{request.cookies['_session_id']}}
+ {%- endif %}
+{%- endmacro %}
+
{% macro csrf_token() -%}
{% if request %}
- <input name="_session_id" type="hidden" value="{{request.cookies['_session_id']}}">
+ <input name="_session_id" type="hidden" value="{{csrf()}}">
{% endif %}
{%- endmacro %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/05f5804e/ForgeActivity/forgeactivity/main.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index 9188b66..a1bb21d 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -31,6 +31,7 @@ from allura.controllers import BaseController
from allura.lib.security import require_authenticated
from allura.model.timeline import perm_check
from allura.lib import helpers as h
+from allura.lib.decorators import require_post
from .widgets.follow import FollowToggle
@@ -138,6 +139,7 @@ class ForgeActivityController(BaseController):
author_link=h.absurl(t.actor.activity_url))
return feed.writeString('utf-8')
+ @require_post()
@expose('json:')
@validate(W.follow_toggle)
def follow(self, follow, **kw):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/05f5804e/ForgeActivity/forgeactivity/templates/widgets/follow.html
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/templates/widgets/follow.html b/ForgeActivity/forgeactivity/templates/widgets/follow.html
index 78ae48f..34387e2 100644
--- a/ForgeActivity/forgeactivity/templates/widgets/follow.html
+++ b/ForgeActivity/forgeactivity/templates/widgets/follow.html
@@ -16,7 +16,8 @@
specific language governing permissions and limitations
under the License.
-#}
-<a href="{{action}}?follow={{not following}}"
+{% import 'allura:templates/jinja_master/lib.html' as lib with context %}
+<a href="{{action}}" data-following="{{following|lower}}" data-csrf="{{lib.csrf()}}"
class="artifact_follow{{ ' active' if following }}"
title="{{'Stop %sing' % action_label if following else action_label|capitalize}} {{thing}}"><b
data-icon="{{g.icons[icon].char}}" class="ico {{g.icons[icon].css}}"
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/05f5804e/ForgeActivity/forgeactivity/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/tests/functional/test_root.py b/ForgeActivity/forgeactivity/tests/functional/test_root.py
index c308112..6ac88d9 100644
--- a/ForgeActivity/forgeactivity/tests/functional/test_root.py
+++ b/ForgeActivity/forgeactivity/tests/functional/test_root.py
@@ -123,7 +123,7 @@ class TestActivityController(TestController):
@td.with_tool('u/test-user-1', 'activity')
@td.with_user_project('test-user-1')
def test_follow_user(self):
- resp = self.app.get('/u/test-user-1/activity/follow?follow=True')
+ resp = self.app.post('/u/test-user-1/activity/follow', {'follow': 'True'})
assert 'You are now following Test User 1' in resp, resp
@td.with_tool('u/test-admin', 'activity')
@@ -156,7 +156,7 @@ class TestActivityController(TestController):
@td.with_tool('u/test-user-1', 'activity')
@td.with_user_project('test-user-1')
def test_background_aggregation(self):
- self.app.get('/u/test-admin/activity/follow?follow=True',
+ self.app.post('/u/test-admin/activity/follow', {'follow':'true'},
extra_environ=dict(username='test-user-1'))
# new ticket, creates activity
d = {'ticket_form.summary': 'New Ticket'}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/05f5804e/ForgeActivity/forgeactivity/widgets/resources/js/follow.js
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/widgets/resources/js/follow.js b/ForgeActivity/forgeactivity/widgets/resources/js/follow.js
index 0739963..b7d2679 100644
--- a/ForgeActivity/forgeactivity/widgets/resources/js/follow.js
+++ b/ForgeActivity/forgeactivity/widgets/resources/js/follow.js
@@ -33,16 +33,18 @@ $(document).ready(function() {
$('.artifact_follow').click(function(e) {
e.preventDefault();
var $link = $(this);
- $.get(this.href, function(result) {
+ var data = {
+ '_session_id': $link.data('csrf'),
+ 'follow': ! $link.data('following')
+ };
+ $.post(this.href, data, function(result) {
flash(result.message, result.success ? 'success' : 'error');
- console.log(result.following);
+ $link.data('following', result.following);
if (result.following && !$link.hasClass('active')) {
- $link.attr('href', $link.attr('href').replace(/True$/i, 'False'));
$link.addClass('active');
title_stop_following($link);
title_stop_following($link.find('b'));
} else if (!result.following && $link.hasClass('active')) {
- $link.attr('href', $link.attr('href').replace(/False$/i, 'True'));
$link.removeClass('active');
title_start_following($link);
title_start_following($link.find('b'));
[22/22] git commit: Fix test failures with s/json/json:/
Posted by tv...@apache.org.
Fix test failures with s/json/json:/
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5c71f2ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5c71f2ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5c71f2ac
Branch: refs/heads/tv/6393
Commit: 5c71f2ac1343c486f037f701d15a3b856ed87260
Parents: b92873c
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Jan 21 22:05:03 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Jan 21 22:05:03 2014 +0000
----------------------------------------------------------------------
ForgeWiki/forgewiki/wiki_main.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5c71f2ac/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index ce1e2b7..01a6008 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -533,7 +533,7 @@ class PageController(BaseController, FeedController):
hide_left_bar=hide_left_bar)
@without_trailing_slash
- @expose('json')
+ @expose('json:')
@require_post()
def delete(self):
require_access(self.page, 'delete')
@@ -541,7 +541,7 @@ class PageController(BaseController, FeedController):
return dict(location='../' + self.page.title + '/?deleted=True')
@without_trailing_slash
- @expose('json')
+ @expose('json:')
@require_post()
def undelete(self):
require_access(self.page, 'delete')
@@ -601,7 +601,7 @@ class PageController(BaseController, FeedController):
self.page.url())
@without_trailing_slash
- @expose('json')
+ @expose('json:')
@require_post()
@validate(dict(version=validators.Int(if_empty=1, if_invalid=1)))
def revert(self, version, **kw):
[08/22] git commit: [#7059] Improve tarball status UX
Posted by tv...@apache.org.
[#7059] Improve tarball status UX
* Don't say 'Generating' when we're not
* Fail quickly when we know snapshot isn't being built
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/39fc30ca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/39fc30ca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/39fc30ca
Branch: refs/heads/tv/6393
Commit: 39fc30ca89853a7b2280c14274bbd0328e8aa2d2
Parents: 2d45976
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Jan 16 14:06:42 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Jan 16 14:06:42 2014 +0000
----------------------------------------------------------------------
Allura/allura/templates/repo/tarball.html | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/39fc30ca/Allura/allura/templates/repo/tarball.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/tarball.html b/Allura/allura/templates/repo/tarball.html
index 92b7af4..2338be1 100644
--- a/Allura/allura/templates/repo/tarball.html
+++ b/Allura/allura/templates/repo/tarball.html
@@ -53,8 +53,8 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
left: 10 // Left position relative to parent in px
};
var spinner = new Spinner(opts).spin($('#snapshot_status')[0]);
- var delay = 500, elapsed = 0;
- $('#snapshot_status h2.busy').show();
+ var delay = 500;
+ $('#snapshot_status h2.checking').show();
function check_status() {
$.get('{{commit.url()}}tarball_status?path={{path}}', function(data) {
if (data.status === 'complete') {
@@ -67,13 +67,14 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
} else {
if (data.status === 'ready' || data.status === 'busy') {
// keep waiting
- } else if (data.status === 'error' || elapsed > 5000) {
+ $('#snapshot_status h2').hide();
+ $('#snapshot_status h2.busy').show();
+ } else {
// something went wrong
spinner.stop();
$('#snapshot_status h2').hide();
$('#snapshot_status form').show();
}
- elapsed += delay;
if (delay < 60000){
delay = delay * 2;
}
@@ -90,6 +91,7 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a> {{commit_labels(
{% block content %}
{% set path = request.params.get('path', '') %}
<div id='snapshot_status'>
+ <h2 class="checking">Checking snapshot status...</h2>
<h2 class="busy">Generating snapshot...</h2>
<h2 class="complete">Your download will begin shortly, or use this <a href="{{c.app.repo.tarball_url(revision, path)}}">direct link</a>.</h2>
<form action="tarball" method="post">