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 2019/10/14 21:00:13 UTC
[allura] 08/09: [#8336] Remove unused code
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch db/8336
in repository https://gitbox.apache.org/repos/asf/allura.git
commit ff44573d81decd38ea526b4ff3e713a5e489f57c
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Mon Oct 14 15:36:36 2019 -0400
[#8336] Remove unused code
---
Allura/allura/lib/widgets/forms.py | 12 ---------
Allura/allura/websetup/bootstrap.py | 53 +------------------------------------
Allura/test.ini | 1 -
3 files changed, 1 insertion(+), 65 deletions(-)
diff --git a/Allura/allura/lib/widgets/forms.py b/Allura/allura/lib/widgets/forms.py
index 7820157..68254d9 100644
--- a/Allura/allura/lib/widgets/forms.py
+++ b/Allura/allura/lib/widgets/forms.py
@@ -119,18 +119,6 @@ class ForgeForm(ew.SimpleForm):
ctx['errors'])
return h.html.literal(display)
- def display_field_by_idx(self, idx, ignore_errors=False):
- warnings.warn(
- 'ForgeForm.display_field_by_idx is deprecated; use '
- 'ForgeForm.display_field() instead', DeprecationWarning)
- field = self.fields[idx]
- ctx = self.context_for(field)
- display = field.display(**ctx)
- if ctx['errors'] and field.show_errors and not ignore_errors:
- display = "%s<div class='error'>%s</div>" % (display,
- ctx['errors'])
- return display
-
class ForgeFormResponsive(ForgeForm):
def __init__(self):
diff --git a/Allura/allura/websetup/bootstrap.py b/Allura/allura/websetup/bootstrap.py
index d282b5d..14f5660 100644
--- a/Allura/allura/websetup/bootstrap.py
+++ b/Allura/allura/websetup/bootstrap.py
@@ -46,24 +46,6 @@ from forgewiki import model as WM
log = logging.getLogger(__name__)
-def cache_test_data():
- log.info('Saving data to cache in .test-data')
- if os.path.exists('.test-data'):
- shutil.rmtree('.test-data')
- os.system(
- 'mongodump -h 127.0.0.1:27018 -o .test-data > mongodump.log 2>&1')
-
-
-def restore_test_data():
- if os.path.exists('.test-data'):
- log.info('Restoring data from cache in .test-data')
- rc = os.system(
- 'mongorestore -h 127.0.0.1:27018 --dir .test-data > mongorestore.log 2>&1')
- return rc == 0
- else:
- return False
-
-
def bootstrap(command, conf, vars):
"""Place any commands to setup allura here"""
# are we being called by the test suite?
@@ -102,12 +84,6 @@ def bootstrap(command, conf, vars):
index = EnsureIndexCommand('ensure_index')
index.run([''])
- if create_test_data and asbool(conf.get('cache_test_data')):
- if restore_test_data():
- h.set_context('test', neighborhood='Projects')
- return
- log.info('Initializing search')
-
log.info('Registering root user & default neighborhoods')
M.User(
_id=None,
@@ -265,10 +241,7 @@ def bootstrap(command, conf, vars):
ThreadLocalORMSession.flush_all()
- if asbool(conf.get('load_test_data')):
- if asbool(conf.get('cache_test_data')):
- cache_test_data()
- else: # pragma no cover
+ if not asbool(conf.get('load_test_data')):
# regular first-time setup
create_trove_categories = CreateTroveCategoriesCommand('create_trove_categories')
@@ -363,27 +336,3 @@ class DBSession(Session):
def _impl(self, cls):
return self.db[cls.__mongometa__.name]
-
-
-def pm(etype, value, tb): # pragma no cover
- import pdb
- import traceback
- try:
- from IPython.ipapi import make_session
- make_session()
- from IPython.Debugger import Pdb
- sys.stderr.write('Entering post-mortem IPDB shell\n')
- p = Pdb(color_scheme='Linux')
- p.reset()
- p.setup(None, tb)
- p.print_stack_trace()
- sys.stderr.write('%s: %s\n' % (etype, value))
- p.cmdloop()
- p.forget()
- # p.interaction(None, tb)
- except ImportError:
- sys.stderr.write('Entering post-mortem PDB shell\n')
- traceback.print_exception(etype, value, tb)
- pdb.post_mortem(tb)
-
-sys.excepthook = pm
diff --git a/Allura/test.ini b/Allura/test.ini
index 8c7abb1..ee6042b 100644
--- a/Allura/test.ini
+++ b/Allura/test.ini
@@ -39,7 +39,6 @@ solr.server =
smtp.mock = true
load_test_data = true
-cache_test_data = false
site_admin_project = test
; useful primarily for test suites, where we want to see the error right away