sqlalchemy / sqlalchemy/mako

idea - template debug comments

Open
#232 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

easy feature
Dominant language
Python
Stars
459
Forks
90
PR merge metrics
No merged PRs in 30d

Description

Migrated issue, originally created by jvanasco (@jvanasco)

i have an idea for template debugging that I think might prove useful -- "debug comments"

mako doesn't print line comments in this format:

## line comment

i propose a second comment form, something like :

##! debug comment

if the template (or template lookup) is configured with "debug_comments=True" , then that line (excluding the prefix) would be rendered. otherwise it will be stripped.

the rationale for this, is that it often makes sense to have extra html comments in a development/staging machine, but not on a production environment.

if this sounds good, and a prefix can be decided on, i think i can implement it and submit a PR. (though it'll happen after my sqlalchemy workload)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the template and template lookup configuration paths, focusing on how comments are parsed and how options such as debug_comments could be passed. Decide the comment prefix and the behavior when debugging is enabled or disabled, then add coverage for both rendering cases and confirm the proposed syntax works.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.