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

[STUD-406] Fix/cdodge/unescape quote strings #387

Merged
merged 6 commits into from
Jul 12, 2013

Conversation

chrisndodge
Copy link
Contributor

No description provided.

Chris Dodge added 3 commits July 12, 2013 11:13
@chrisndodge
Copy link
Contributor Author

@cpennington @cahrens can you review. Cale, I know we had discussed cleaning up more of the unnecessarily nested code in the XML exporting in xml_module.py, but all I have time to get done today is the immediate tactical fix and I'd like this to be in the next release candidate.

if not isinstance(value, basestring):
raise Exception('Value {0} is not of type basestring!'.format(value))

return value
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 I'd rather have this logic just live in serialize_field, rather than having a lambda containing an if clause in the AttrMap

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe @cahrens can comment on this but I wasn't sure if we want this behavior globally or just on the 'export' feature. That's why I separated the helper functions.

If serialize_field is current - and remain so in the future - only called on export use cases, then I'm fine with moving the logic.

Copy link
Contributor

Choose a reason for hiding this comment

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

serialize_field should really only be for serializing fields to xml, which is exactly when we want this behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Christina, can you confirm this? If so, then I can refactor this - as well
as updating the existing test cases.

On Fri, Jul 12, 2013 at 12:22 PM, Calen Pennington <notifications@github.com

wrote:

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

 return json.dumps(value, cls=EdxJSONEncoder)

+def serialize_string_literal(
value):

  • """
  • Assert that the value is a base string and - if it is - simply return it
  • """
  • if not isinstance(value, basestring):
  •    raise Exception('Value {0} is not of type basestring!'.format(value))
    
  • return value

serialize_field should really only be for serializing fields to xml,
which is exactly when we want this behavior.


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

Copy link

Choose a reason for hiding this comment

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

Yes, I agree this should be within serialize_field. It will also make the unit tests represent how we actually serialize strings.

@cahrens
Copy link

cahrens commented Jul 12, 2013

@chrisndodge I agree about putting the String-specific serialization within the serialize_field method.

@chrisndodge
Copy link
Contributor Author

@cpennington @cahrens ok refactored into that single serialize_field() function

@cahrens
Copy link

cahrens commented Jul 12, 2013

👍 (once tests pass). BTW, I did not check out the branch and run it.

chrisndodge pushed a commit that referenced this pull request Jul 12, 2013
[STUD-406] Fix/cdodge/unescape quote strings
@chrisndodge chrisndodge merged commit 8f74342 into master Jul 12, 2013
@chrisndodge chrisndodge deleted the fix/cdodge/unescape-quote-strings branch August 8, 2013 18:39
e-kolpakov referenced this pull request in open-craft/edx-platform Mar 3, 2015
…-followed-posts

Fixed cohort visibility label when viewing "Posts I'm following"
kawaguchi-ks added a commit to nttks/edx-platform that referenced this pull request Oct 6, 2015
Merge pull request openedx#376 from kawaguchi-ks/develop/cypress/fix-trans-309
diegomillan pushed a commit to eduNEXT/edx-platform that referenced this pull request Sep 14, 2016
* stv/test/tabs:
  Remove check for course tab uniqueness
xavierchan pushed a commit to xavierchan/edx-platform-1 that referenced this pull request May 20, 2019
MoisesGSalas pushed a commit to eduNEXT/edx-platform that referenced this pull request Jan 12, 2022
…-patch-django-mysql

FAL-2248: Monkey-patch django db introspection to avoid performance issues
jbcurtin pushed a commit to jbcurtin/edx-platform that referenced this pull request Jan 31, 2022
…-patch-django-mysql

FAL-2248: Monkey-patch django db introspection to avoid performance issues
(cherry picked from commit 213b1dc)
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