Skip to content

feat: Make dump for fns, classes more stable and helpful - #36188

Merged
kdmccormick merged 1 commit into
openedx:masterfrom
kdmccormick:kdmccormick/dump-settings-2
Jan 29, 2025
Merged

feat: Make dump for fns, classes more stable and helpful#36188
kdmccormick merged 1 commit into
openedx:masterfrom
kdmccormick:kdmccormick/dump-settings-2

Conversation

@kdmccormick

Copy link
Copy Markdown
Member

Description

This is a light iteration on #36162, making the dump_settings management command more helpful and stable for functions and classes.

Supporting information

In particular, the dump_settings command currently prints out the raw repr(...)s for defined functions:

    "WIKI_CAN_ASSIGN": "<function CAN_ASSIGN at 0x74ce5e9b2020>",
    "WIKI_CAN_CHANGE_PERMISSIONS": "<function CAN_CHANGE_PERMISSIONS at 0x74ce5e9b1f80>",
    "WIKI_CAN_DELETE": "<function CAN_DELETE at 0x74ce5e9b1b20>",
    "WIKI_CAN_MODERATE": "<function CAN_MODERATE at 0x74ce5e9b1bc0>",

In addition to being uninformative, these at 0x123abc... hashes change every run, so they appear in the diff as having "changed" every time.

With this PR, here's what dump_settings will print out for functions:

    "WIKI_CAN_ASSIGN": {
        "module": "lms.djangoapps.course_wiki.settings",
        "qualname": "CAN_ASSIGN"
    },
    "WIKI_CAN_CHANGE_PERMISSIONS": {
        "module": "lms.djangoapps.course_wiki.settings",
        "qualname": "CAN_CHANGE_PERMISSIONS"
    },
    "WIKI_CAN_DELETE": {
        "module": "lms.djangoapps.course_wiki.settings",
        "qualname": "CAN_DELETE"
    },
    "WIKI_CAN_MODERATE": {
        "module": "lms.djangoapps.course_wiki.settings",
        "qualname": "CAN_MODERATE"
    },

It will do something similarly helpful for classes and lambdas.

Deadline

Asap, as this unblocks several pending settings refactorings.

@kdmccormick
kdmccormick requested review from dcoa and feanil January 28, 2025 20:39
@kdmccormick

Copy link
Copy Markdown
Member Author

@feanil or @dianakhuang , can one of you take a look?

@kdmccormick
kdmccormick merged commit 98a4a32 into openedx:master Jan 29, 2025
@kdmccormick
kdmccormick deleted the kdmccormick/dump-settings-2 branch January 29, 2025 16:06
@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

leoaulasneo98 pushed a commit to aulasneo/edx-platform that referenced this pull request Jan 30, 2025
The `dump_settings` command currently prints out the raw `repr(...)`s for
defined functions, e.g.:

    "WIKI_CAN_ASSIGN": "<function CAN_ASSIGN at 0x74ce5e9b2020>",

In addition to being uninformative, these `at 0x74ce...` hashes change every
run, so they appear in the diff as having "changed" every time. With this
commit, here's what `dump_settings` will print out for a function instead:

    "WIKI_CAN_ASSIGN": {
        "module": "lms.djangoapps.course_wiki.settings",
        "qualname": "CAN_ASSIGN"
    },
jciasenza pushed a commit to jciasenza/edx-platform that referenced this pull request Feb 25, 2025
The `dump_settings` command currently prints out the raw `repr(...)`s for
defined functions, e.g.:

    "WIKI_CAN_ASSIGN": "<function CAN_ASSIGN at 0x74ce5e9b2020>",

In addition to being uninformative, these `at 0x74ce...` hashes change every
run, so they appear in the diff as having "changed" every time. With this
commit, here's what `dump_settings` will print out for a function instead:

    "WIKI_CAN_ASSIGN": {
        "module": "lms.djangoapps.course_wiki.settings",
        "qualname": "CAN_ASSIGN"
    },
UsamaSadiq pushed a commit that referenced this pull request May 14, 2025
The `dump_settings` command currently prints out the raw `repr(...)`s for
defined functions, e.g.:

    "WIKI_CAN_ASSIGN": "<function CAN_ASSIGN at 0x74ce5e9b2020>",

In addition to being uninformative, these `at 0x74ce...` hashes change every
run, so they appear in the diff as having "changed" every time. With this
commit, here's what `dump_settings` will print out for a function instead:

    "WIKI_CAN_ASSIGN": {
        "module": "lms.djangoapps.course_wiki.settings",
        "qualname": "CAN_ASSIGN"
    },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants