Skip to content

Commit

Permalink
chore: quality fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Sep 20, 2024
1 parent fa25ea6 commit 4209a37
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions platform_plugin_aspects/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ def ready(self):
from platform_plugin_aspects.extensions import ( # pylint: disable=unused-import, import-outside-toplevel
filters,
)
from platform_plugin_aspects.xblock_aside import ( # pylint: disable=unused-import, import-outside-toplevel
AspectsAside
from platform_plugin_aspects.xblock_aside import ( # pylint: disable=unused-import, import-outside-toplevel
AspectsAside,
)
3 changes: 1 addition & 2 deletions platform_plugin_aspects/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.db import transaction
from django.db.models.signals import post_delete, post_save
from django.dispatch import Signal, receiver
from opaque_keys import InvalidKeyError

from platform_plugin_aspects.sinks import (
CourseEnrollmentSink,
Expand All @@ -17,8 +18,6 @@
)
from platform_plugin_aspects.utils import get_model

from opaque_keys import InvalidKeyError

try:
from openedx.core.djangoapps.user_api.accounts.signals import USER_RETIRE_LMS_MISC
except ImportError:
Expand Down
16 changes: 8 additions & 8 deletions platform_plugin_aspects/xblock_aside.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import logging

import pkg_resources
from common.djangoapps.edxmako.shortcuts import render_to_string
from django.template import Context, Template
from django.utils import translation
from web_fragments.fragment import Fragment
from common.djangoapps.edxmako.shortcuts import render_to_string
from xblock.core import XBlock, XBlockAside
from xblock.fields import Scope, String
from xblock.utils.resources import ResourceLoader
Expand All @@ -18,6 +18,7 @@

from platform_plugin_aspects.xblock import ResourceLoader


@XBlock.needs("user")
@XBlock.needs("i18n")
class AspectsAside(XBlockAside):
Expand All @@ -29,7 +30,9 @@ def _get_block(self):
"""
Get the block wrapped by this aside.
"""
from xmodule.modulestore.django import modulestore # pylint: disable=import-error, import-outside-toplevel
from xmodule.modulestore.django import (
modulestore, # pylint: disable=import-error, import-outside-toplevel
)

return modulestore().get_item(self.scope_ids.usage_id.usage_key)

Expand All @@ -42,11 +45,9 @@ def student_view_aside(self, block, context): # pylint: disable=unused-argument
depending on the context.
"""
logger.info(f"Class name {block.__class__.__name__}")
if block.__class__.__name__.replace("WithMixins", "") in ['ProblemBlock']:
if block.__class__.__name__.replace("WithMixins", "") in ["ProblemBlock"]:
frag = Fragment()
context.update({
"xblock_id": self.scope_ids.usage_id.usage_key
})
context.update({"xblock_id": self.scope_ids.usage_id.usage_key})
frag.add_content(self.render_template("static/html/example.html", context))
# frag.add_javascript_url(self._get_studio_resource_url('/js/xblock_asides/structured_tags.js'))
# frag.initialize_js('StructuredTagsInit')
Expand All @@ -63,7 +64,6 @@ def should_apply_to_block(cls, block):
# logger.info(block.__dict__)
return True


def render_template(self, template_path, context=None) -> str:
"""
Render a template with the given context.
Expand All @@ -79,4 +79,4 @@ def render_template(self, template_path, context=None) -> str:
"""
return loader.render_django_template(
template_path, context, i18n_service=self.runtime.service(self, "i18n")
)
)

0 comments on commit 4209a37

Please sign in to comment.