Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Adrián Ribao
Cartero
Commits
32465f9f
Commit
32465f9f
authored
Dec 02, 2013
by
Adrián Ribao
Browse files
changed the way inline css is generated
parent
87aa874e
Changes
1
Hide whitespace changes
Inline
Side-by-side
cartero/utils/sending.py
View file @
32465f9f
...
...
@@ -8,7 +8,8 @@ from django.contrib.staticfiles.finders import find
from
django.core.mail
import
EmailMultiAlternatives
from
django.template
import
Template
,
Context
from
lxml
import
etree
from
premailer
import
Premailer
#from premailer import Premailer
from
inlinestyler.utils
import
inline_css
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
django.core.signing
import
Signer
...
...
@@ -46,8 +47,9 @@ class CampaignDeliver(object):
result
=
etree
.
tostring
(
tree
.
getroot
(),
pretty_print
=
True
,
method
=
"html"
)
#print result
# CSS INLINER
p
=
Premailer
(
result
,
remove_classes
=
False
,
include_star_selectors
=
True
,
strip_important
=
False
)
html
=
p
.
transform
()
#p = Premailer(result, remove_classes=False, include_star_selectors=True, strip_important=False)
#html = p.transform()
html
=
inline_css
(
result
)
return
html
def
parse_links
(
self
,
tree
):
...
...
@@ -78,7 +80,7 @@ class CampaignDeliver(object):
h
=
html2text
.
HTML2Text
()
#h.ignore_links = True
#h.inline_links = True
text
=
h
.
handle
(
html
)
text
=
h
.
handle
(
html
.
decode
(
'utf-8'
)
)
return
text
def
send_to_contact
(
self
,
contact
):
...
...
Write
Preview
Supports
Markdown
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