You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by ke...@apache.org on 2018/02/27 22:55:41 UTC

allura git commit: fixup! [#8189] Adds testing util script to populate lots of forum topics [Forced Update!]

Repository: allura
Updated Branches:
  refs/heads/kt/8189 935f42d7c -> 76e007958 (forced update)


fixup! [#8189] Adds testing util script to populate lots of forum topics


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

Branch: refs/heads/kt/8189
Commit: 76e00795873c7c76aa7dbc6cc87be2222828f5e8
Parents: 5853afc
Author: Kenton Taylor <kt...@slashdotmedia.com>
Authored: Tue Feb 27 17:55:29 2018 -0500
Committer: Kenton Taylor <kt...@slashdotmedia.com>
Committed: Tue Feb 27 17:55:29 2018 -0500

----------------------------------------------------------------------
 Allura/allura/lib/widgets/discuss.py    |  3 ++
 scripts/migrations/034-load-up-forum.py | 74 ----------------------------
 2 files changed, 3 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/76e00795/Allura/allura/lib/widgets/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/discuss.py b/Allura/allura/lib/widgets/discuss.py
index 0a7e8b9..7afdac4 100644
--- a/Allura/allura/lib/widgets/discuss.py
+++ b/Allura/allura/lib/widgets/discuss.py
@@ -221,6 +221,9 @@ class SubscriptionForm(ew.SimpleForm):
     class fields(ew_core.NameList):
         page_list = ffw.PageList()
         page_size = ffw.PageSize()
+
+        # Careful! using the same name as the prop on the model will invoke the RelationalProperty,
+        # causing all related entities to be (re)fetched.
         _threads = _ThreadsTable()
 
     def resources(self):

http://git-wip-us.apache.org/repos/asf/allura/blob/76e00795/scripts/migrations/034-load-up-forum.py
----------------------------------------------------------------------
diff --git a/scripts/migrations/034-load-up-forum.py b/scripts/migrations/034-load-up-forum.py
deleted file mode 100644
index 2184411..0000000
--- a/scripts/migrations/034-load-up-forum.py
+++ /dev/null
@@ -1,74 +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.
-
-
-import logging
-import uuid
-from ming.orm import ThreadLocalORMSession, session
-from pylons import tmpl_context as c
-from allura import model as M
-from forgediscussion.model import ForumPost, Forum
-from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, ArgumentTypeError
-from allura.lib import helpers as h
-from random import randint
-
-
-log = logging.getLogger(__name__)
-
-
-def arguments():
-    parser = ArgumentParser(description="Args for changing anon comment permissions",
-                            formatter_class=ArgumentDefaultsHelpFormatter, )
-    parser.add_argument('shortname', help="shortname of project to change ")
-    parser.add_argument('mountpt', help="toolname ")
-    parser.add_argument('forumname', help="forum")
-
-    args = parser.parse_args()
-    return args
-
-
-def main():
-    args = arguments()
-
-    c.user = M.User.query.get(username='root')
-
-    with h.push_context(args.shortname, args.mountpt, neighborhood='Projects'):
-
-        tool = c.project.app_config_by_tool_type(args.mountpt)
-
-        # create tons of topics
-        discussion = Forum.query.get(
-            app_config_id=tool._id,
-            shortname=args.forumname)
-
-        for i in range(5000):
-            subject = 'fake topic {}'.format(str(i))
-            thd = discussion.thread_class()(discussion_id=discussion._id, subject=subject)
-            # subj = str(uuid.uuid4())[:8]
-            p = thd.post(subject, 'a new topic 2')
-
-            for j in range(randint(1, 5)):
-                new_post = {'text':'comment text'}
-                # post = thd.add_post(**new_post)
-                post = thd.add_post(text='comment text for real', subject="test subject")
-
-            if i % 1000:
-                session(p).flush()
-
-
-if __name__ == '__main__':
-    main()