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 2015/03/16 17:21:46 UTC

[1/2] allura git commit: [#7854] add option to taskd command so pdb can be used

Repository: allura
Updated Branches:
  refs/heads/db/7854 [created] 5c8f832d1


[#7854] add option to taskd command so pdb can be used


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

Branch: refs/heads/db/7854
Commit: 8337e6f2a425b68d1cf0bcc42de6803a0659eb02
Parents: 228f9bc
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Mon Mar 16 16:20:49 2015 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Mar 16 16:20:49 2015 +0000

----------------------------------------------------------------------
 Allura/allura/command/taskd.py           | 3 +++
 Allura/allura/controllers/task.py        | 3 ++-
 Allura/allura/model/monq_model.py        | 6 +++---
 Allura/docs/development/contributing.rst | 2 +-
 Allura/docs/platform/platform_tour.rst   | 2 +-
 5 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/8337e6f2/Allura/allura/command/taskd.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/taskd.py b/Allura/allura/command/taskd.py
index f05a4b3..40d795a 100644
--- a/Allura/allura/command/taskd.py
+++ b/Allura/allura/command/taskd.py
@@ -59,6 +59,8 @@ class TaskdCommand(base.Command):
     parser = base.Command.standard_parser(verbose=True)
     parser.add_option('--only', dest='only', type='string', default=None,
                       help='only handle tasks of the given name(s) (can be comma-separated list)')
+    parser.add_option('--nocapture', dest='nocapture', action="store_true", default=False,
+                      help='Do not capture stdout and redirect it to logging.  Useful for development with pdb.set_trace()')
 
     def command(self):
         setproctitle('taskd')
@@ -153,6 +155,7 @@ class TaskdCommand(base.Command):
                                               base_url=tg.config['base_url'].rstrip(
                                                   '/') + request_path,
                                               environ={'task': self.task,
+                                                       'nocapture': self.options.nocapture,
                                                        })
                             list(wsgi_app(r.environ, start_response))
                             self.task = None

http://git-wip-us.apache.org/repos/asf/allura/blob/8337e6f2/Allura/allura/controllers/task.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/task.py b/Allura/allura/controllers/task.py
index 3275d94..cb666ee 100644
--- a/Allura/allura/controllers/task.py
+++ b/Allura/allura/controllers/task.py
@@ -27,6 +27,7 @@ class TaskController(object):
 
     def __call__(self, environ, start_response):
         task = environ['task']
-        result = task(restore_context=False)
+        nocapture = environ['nocapture']
+        result = task(restore_context=False, nocapture=nocapture)
         start_response('200 OK', [])
         return [result]

http://git-wip-us.apache.org/repos/asf/allura/blob/8337e6f2/Allura/allura/model/monq_model.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/monq_model.py b/Allura/allura/model/monq_model.py
index fb33216..be22769 100644
--- a/Allura/allura/model/monq_model.py
+++ b/Allura/allura/model/monq_model.py
@@ -32,7 +32,7 @@ from ming import schema as S
 from ming.orm import session, FieldProperty
 from ming.orm.declarative import MappedClass
 
-from allura.lib.helpers import log_output
+from allura.lib.helpers import log_output, null_contextmanager
 from .session import task_orm_session
 
 log = logging.getLogger(__name__)
@@ -237,7 +237,7 @@ class MonQTask(MappedClass):
             task()
         return i
 
-    def __call__(self, restore_context=True):
+    def __call__(self, restore_context=True, nocapture=False):
         '''Call the task function with its context.  If restore_context is True,
         c.project/app/user will be restored to the values they had before this
         function was called.
@@ -261,7 +261,7 @@ class MonQTask(MappedClass):
                 if app_config:
                     c.app = c.project.app_instance(app_config)
             c.user = M.User.query.get(_id=self.context.user_id)
-            with log_output(log):
+            with null_contextmanager() if nocapture else log_output(log):
                 self.result = func(*self.args, **self.kwargs)
             self.state = 'complete'
             return self.result

http://git-wip-us.apache.org/repos/asf/allura/blob/8337e6f2/Allura/docs/development/contributing.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/development/contributing.rst b/Allura/docs/development/contributing.rst
index e22ceb1..8a8cfdb 100644
--- a/Allura/docs/development/contributing.rst
+++ b/Allura/docs/development/contributing.rst
@@ -175,7 +175,7 @@ foreground::
     # web
     pkill "paster serve" && paster serve --reload ../development.ini
     # taskd
-    pkill "paster taskd" && paster taskd ../development.ini
+    pkill "paster taskd" && paster taskd ../development.ini --nocapture
 
 Make a request to the web app, and when your line of code is hit, a debug
 session will start on the console where the process is running.

http://git-wip-us.apache.org/repos/asf/allura/blob/8337e6f2/Allura/docs/platform/platform_tour.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/platform/platform_tour.rst b/Allura/docs/platform/platform_tour.rst
index 6d43ccd..6726b89 100644
--- a/Allura/docs/platform/platform_tour.rst
+++ b/Allura/docs/platform/platform_tour.rst
@@ -167,7 +167,7 @@ Asynchronous Processing
 
 Much of the actual functionality of Allura comes from code that runs
 *outside* the context of a web request, in the `taskd` server (invoked by
-running `paster taskd development.ini`.  Asynchronous processing is performed
+running :command:`paster taskd development.ini`).  Asynchronous processing is performed
 by two types of functions, *tasks* and *events*, differentiated as follows:
 
 Task


[2/2] allura git commit: [#7854] convert HTML entities when extracting pages in the importer

Posted by br...@apache.org.
[#7854] convert HTML entities when extracting pages in the importer


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

Branch: refs/heads/db/7854
Commit: 5c8f832d1e72f95c41352b35d7431cd8edb3fc70
Parents: 8337e6f
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Mon Mar 16 16:21:32 2015 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Mar 16 16:21:32 2015 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/base.py                        | 2 +-
 ForgeImporters/forgeimporters/tests/google/test_extractor.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/5c8f832d/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index ae19156..8428142 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -223,7 +223,7 @@ class ProjectExtractor(object):
         :param page: A file-like object return from :meth:`urlopen`
 
         """
-        return BeautifulSoup(page)
+        return BeautifulSoup(page, convertEntities=BeautifulSoup.HTML_ENTITIES)
 
 
 class ProjectImporter(BaseController):

http://git-wip-us.apache.org/repos/asf/allura/blob/5c8f832d/ForgeImporters/forgeimporters/tests/google/test_extractor.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/google/test_extractor.py b/ForgeImporters/forgeimporters/tests/google/test_extractor.py
index 228fa0b..60ca0e2 100644
--- a/ForgeImporters/forgeimporters/tests/google/test_extractor.py
+++ b/ForgeImporters/forgeimporters/tests/google/test_extractor.py
@@ -56,7 +56,7 @@ class TestGoogleCodeProjectExtractor(TestCase):
 
         self.urlopen.assert_called_once_with(
             'http://code.google.com/p/my-project/')
-        self.soup.assert_called_once_with(self.urlopen.return_value)
+        self.soup.assert_called_once_with(self.urlopen.return_value, convertEntities=self.soup.HTML_ENTITIES)
         self.assertEqual(extractor.page, self.soup.return_value)
 
     def test_get_page(self):