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

Fix 500 errors caused by templates #395

Merged
merged 3 commits into from
May 10, 2017
Merged

Conversation

zelima
Copy link
Contributor

@zelima zelima commented May 10, 2017

  • includes small helper function that validates descriptor - tested
  • logic updated and test included to check invalid licenses

refs #355

@zelima zelima requested a review from anuveyatsu May 10, 2017 07:42

def validate_for_template(descriptor):
'''
Cheks if descriptor fields have expected type for template Eg:
Copy link
Contributor

Choose a reason for hiding this comment

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

small typo: "Checks ..."

Copy link
Contributor

@anuveyatsu anuveyatsu May 10, 2017

Choose a reason for hiding this comment

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

Probably it's better to rewrite:
"This function validates field types in the descriptor, e.g., licenses property should be a list."

def test_validate_for_jinja_modifies_descriptor_if_licenses_is_dict(self):
self.descriptor['licenses'] = {'url': 'test/url', 'type': 'Test'}
descriptor = validate_for_template(self.descriptor)
self.assertEqual(descriptor['license'], 'Test')
Copy link
Contributor

Choose a reason for hiding this comment

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

so licenses (plural) then it is a list, and if license singular then it is a string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

Copy link
Contributor

@anuveyatsu anuveyatsu left a comment

Choose a reason for hiding this comment

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

looks great, just small comments

@zelima zelima merged commit dd984f7 into master May 10, 2017
@zelima zelima deleted the fix/500-caused-by-templates branch May 10, 2017 12:49
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.

2 participants