Skip to content

TNL-5721 – Fix check source module access before appending it to required modules - #13868

Merged
Qubad786 merged 1 commit into
masterfrom
mrehan/tnl-5721-nonetype-no-attr-course-id
Nov 9, 2016
Merged

TNL-5721 – Fix check source module access before appending it to required modules#13868
Qubad786 merged 1 commit into
masterfrom
mrehan/tnl-5721-nonetype-no-attr-course-id

Conversation

@Qubad786

@Qubad786 Qubad786 commented Oct 31, 2016

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

adampalay commented Nov 4, 2016

Copy link
Copy Markdown
Contributor

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

Comment thread lms/templates/conditional_module.html Outdated
<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
Copy Markdown
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

Qubad786 commented Nov 7, 2016

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown

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

@Qubad786

Qubad786 commented Nov 7, 2016

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

attiyaIshaque commented Nov 8, 2016

Copy link
Copy Markdown

@Qubad786 Sandbox is ready.

@Qubad786

Qubad786 commented Nov 8, 2016

Copy link
Copy Markdown
Contributor Author

jenkins run js

@Qubad786

Qubad786 commented Nov 8, 2016

Copy link
Copy Markdown
Contributor Author

Thanks for the sandbox @attiyaIshaque.

@Qubad786

Qubad786 commented Nov 8, 2016

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown

@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

Qubad786 commented Nov 9, 2016

Copy link
Copy Markdown
Contributor Author

jenkins run bokchoy

@Qubad786

Qubad786 commented Nov 9, 2016

Copy link
Copy Markdown
Contributor Author

jenkins run lettuce

@adampalay adampalay left a comment

Copy link
Copy Markdown
Contributor

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

jibsheet commented Nov 9, 2016

Copy link
Copy Markdown
Contributor

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.

4 participants