You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/03/21 01:15:58 UTC

[1/4] git commit: [#5995] provide more info when macros error

Updated Branches:
  refs/heads/db/5995 [created] ecba367f3


[#5995] provide more info when macros error


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

Branch: refs/heads/db/5995
Commit: 5a8edf2aa464ac871a425db328c7a1498a8ef817
Parents: b849642
Author: Dave Brondsema <db...@geek.net>
Authored: Wed Mar 20 15:45:52 2013 -0700
Committer: Dave Brondsema <db...@geek.net>
Committed: Wed Mar 20 15:45:52 2013 -0700

----------------------------------------------------------------------
 Allura/allura/lib/macro.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5a8edf2a/Allura/allura/lib/macro.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/macro.py b/Allura/allura/lib/macro.py
index 7277a36..d60a510 100644
--- a/Allura/allura/lib/macro.py
+++ b/Allura/allura/lib/macro.py
@@ -3,6 +3,7 @@ import random
 import shlex
 import string
 import logging
+import traceback
 
 import pymongo
 from pylons import tmpl_context as c, app_globals as g
@@ -44,8 +45,10 @@ class parse(object):
                 response = macro(**h.encode_keys(args))
                 return response
             except (ValueError, TypeError) as ex:
+                log.warn('macro error.  Upwards stack is %s',
+                         ''.join(traceback.format_stack()),
+                         exc_info=True)
                 msg = cgi.escape(u'[[%s]] (%s)' % (s, repr(ex)))
-                log.warn('macro error', exc_info=True)
                 return '\n<div class="error"><pre><code>%s</code></pre></div>' % msg
         except Exception, ex:
             raise


[4/4] git commit: [#5995] remove unneeded logging that sounds a bit scary when you see it from setup-app

Posted by br...@apache.org.
[#5995] remove unneeded logging that sounds a bit scary when you see it from setup-app


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

Branch: refs/heads/db/5995
Commit: ecba367f3356cd9085ae4b3a227c6161728ee91f
Parents: f6ffa57
Author: Dave Brondsema <db...@geek.net>
Authored: Wed Mar 20 17:15:04 2013 -0700
Committer: Dave Brondsema <db...@geek.net>
Committed: Wed Mar 20 17:15:47 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ecba367f/Allura/allura/model/notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
index 6a9f559..7003e29 100644
--- a/Allura/allura/model/notification.py
+++ b/Allura/allura/model/notification.py
@@ -348,7 +348,6 @@ class Mailbox(MappedClass):
             app_config_id=app_config_id,
             artifact_index_id=None)
         if tool_already_subscribed:
-            log.debug('Tried to subscribe to artifact %s, while there is a tool subscription', artifact)
             return
         if artifact is None:
             artifact_title = 'All artifacts'


[3/4] git commit: [#5995] avoid 'Neighborhood project missing' during security checks in bootstrap

Posted by br...@apache.org.
[#5995] avoid 'Neighborhood project missing' during security checks in bootstrap

neighborhood_project is a lazy property, so they very first time a neighborhood project
is created, the check here would return None and then it'd be None for the rest
of the process.  This check isn't needed anyway since there's a unique constraint
on neighborhood_id/shortname for projects.


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

Branch: refs/heads/db/5995
Commit: f6ffa57ff4a034467302db44a90c3a6837814f3d
Parents: a681f4b
Author: Dave Brondsema <db...@geek.net>
Authored: Wed Mar 20 17:11:46 2013 -0700
Committer: Dave Brondsema <db...@geek.net>
Committed: Wed Mar 20 17:15:47 2013 -0700

----------------------------------------------------------------------
 Allura/allura/lib/plugin.py         |    4 +---
 Allura/allura/model/neighborhood.py |    4 +++-
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f6ffa57f/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 3e33172..a3d01b8 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -371,9 +371,7 @@ class ProjectRegistrationProvider(object):
 
     def register_neighborhood_project(self, neighborhood, users, allow_register=False):
         from allura import model as M
-        shortname='--init--'
-        p = neighborhood.neighborhood_project
-        if p: raise forge_exc.ProjectConflict()
+        shortname = '--init--'
         name = 'Home Project for %s' % neighborhood.name
         database_uri = M.Project.default_database_uri(shortname)
         p = M.Project(neighborhood_id=neighborhood._id,

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f6ffa57f/Allura/allura/model/neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/neighborhood.py b/Allura/allura/model/neighborhood.py
index b04c0f0..97d96f7 100644
--- a/Allura/allura/model/neighborhood.py
+++ b/Allura/allura/model/neighborhood.py
@@ -73,9 +73,11 @@ class Neighborhood(MappedClass):
     @LazyProperty
     def neighborhood_project(self):
         from .project import Project
-        return Project.query.get(
+        p = Project.query.get(
             neighborhood_id=self._id,
             is_nbhd_project=True)
+        assert p
+        return p
 
     @property
     def acl(self):


[2/4] git commit: [#5995] avoid thread errors when running `[[download_button]]` outside of web context

Posted by br...@apache.org.
[#5995] avoid thread errors when running `[[download_button]]` outside of web context


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

Branch: refs/heads/db/5995
Commit: a681f4be5a3ebf554ab602238aee29cac069c12d
Parents: 5a8edf2
Author: Dave Brondsema <db...@geek.net>
Authored: Wed Mar 20 17:05:18 2013 -0700
Committer: Dave Brondsema <db...@geek.net>
Committed: Wed Mar 20 17:05:18 2013 -0700

----------------------------------------------------------------------
 Allura/allura/lib/macro.py |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a681f4be/Allura/allura/lib/macro.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/macro.py b/Allura/allura/lib/macro.py
index d60a510..ff5a0d3 100644
--- a/Allura/allura/lib/macro.py
+++ b/Allura/allura/lib/macro.py
@@ -281,14 +281,23 @@ def project_screenshots():
     response = ps.display(project=c.project)
     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 import model as M
     from allura.lib.widgets.macros import DownloadButton
     button = DownloadButton(project=c.project)
-    g.resource_manager.register(button)
-    response = button.display(project=c.project)
-    return response
+    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):