Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨(core) change field to store configuration name and improve fallback #7

Closed
wants to merge 2 commits into from

Conversation

rmoch
Copy link
Contributor

@rmoch rmoch commented Oct 18, 2018

Use 'lti_id' field instead of 'description' because it will ease course
based configuration fallback if this xblock is not installed

Use 'lti_id' field instead of 'description' because it will ease course
based configuration fallback if this xblock is not installed
README.md Show resolved Hide resolved
return conf[0]
else:
logger.warning(
"Configuration '{name}' does not exist".format(name=name))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be an "else" clause to the "for" loop and raise an ConfigurationError as well because if the "for" loop completes normally, it means that we did not return and so the "lti_consumer" conf was not found.

logger.warning(
"Configuration '{name}' does not exist".format(name=name))
else:
logger.warning("CONFIGURABLE_XBLOCKS_SETTINGS settings are not set")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's break and raise a ConfigurationError instead of just logging a warning because it is the admin sys reponsibility to fix it before starting the server. WDYT?

if conf:
return conf[0]
return None
if getattr(settings, "CONFIGURABLE_XBLOCKS_SETTINGS"):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add a defaults.py file to this project to define the default setting (i.e act as a normal lti xblock):

"""Default settings for the ``core`` app of the Marsha project."""
from django.conf import settings


CONFIGURABLE_XBLOCKS_SETTINGS = getattr(
    settings, "CONFIGURABLE_XBLOCKS_SETTINGS", {
        "components": [{
            "module": "lti_consumer",
            "base_class": "ConfigurableLtiConsumerXBlock",
            "subclasses": [{
                "name": "Generic",
                "display": "Generic LTI xblock",
                "default_values": {
                    "description": "Generic",
                    "ask_to_send_username": True,
                    "ask_to_send_email": True
                }
            }]
        }]
    }
)

This would allow us to remove the default settings in openfun/openedx-docker

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, then it implies that this configuration becomes specific to this xblock.
the components list becomes useless

README.md Show resolved Hide resolved
README.md Show resolved Hide resolved
Developers working on this project need an easy way to setup a
development environment for this xblock. Thanks to docker and
docker-compose, we are now able to easily bootstrap such environment in
an openedx context.
@rmoch rmoch closed this Oct 23, 2018
@rmoch rmoch deleted the change-configuration-name-field2 branch October 23, 2018 16:24
@rmoch rmoch restored the change-configuration-name-field2 branch October 23, 2018 16:24
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.

None yet

3 participants