Skip to content

Commit

Permalink
Merge pull request #10014 from cdrini/feature/limit-debug-true
Browse files Browse the repository at this point in the history
Make debug=true use the features config in openlibrary.yml
  • Loading branch information
cdrini authored Nov 11, 2024
2 parents 6de38de + 89ace77 commit e32c84f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions conf/openlibrary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ http_request_timeout: 10

features:
cache_most_recent: enabled
debug: enabled
dev: enabled
history_v2: admin
inlibrary: enabled
Expand Down
5 changes: 2 additions & 3 deletions openlibrary/plugins/openlibrary/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
infogami.config.features = [] # type: ignore[attr-defined]

from infogami.utils.app import metapage
from infogami.utils import delegate
from infogami.utils import delegate, features
from openlibrary.utils import dateutil
from infogami.utils.view import (
render,
Expand Down Expand Up @@ -1127,7 +1127,6 @@ def save_error():


def internalerror():
i = web.input(_method='GET', debug='false')
name = save_error()

# TODO: move this stats stuff to plugins\openlibrary\stats.py
Expand All @@ -1141,7 +1140,7 @@ def internalerror():
if sentry.enabled:
sentry.capture_exception_webpy()

if i.debug.lower() == 'true':
if features.is_enabled('debug'):
raise web.debugerror()
else:
msg = render.site(render.internalerror(name))
Expand Down
4 changes: 2 additions & 2 deletions openlibrary/templates/admin/people/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h1><a class="plain" href="/admin/people">$_("People")</a> / $person.username</h
<div id="contentBody">

<div class="status status-$person.status">
<form method="POST" action="?debug=true">
<form method="POST">
Status: <span class="status">$person.status</span>

$if person.status in ['active', 'verified']:
Expand Down Expand Up @@ -216,7 +216,7 @@ <h1><a class="plain" href="/admin/people">$_("People")</a> / $person.username</h
<tr>
<td>$_("Anonymize Account:")</td>
<td>
<form method="POST" id="anonymize-form" action="?debug=true">
<form method="POST" id="anonymize-form">
<input type="checkbox" id="dry-run-checkbox" name="dry_run">
<label for="dry-run-checkbox">$_("Dry Run")</label>
<button type="submit" name="action" value="anonymize_account" style="float: right;" class="account-anonymization-button" data-display-name="$person.username">$_("Anonymize Account")</button>
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/templates/type/list/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ <h1>$(_("Create a list") if new else _("Edit List"))</h1>
</div>

<div id="contentBody">
<form method="post" id="list-edit" class="olform" $:cond(query_param('debug'), 'action="?debug=true"')>
<form method="post" id="list-edit" class="olform">
$if not new:
<input
required
Expand Down

0 comments on commit e32c84f

Please sign in to comment.