Skip to content

Ziafazal/wl-328 multi-tenancy support in Comprehensive Theming - #11613

Merged
mattdrayer merged 1 commit into
masterfrom
ziafazal/WL-328
Mar 14, 2016
Merged

Ziafazal/wl-328 multi-tenancy support in Comprehensive Theming#11613
mattdrayer merged 1 commit into
masterfrom
ziafazal/WL-328

Conversation

@ziafazal

Copy link
Copy Markdown
Contributor

@mattdrayer @saleem-latif this PR has the work I have done so far to support multi-tenancy in Comprehensive theming. This PR has accomplished these objectives.

  1. Update LMS to use Django Sites framework (WL-326)
  2. Add SiteTheme model to LMS (WL-328)
  3. Multi-tenancy support for Mako templates
  4. Change Comprehensive Theming Behaviour for static assets to support Multi-Tenancy (WL-321)
  5. Updated existing Comprehensive Theming and IS_EDX_DOMAIN tests

@mattdrayer

Copy link
Copy Markdown
Contributor

@felipemontoya @mtyaka FYI

@mattdrayer

Copy link
Copy Markdown
Contributor

@natea, FYI

@mattdrayer

Copy link
Copy Markdown
Contributor

jenkins run all

@mattdrayer

Copy link
Copy Markdown
Contributor

Closing and re-opening this PR to try and fix the broken Jenkins checks

@mattdrayer mattdrayer closed this Feb 22, 2016
@mattdrayer mattdrayer reopened this Feb 22, 2016
Comment thread common/djangoapps/edxmako/paths.py Outdated
def get_template(self, uri):
"""
Overridden method which will hand-off the template lookup to the microsite subsystem
Overridden method which will hand-off the template lookup to the theming subsystem

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 we add a little bit more here about how this works, ie, the scenarios -- maybe cover the use cases where the lookup would not be necessary, as well as the valid case for the try, as well as the invalid case which would trigger the except.

@mattdrayer

Copy link
Copy Markdown
Contributor

@ziafazal -- I've completed an initial pass -- overall I think this PR is on the right track and happy to see it -- we definitely need a lot more in the way of tests, but that's just a matter of time+energy. I think it would be good for @saleem-latif to assist with writing the tests because he'll be assuming responsibility for the theming enhancements going forward. Happy to take another look after you've addressed feedback and made changes.

I mentioned to @bradenmacdonald that I would tag him on this PR earlier today, so going ahead and doing that now.

@mattdrayer

Copy link
Copy Markdown
Contributor

@andy-armstrong, FYI on this PR

Comment thread common/djangoapps/edxmako/paths.py Outdated
def get_template(self, uri):
"""
Overridden method which will hand-off the template lookup to the microsite subsystem
Overridden method do template lookup database or in white labe site theme.

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.

"Overridden method for locating a template in either the database or the site theme."

Comment thread lms/envs/common.py Outdated

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.

@ziafazal If you are removing this setting then this usage should also be removed:
https://github.com/edx/edx-platform/blob/master/lms/djangoapps/course_wiki/views.py#L62

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.

@symbolist I'm not sure we should remove that usage so much as protect against the scenario where the value is not available in settings -- for example:

if hasattr(settings, "SITE_ID") and site_id != str(settings.SITE_ID):

Thoughts?

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.

@mattdrayer It looks like this code is going to need a bit of refactoring. If the SITE_ID is not defined (which given that this was the only instance in settings, is never going to be), get_current() is going to throw a ImproperlyConfigured exception instead of DoesNotExist exception and code will not even go into this except block.

https://github.com/django/django/blob/1.8.9/django/contrib/sites/models.py#L50-L69

@mattdrayer

Copy link
Copy Markdown
Contributor

@felipemontoya @mtyaka @bradenmacdonald @andy-armstrong @ziafazal @saleem-latif -- I've done some housecleaning on the branch in order to resolve some conflicts and squash the intermediate commits. The PR is back open for business now.

Ideally we would merge this change set on Monday (end of current sprint). So, it would be great to have all remaning reviews+feedback submitted by Sunday evening, in order to give us time to address any additional concerns.

@mattdrayer

Copy link
Copy Markdown
Contributor

jenkins run python

@saleem-latif

