InvalidScopeError when using custom Scope in Field
まだ誰も着手していません。
評価
調査の方向性
student_view で Table-XBlock/table/table.py のカスタム Scope の失敗を再現し、その後 xblock/fields.py::get と xblock/field_data.py::_field_data を通じてフィールドアクセスを追跡します。定義済みのスコープは機能するのに、カスタム Scope が InvalidScopeError を発生させる理由を特定します。student_view でその例外なしにフィールドを読み取れるようになり、リポジトリに適切なテスト場所がある場合はリグレッションテストでカバレッジを追加できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
This is the code I'm currently using to try to do this:
tableStructure = Dict(default={}, scope=Scope(UserScope.NONE, BlockScope.TYPE), help="Help Text")
Whenever I attempt to read the value of the Field, an InvalidScopeError is raised. This doesn't seem to happen with the other predefined Scopes (e.g Scope.content). Furthermore, the error only seems to happen if I attempt to access the value of the Field from within the student_view.
Here is a stack trace:
2014-09-10 10:15:13,883 WARNING 2366 [contentstore.views.preview] preview.py:223 - Unable to render student_view for <TableXBlockWithMixins @4644 rerandomize='never', graded=False, annotation_token_secret='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', giturl=None, source_file=None, course_edit_method='Studio', default_tab=None, showanswer='finished', display_name='Table XBlock', video_speed_optimizations=True, chrome=None, showColumns=[], due=None, start=datetime.datetime(2030, 1, 1, 0, 0, tzinfo=<UTC>), tags=[], days_early_for_beta=None, max_attempts=None, text_customization={}, userRows={}, parent=None, format=None, matlab_api_key=None, xqa_key=None, annotation_storage_url='http://your_annotation_storage.com', use_latex_compiler=False, extended_due=None, static_asset_path='', hide_from_toc=False, count=0, name=None, ispublic=None, user_partitions=[], graceperiod=None, visible_to_staff_only=False, tableStructure=???>
Traceback (most recent call last):
File "/edx/app/edxapp/edx-platform/cms/djangoapps/contentstore/views/preview.py", line 221, in get_preview_fragment
fragment = module.render(preview_view, context)
File "/edx/app/edxapp/venvs/edxapp/src/xblock/xblock/core.py", line 289, in render
return self.runtime.render(self, view, context)
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1166, in render
return block.xmodule_runtime.render(to_render, view_name, context)
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1029, in render
return super(MetricsMixin, self).render(block, view_name, context=context)
File "/edx/app/edxapp/venvs/edxapp/src/xblock/xblock/runtime.py", line 586, in render
frag = view_fn(context)
File "/edx/app/edxapp/edx-platform/Table-XBlock/table/table.py", line 68, in student_view
tab = self.tableStructure
File "/edx/app/edxapp/venvs/edxapp/src/xblock/xblock/fields.py", line 369, in __get__
if xblock._field_data.has(xblock, self.name):
File "/edx/app/edxapp/venvs/edxapp/src/xblock/xblock/field_data.py", line 174, in has
return self._field_data(block, name).has(block, name)
File "/edx/app/edxapp/venvs/edxapp/src/xblock/xblock/field_data.py", line 153, in _field_data
raise InvalidScopeError(scope)
InvalidScopeError: ScopeBase(user=UserScope.NONE, block=BlockScope.TYPE, name=u'UserScope.NONE_BlockScope.TYPE')
Traceback (most recent call last):
File "/usr/lib/python2.7/logging/handlers.py", line 810, in emit
self.socket.sendto(msg, self.address)
TypeError: getsockaddrarg: AF_INET address must be tuple, not NoneType
Logged from file preview.py, line 223
[10/Sep/2014 10:15:13] "GET /xblock/i4x://ADL/ADL101/table/ac25938d0f7941878430fbf40c501747/student_view?_=1410358513743 HTTP/1.1" 200 1686
- 主要言語
- Python
- スター
- 470
- フォーク
- 231
- 平均マージ
- 2日 14時間
- マージ済み PR(30日)
- 7
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
openedx/XBlock のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
-
performance
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
[DEPR]: Support for XBlock Runtimes with raw string scope IDs対応中かも @salman2013 が 211 日前に担当しました。 オープンdepr
似ている issue
-
first
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AcademySoftwareFoundation/rmtc#54 · コメント 1 件 ·
-
feature/cohorts feature/feature-flags team/feature-flags
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
License examples/ as MIT対応中かも @PGrayCS が今日担当しました。 オープンdocumentation enhancement example good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
speedyk-005/yasbd-lib#383 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
interactions-py/interactions.py#1827 ·
-
Managed start can fail when OpenVMM reads its control capability before NVX writes it対応中かも @ppenna が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信