Skip to content

Conversation

@Qubad786
Copy link
Contributor

@Qubad786 Qubad786 commented Oct 31, 2016

TNL-5721

Description

Conditional modules with staff only required module(s), when accessed as student, caused uncatched exception while rendering it in mako template. Now, we are checking for the required_module before using the data from it in string interpolation.

Sandbox

  • on ticket

Testing

  • Unit tests have been added.

Screenshot

Conditional with three required modules with one of them having staff access.

Reviewers

If you've been tagged for review, please check your corresponding box once you've given the 👍.

Post-review

  • Rebase and squash commits

if module:
result.append(module)

return result
Copy link
Contributor

Choose a reason for hiding this comment

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

what is result is empty?

@Qubad786 Qubad786 changed the title [WIP] TNL-5721 – Fix check source module access before appending it to required modules TNL-5721 – Fix check source module access before appending it to required modules Nov 4, 2016
@adampalay
Copy link
Contributor

adampalay commented Nov 4, 2016

@Qubad786 can you give steps to create such a conditional module in a course? I'd like to be able to test this locally

<p class="conditional-message">${_message(reqm, message)}</p>
% else:
<p class="conditional-message">
You do not have access to this dependency module. Please ask course staff to grant the access.
Copy link
Contributor

Choose a reason for hiding this comment

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

string should be i18n'd. Also, I'd lose the second sentence. Just do "You do not have access to this dependency module."

@Qubad786 Qubad786 force-pushed the mrehan/tnl-5721-nonetype-no-attr-course-id branch from 438f444 to 4b67cb3 Compare November 7, 2016 08:45
@Qubad786
Copy link
Contributor Author

Qubad786 commented Nov 7, 2016

@adampalay , I wasn't able to create conditional module from the instructions in https://github.com/edx/edx-platform/pull/11710. I've imported on local. There are plently of conditionals in that course.

I could build sandbox and setup a course for testing but http://jenkins.edx.org:8080/view/Ansible/job/ansible-provision/build?delay=0sec does not seem to be working for me. I am filing an IT support ticket.

@attiyaIshaque
Copy link
Contributor

@Qubad786 Sandbox link is now working. If it's not working for you, I'd like to make a sandbox for your branch.

@Qubad786
Copy link
Contributor Author

Qubad786 commented Nov 7, 2016

@attiyaIshaque still no luck for me, it'd be great if you can build one for this branch.

# So just log and return false.
log.warn('Error in conditional module: \
required module {module} has no {module_attr}'.format(module=module, module_attr=attr_name))
if module is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

why could a module be None here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

get_module has been used in required_modules which may return None if requester does not have access to that module – see more.

Copy link
Contributor

Choose a reason for hiding this comment

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

can you just include a comment to that effect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough, will do that.

@attiyaIshaque
Copy link
Contributor

attiyaIshaque commented Nov 8, 2016

@Qubad786 Sandbox is ready.

@Qubad786
Copy link
Contributor Author

Qubad786 commented Nov 8, 2016

jenkins run js

@Qubad786
Copy link
Contributor Author

Qubad786 commented Nov 8, 2016

Thanks for the sandbox @attiyaIshaque.

@Qubad786
Copy link
Contributor Author

Qubad786 commented Nov 8, 2016

@adampalay, @attiyaIshaque just set up a conditional course, courseware link on the ticket.

@Qubad786 Qubad786 force-pushed the mrehan/tnl-5721-nonetype-no-attr-course-id branch 2 times, most recently from cc8652b to c7d2ce4 Compare November 8, 2016 07:43
@attiyaIshaque
Copy link
Contributor

@Qubad786 Code looks perfect to me. I have also tested on the sandbox.
Looks goods once tests are passing 👍

@Qubad786 Qubad786 force-pushed the mrehan/tnl-5721-nonetype-no-attr-course-id branch from c7d2ce4 to 3bd4698 Compare November 9, 2016 11:00
@Qubad786
Copy link
Contributor Author

Qubad786 commented Nov 9, 2016

jenkins run bokchoy

@Qubad786
Copy link
Contributor Author

Qubad786 commented Nov 9, 2016

jenkins run lettuce

Copy link
Contributor

@adampalay adampalay left a comment

Choose a reason for hiding this comment

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

Minor comment, otherwise 👍

@Qubad786 Qubad786 force-pushed the mrehan/tnl-5721-nonetype-no-attr-course-id branch from 0fff215 to c7364a0 Compare November 9, 2016 15:12
@Qubad786 Qubad786 merged commit c873be0 into master Nov 9, 2016
@Qubad786 Qubad786 deleted the mrehan/tnl-5721-nonetype-no-attr-course-id branch November 9, 2016 17:20
@jibsheet
Copy link
Contributor

jibsheet commented Nov 9, 2016

Yay!

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.

5 participants