Skip to content

Commit

Permalink
Switch TESTING_INSTANCE to DEMO_INSTANCE.
Browse files Browse the repository at this point in the history
  • Loading branch information
kmccurley committed Jan 11, 2025
1 parent 070d606 commit a8765cd
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions webapp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self, engine, session):

# DB wrapper is global so we can have easy access to engine and session.
db = SQLAlchemy(None, None)
# scheduler is only used to clean up old jobs in case it has config.TESTING_INSTANCE set to tru
# scheduler is only used to clean up old jobs in case it has config.DEMO_INSTANCE set to tru
scheduler = Scheduler(executors={'default': pool.ThreadPoolExecutor(1)},
timezone='America/Los_Angeles')

Expand All @@ -106,7 +106,7 @@ def shutdown_session(ex):
# Create database tables if they don't already exist.
Base.metadata.create_all(bind=db.engine)
login_manager.init_app(app)
if config.TESTING_INSTANCE:
if config.DEMO_INSTANCE:
from .cleanup import cleanup_task
scheduler.init_app(app)
scheduler.start()
Expand Down
4 changes: 2 additions & 2 deletions webapp/cleanup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""This is used only if config.TESTING_INSTANCE is True, and is
"""This is used only if config.DEMO_INSTANCE is True, and is
used to remove old articles.
"""

Expand All @@ -16,7 +16,7 @@ def cleanup_task():
if scheduler.app.config['DEBUG']:
scheduler.app.logger.warning('skipping cleanup of existing papers')
return
if scheduler.app.config['TESTING_INSTANCE']:
if scheduler.app.config['DEMO_INSTANCE']:
scheduler.app.logger.warning('cleanup should not be configured')
return
scheduler.app.logger.warning('cleaning up papers')
Expand Down
4 changes: 3 additions & 1 deletion webapp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ class Config:
CROSSREF_PUBLISHER_EMAIL = '[email protected]'
USERS = None
TESTING = False
DEMO_INSTANCE = False
WTF_CSRF_TIME_LIMIT = None
EXPORT_PATH = '/tmp'
FUNDING_SEARCH_URL = '/searchapi/search'
SUBMIT_BYPASS = 'testing'
SUBMIT_BYPASS = '' # now deprecated and replaced by DEMO_INSTANCE
JOURNALS = [
{
'hotcrp_key': 'cic',
Expand Down Expand Up @@ -75,6 +76,7 @@ class DebugConfig(Config):
FLASK_ENV = 'development'
DEBUG = True
TESTING = True
DEMO_INSTANCE = True
# used by kevin.
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://publication:st0remydata@localhost/publication'
# SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://publication:mystuff@localhost/publication'
Expand Down
2 changes: 1 addition & 1 deletion webapp/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def home():
def show_submit_version():
form = SubmitForm(request.args)
if not form.paperid.data:
if not app.config['TESTING_INSTANCE']:
if not app.config['DEMO_INSTANCE']:
return redirect(url_for('home_bp.home'))
# In this case the submission doesn't come from hotcrp, so we make up some fields.
random.seed()
Expand Down
2 changes: 1 addition & 1 deletion webapp/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h4 class="text-center">Is it made out of <a href="https://iacr.org/tinfoil.html
<a class="navbar-brand mx-md-5" href="https://iacr.org/"><img class="iacrlogo" src="/img/iacrlogo_small.png" alt="IACR Logo" style="max-width:6rem;"></a>
<div class="d-none d-md-inline navbar-brand">{{site_name}}</div>
<span class="d-inline d-md-none navbar-brand">{{site_shortname}}</span>
{% if config.TESTING_INSTANCE %}
{% if config.DEMO_INSTANCE %}
<div class="navbar-brand mx-md-2"><span class="text-danger bg-warning p-2 rounded">TEST INSTANCE</span></div>
{% endif %}
</span>
Expand Down
4 changes: 2 additions & 2 deletions webapp/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="row mt-4">
<div class="col-12 col-md-6">
<div class="alert alert-danger">
{% if config.TESTING_INSTANCE %}
{% if config.DEMO_INSTANCE %}
This is only a test server. If you are trying to submit a final version for the journal,
then you should start from your hotcrp instance.
{% else %}
Expand All @@ -30,7 +30,7 @@
</div>
<div class="row mt-3">
<div class="col-12 col-md-8 offset-md-2">
{% if config.TESTING_INSTANCE %}
{% if config.DEMO_INSTANCE %}
<p class="alert alert-info">
This test server allows people to experiment with the infrastructure, but is not part of
the actual pipeline for the journal. Papers uploaded here are not private,
Expand Down
2 changes: 1 addition & 1 deletion webapp/templates/submit.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
</div>
{{ form.submit(class_='mt-5 btn btn-primary') }}
</form>
{% if config.TESTING_INSTANCE %}
{% if config.DEMO_INSTANCE %}
<div class="alert alert-warning mt-2">Nothing you submit here will be private, but papers that are submitted here
will be automatically deleted every few days.
</div>
Expand Down

0 comments on commit a8765cd

Please sign in to comment.