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 a default XML serialization if the 'data' field is empty or None. So... #413

Merged
merged 0 commits into from
Jul 17, 2013

Conversation

chrisndodge
Copy link
Contributor

...me XModules now - like video XModule - do not have XML set in the 'data' field

@chrisndodge
Copy link
Contributor Author

@peter-fogg @cpennington can you review

@cpennington this is what we'd need for a hotfix to prod

# certain XModules do not have a payload in 'data' any longer, e.g. the Video XModule
# so in that case, we serialize it out simply as an empty XML element named after
# the category
return etree.fromstring('<{0} />'.format(self.location.category))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this edge case handling makes sense, just to avoid the RawDescriptor blowing up in other cases where data is empty (although it means that definition_to_xml and definition_from_xml aren't inverses, since parsing this xml will end up with data not being None).

On second thought... I think maybe I'd prefer to have the video module just define definition_to_xml that returns an empty xml node, since it's the code that expects to have an empty data attribute, and leave the RawDescriptor expecting to have non-empty data.

@chrisndodge
Copy link
Contributor Author

@cpennington @peter-fogg addressed comments

@peter-fogg
Copy link
Contributor

👍 Looks good.

@cpennington
Copy link
Contributor

👍, but a) please squash the commits, and b) please make a new pull request based on the latest release, as per the hotfix process

@chrisndodge
Copy link
Contributor Author

Hotfix PR onto 'release' at: https://github.com/edx/edx-platform/pull/420

Override the base implementation. We don't actually have anything in the 'data' field
(it's an empty string), so we just return a simple XML element
"""
return etree.fromstring('<video />')
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that ideally this would actually just use etree.Element('video'), rather than parsing a string to generate an element.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure thing. Can I do this post merge?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's do it in this PR, but the HF will go through as is.

-Cale

On Wed, Jul 17, 2013 at 1:06 PM, chrisndodge notifications@github.comwrote:

In common/lib/xmodule/xmodule/video_module.py:

@@ -128,6 +128,13 @@ def from_xml(cls, xml_data, system, org=None, course=None):
_parse_video_xml(video, xml_data)
return video

  • def definition_to_xml(self, resource_fs):
  •    """
    
  •    Override the base implementation. We don't actually have anything in the 'data' field
    
  •    (it's an empty string), so we just return a simple XML element
    
  •    """
    
  •    return etree.fromstring('<video />')
    

sure thing. Can I do this post merge?


Reply to this email directly or view it on GitHubhttps://github.com/edx/edx-platform/pull/413/files#r5247592
.

Copy link
Contributor

Choose a reason for hiding this comment

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

In fact, lets hold off on merging this PR until we've got the HF through
and merged into master (since that'll shrink the changes in this PR
significantly).

-Cale

On Wed, Jul 17, 2013 at 1:16 PM, Calen Pennington cale@edx.org wrote:

Let's do it in this PR, but the HF will go through as is.

-Cale

On Wed, Jul 17, 2013 at 1:06 PM, chrisndodge notifications@github.comwrote:

In common/lib/xmodule/xmodule/video_module.py:

@@ -128,6 +128,13 @@ def from_xml(cls, xml_data, system, org=None, course=None):
_parse_video_xml(video, xml_data)
return video

  • def definition_to_xml(self, resource_fs):
  •    """
    
  •    Override the base implementation. We don't actually have anything in the 'data' field
    
  •    (it's an empty string), so we just return a simple XML element
    
  •    """
    
  •    return etree.fromstring('<video />')
    

sure thing. Can I do this post merge?


Reply to this email directly or view it on GitHubhttps://github.com/edx/edx-platform/pull/413/files#r5247592
.

@chrisndodge chrisndodge merged commit 96a9d74 into master Jul 17, 2013
chrisrossi pushed a commit to jazkarta/edx-platform that referenced this pull request Mar 31, 2014
- don't call has_access directly from template, pass a staff_access variable instead
yokose-ks added a commit to nttks/edx-platform that referenced this pull request Oct 15, 2015
diegomillan pushed a commit to eduNEXT/edx-platform that referenced this pull request Sep 14, 2016
…timeouts

Temporarily add analytics 5s timeout
xavierchan pushed a commit to xavierchan/edx-platform-1 that referenced this pull request May 24, 2019
add program tencent video id api
yoann-mroz pushed a commit to weuplearning/edx-platform that referenced this pull request Nov 30, 2020
andrey-canon pushed a commit to eduNEXT/edx-platform that referenced this pull request Jan 19, 2021
ju/ednx/FFI-8: Adding CircleCI 2 and making tests PASS
Sujeet1379 pushed a commit to chandrudev/edx-platform that referenced this pull request Nov 17, 2022
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.

3 participants