Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
825621a3
Commit
825621a3
authored
8 years ago
by
David Ormsbee
Committed by
GitHub
8 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14589 from edx/ormsbee/faster_startup_pynliner
LMS startup optimization: lazy load pynliner
parents
5f090e09
b3a62bd2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
+7
-1
openedx/core/djangoapps/credit/email_utils.py
+7
-1
No files found.
openedx/core/djangoapps/credit/email_utils.py
View file @
825621a3
...
@@ -5,7 +5,6 @@ This file contains utility functions which will responsible for sending emails.
...
@@ -5,7 +5,6 @@ This file contains utility functions which will responsible for sending emails.
import
os
import
os
import
logging
import
logging
import
pynliner
import
urlparse
import
urlparse
import
uuid
import
uuid
import
HTMLParser
import
HTMLParser
...
@@ -145,6 +144,13 @@ def with_inline_css(html_without_css):
...
@@ -145,6 +144,13 @@ def with_inline_css(html_without_css):
with
open
(
css_filepath
,
"r"
)
as
_file
:
with
open
(
css_filepath
,
"r"
)
as
_file
:
css_content
=
_file
.
read
()
css_content
=
_file
.
read
()
# pynliner imports cssutils, which has an expensive initialization. All
# told, it can account for 15-20% of "fast" LMS startup (without asset
# compilation). So we're going to load it locally here so that we delay
# that one-time hit until we actually do the (rare) operation that is
# sending a credit notification email.
import
pynliner
# insert style tag in the html and run pyliner.
# insert style tag in the html and run pyliner.
html_with_inline_css
=
pynliner
.
fromString
(
'<style>'
+
css_content
+
'</style>'
+
html_without_css
)
html_with_inline_css
=
pynliner
.
fromString
(
'<style>'
+
css_content
+
'</style>'
+
html_without_css
)
return
html_with_inline_css
return
html_with_inline_css
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment