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

Add support for XBlock 2.0 #151

Merged
merged 7 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion acid/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .acid import AcidBlock, AcidParentBlock, AcidAside

__version__ = '0.2.1'
__version__ = '0.3.0'
25 changes: 18 additions & 7 deletions acid/acid.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
"""An XBlock checking container/block relationships for correctness."""

import logging
import pkg_resources
import random

import pkg_resources
import webob
from lazy import lazy
from mako.lookup import TemplateLookup

from xblock.core import XBlock, XBlockAside
from xblock.fields import Scope, Dict
from xblock.fragment import Fragment
import six
from xblock.fields import Dict, Scope

try:
from web_fragments.fragment import Fragment
irtazaakram marked this conversation as resolved.
Show resolved Hide resolved
except:
from xblock.fragment import Fragment # For backward compatibility with quince and earlier.


def generate_fields(cls):
Expand Down Expand Up @@ -335,8 +338,16 @@ def fallback_view(self, view_name, context=None): # pylint: disabl
rendered_children=(fragment.content for fragment in rendered_children),
local_resource_url=self.runtime.local_resource_url(self, 'public/test_data.json'),
))
frag.add_frag_resources(acid_fragment)
frag.add_frags_resources(rendered_children)
try:
frag.add_fragment_resources(acid_fragment)

for rendered_child in rendered_children:
frag.add_fragment_resources(rendered_child)

except: # Add fragment resources using deprecated xblock.fragment for backward compatibility for quince and earlier releases
frag.add_frag_resources(acid_fragment)
frag.add_frags_resources(rendered_children)

frag.add_javascript(self.resource_string('static/js/acid_parent.js'))
frag.initialize_js('AcidParentBlock')
return frag
Expand Down