incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [17/17] git commit: [#6692] don't send email after API exports
Date Thu, 31 Oct 2013 22:05:12 GMT
[#6692] don't send email after API exports


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

Branch: refs/heads/master
Commit: 44b3f5fe74bbdffcb858b87c244e991c1c239359
Parents: 02a2675
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Thu Oct 31 21:49:09 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Thu Oct 31 22:04:44 2013 +0000

----------------------------------------------------------------------
 Allura/allura/ext/admin/admin_main.py | 6 +++---
 Allura/allura/tasks/export_tasks.py   | 9 ++++++---
 2 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/44b3f5fe/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index 68f14e0..d94303d 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -642,7 +642,7 @@ class ProjectAdminController(BaseController):
             raise exc.HTTPNotFound()
         if request.method == 'POST':
             try:
-                ProjectAdminRestController().export(tools)
+                ProjectAdminRestController().export(tools, send_email=True)
             except (exc.HTTPBadRequest, exc.HTTPServiceUnavailable) as e:
                 flash(str(e), 'error')
                 redirect('.')
@@ -667,7 +667,7 @@ class ProjectAdminRestController(BaseController):
 
     @expose('json:')
     @require_post()
-    def export(self, tools=None, **kw):
+    def export(self, tools=None, send_email=False, **kw):
         """
         Initiate a bulk export of the project data.
 
@@ -702,7 +702,7 @@ class ProjectAdminRestController(BaseController):
         # filename (potentially) includes a timestamp, so we have
         # to pre-generate to be able to return it to the user
         filename = c.project.bulk_export_filename()
-        export_tasks.bulk_export.post(tools, filename)
+        export_tasks.bulk_export.post(tools, filename, send_email=send_email)
         return {
                 'status': 'in progress',
                 'filename': filename,

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/44b3f5fe/Allura/allura/tasks/export_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/export_tasks.py b/Allura/allura/tasks/export_tasks.py
index c89182b..2f286d0 100644
--- a/Allura/allura/tasks/export_tasks.py
+++ b/Allura/allura/tasks/export_tasks.py
@@ -35,7 +35,7 @@ log = logging.getLogger(__name__)
 
 
 @task
-def bulk_export(tools, filename=None):
+def bulk_export(tools, filename=None, send_email=True):
     '''
     Export the current project data.  Send notification to current user.
 
@@ -44,10 +44,10 @@ def bulk_export(tools, filename=None):
     '''
     # it's very handy to use c.* within a @task,
     # but let's be explicit and keep it separate from the main code
-    return _bulk_export(c.project, tools, c.user, filename)
+    return _bulk_export(c.project, tools, c.user, filename, send_email)
 
 
-def _bulk_export(project, tools, user, filename=None):
+def _bulk_export(project, tools, user, filename=None, send_email=True):
     export_filename = filename or project.bulk_export_filename()
     export_path = create_export_dir(project, export_filename)
     not_exported_tools = []
@@ -82,6 +82,9 @@ def _bulk_export(project, tools, user, filename=None):
     if not user:
         log.info('No user. Skipping notification.')
         return
+    if not send_email:
+        return
+
     tmpl = g.jinja2_env.get_template('allura:templates/mail/bulk_export.html')
     instructions = tg.config.get('bulk_export_download_instructions', '')
     instructions = instructions.format(


Mime
View raw message