Copy link
Copy Markdown
Contributor

jenkins run lettuce

@saleem-latif

Copy link
Copy Markdown
Contributor

jenkins run python

1 similar comment
@saleem-latif

Copy link
Copy Markdown
Contributor

jenkins run python

@saleem-latif

Copy link
Copy Markdown
Contributor

jenkins run python

2 similar comments
@saleem-latif

Copy link
Copy Markdown
Contributor

jenkins run python

@saleem-latif

Copy link
Copy Markdown
Contributor

jenkins run python

@symbolist

Copy link
Copy Markdown
Contributor

@saleem-latif One of the tests is causing the suite to fail with a segmentation fault. Re-running will not fix that. I recommend running the whole suite locally with verbose mode to isolate the issue.

@saleem-latif

Copy link
Copy Markdown
Contributor

jenkins run lettuce

1 similar comment
@saleem-latif

Copy link
Copy Markdown
Contributor

jenkins run lettuce

@andy-armstrong

Copy link
Copy Markdown
Contributor

👍 from me. Nice work @saleem-latif and @ziafazal.

@mattdrayer

Copy link
Copy Markdown
Contributor

Fantastic, thanks much, @andy-armstrong -- I'm going to squash the commits and merge the branch!

@mattdrayer

Copy link
Copy Markdown
Contributor

jenkins run python

@mattdrayer

Copy link
Copy Markdown
Contributor

jenkins run all

3 similar comments
@mattdrayer

Copy link
Copy Markdown
Contributor

jenkins run all

@mattdrayer

Copy link
Copy Markdown
Contributor

jenkins run all

@jzoldak

jzoldak commented Mar 14, 2016

Copy link
Copy Markdown
Contributor

jenkins run all

ziafazal: improvements need for multi-tenancy
ziafazal: fixed broken tests
ziafazal: no need to add setting in test.py
ziafazal: added hostname validation
ziafazal: changes after feedback from mattdrayer
ziafazal: fixed branding and microsite broken tests
ziafazal: make STATICFILES_DIRS to list
ziafazal: added theme directory to mako lookup for tests
ziafazal: added more protection in test_util
saleem-latif: Enable SCSS Overrides for Comprehensive Theming
saleem-latif: Incoporate feedback changes, Correct test failures, add tests and enable theming for django templates
saleem-latif: Correct errors in python tests
mattdrayer: Fix invalid release reference
mattdrayer: Update django-wiki reference to latest release
@mattdrayer

Copy link
Copy Markdown
Contributor

Wow, that was an ex-CI-ting adventure :) Finally the build is green again, so I am going ahead with the merge.

mattdrayer added a commit that referenced this pull request Mar 14, 2016
Ziafazal/wl-328 multi-tenancy support in Comprehensive Theming
@mattdrayer
mattdrayer merged commit a25caf3 into master Mar 14, 2016
settings.MAKO_TEMPLATES['main'].insert(0, themes_dir)

for theme_dir in os.listdir(themes_dir):
staticfiles_dir = os.path.join(themes_dir, theme_dir, get_project_root_name(), "static")

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.

@mattdrayer @ziafazal I think we need to remove theme_dir from the line above, otherwise we end up with paths like /edx/app/edxapp/edx-platform/themes/edx.org/cms/lms/static.

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.

Scratch that. I think it is get_project_root_name that needs to go.

@jzoldak

jzoldak commented Mar 15, 2016

Copy link
Copy Markdown
Contributor

@benpatterson @mattdrayer
I'm still investigating, but I wanted to give you a heads up as quickly as possible.
When this code was merged to master, it dropped our sitespeed score from 76 to 72.
I'll add details of findings to WL-328

@mattdrayer

Copy link
Copy Markdown
Contributor

@jzoldak please add details to WL-325 instead, if you wouldn't mind -- is there a way for us to know ahead of merging to master about an impact to the sitespeed score?

@jzoldak

jzoldak commented Mar 15, 2016

Copy link
Copy Markdown
Contributor

@mattdrayer Sure, I just added comments to WL-325.

We don't have sitespeed automatically running for PRs yet, that's still an epic on the backlog PERF-185.
You'd need to proactively test out your changes using the browser-profiling-sitespeed job on jenkins

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.

8 participants