Xblock tutorial

279 views
Skip to first unread message

Alma Collado

unread,
Mar 24, 2014, 7:54:27 AM3/24/14
to edx-...@googlegroups.com
Hello,

I'm trying to learn how Xblocks work and I have found this tutorial: http://antoviaque.org/docs/edx/xblock/tutorial.html. I'm folllowing it, it's very interesting, but when I arrive to the point of "Registering an XBlock (entry point)" I get this error:

edxapp@precise64:~/edx-platform/XBlock$ ./manage.py runserver 0.0.0.0:8000
Validating models...

0 errors found
Django version 1.4.8, using settings 'workbench.settings'
Development server is running at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
2014-03-24 07:51:17,139 ERROR [xmodule.seq_module] Unable to load child when parsing Sequence. Continuing...
Traceback (most recent call last):
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/seq_module.py", line 141, in definition_from_xml
    child_block = system.process_xml(etree.tostring(child, encoding='unicode'))
AttributeError: 'WorkbenchRuntime' object has no attribute 'process_xml'
2014-03-24 07:51:17,143 ERROR [django.request] Internal Server Error: /
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 101, in get_response request.path_info)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 298, in resolve for pattern in self.url_patterns:
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 328, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 323, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module  __import__(name)
  File "/edx/app/edxapp/edx-platform/XBlock/workbench/urls.py", line 11, in <module>  init_scenarios()
  File "/edx/app/edxapp/edx-platform/XBlock/workbench/scenarios.py", line 67, in init_scenarios add_class_scenarios(class_name, cls)
  File "/edx/app/edxapp/edx-platform/XBlock/workbench/scenarios.py", line 51, in add_class_scenarios add_xml_scenario(scname, desc, xml)
  File "/edx/app/edxapp/edx-platform/XBlock/workbench/scenarios.py", line 32, in add_xml_scenario usage_id = runtime.parse_xml_string(xml, runtime.id_generator)
  File "/edx/app/edxapp/edx-platform/XBlock/xblock/runtime.py", line 500, in parse_xml_string  return self.parse_xml_file(StringIO(xml), id_generator)
  File "/edx/app/edxapp/edx-platform/XBlock/xblock/runtime.py", line 505, in parse_xml_file  usage_id = self._usage_id_from_node(root, None, id_generator)
  File "/edx/app/edxapp/edx-platform/XBlock/xblock/runtime.py", line 523, in _usage_id_from_node  block = block_class.parse_xml(node, self, keys, id_generator)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 668, in parse_xml  block = cls.from_xml(xml, runtime, id_generator)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/xml_module.py", line 296, in from_xml
    definition, children = cls.load_definition(definition_xml, system, def_id)  # note this removes metadata
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/xml_module.py", line 225, in load_definition
    definition, children = cls.definition_from_xml(definition_xml, system)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/seq_module.py", line 145, in definition_from_xml
    if system.error_tracker is not None:
AttributeError: 'WorkbenchRuntime' object has no attribute 'error_tracker'


I have googled it but I can't find what is the problem. Do you know if this tutorial is up to date? Maybe this is the reason...

Thanks!

Regards,
Alma.
















Xavier Antoviaque

unread,
Mar 24, 2014, 10:36:13 AM3/24/14
to edx-...@googlegroups.com
Hi Alma,
 
The API has changed recently and I need to update the tutorial - thank you for letting me know this is broken at the moment. (PRs for the tutorial are welcomed btw! ;p)
 
In the meantime, if you want a working example of a fairly similar XBlock, have a look at https://github.com/edx-solutions/xblock-brightcove -- it should be up to date with the latest API changes, but if you run into any issue with it let me know in this thread.
 
Enjoy XBlocks - they are still a bit in an alpha stage but they are a lot of fun to work with : )
 
--
Xavier.
 

Alma Collado

unread,
Mar 25, 2014, 11:20:23 AM3/25/14
to edx-...@googlegroups.com
Hi Xavier,

Thanks for the example, I haven't had any problems with that one, it works perfectly :)

Having the Brightcove Video Player Xblock I have checked again the Simplevideo XBlock and I think that the problem I had was because of the tag <vertical> in the workbench_scenarios(), I have changed this tag for the <vertical_demo> tag and now it works!

Thank you!

Regards,
Alma.

Xavier Antoviaque

unread,
Mar 25, 2014, 11:36:51 AM3/25/14
to edx-...@googlegroups.com
Cool, glad it worked!
 
Btw if you want to submit pull requests to fix the issue, that would be most welcome : )
 
 
--
Xavier.
 
Reply all
Reply to author
Forward
0 new messages