Beispiel #1
0
    def ready(self):
        autodiscover()

        if not getattr(settings, 'SIMPLE_MAIL_LOG_CSS_WARNING', False):
            """
            By default cssutils log CSS Warning
            We prevent those logs to keep a clean log but you can
            still enable them by setting `SIMPLE_MAIL_LOG_CSS_WARNING = True`
            Snippet taken from https://gist.github.com/texuf/1e1ef7fce7aaa67caf4d
            """
            from cssutils import profile
            from cssutils.profiles import Profiles, properties, macros
            # patch um up
            properties[Profiles.CSS_LEVEL_2][
                '-ms-interpolation-mode'] = r'none|bicubic|nearest-neighbor'
            properties[Profiles.CSS_LEVEL_2][
                '-ms-text-size-adjust'] = r'none|auto|{percentage}'
            properties[
                Profiles.CSS_LEVEL_2]['mso-table-lspace'] = r'0|{num}(pt)'
            properties[
                Profiles.CSS_LEVEL_2]['mso-table-rspace'] = r'0|{num}(pt)'
            properties[Profiles.CSS_LEVEL_2][
                '-webkit-text-size-adjust'] = r'none|auto|{percentage}'
            # re-add
            profile.addProfiles([
                (Profiles.CSS_LEVEL_2, properties[Profiles.CSS_LEVEL_2],
                 macros[Profiles.CSS_LEVEL_2])
            ])
def configure_cssutils() -> None:
    # These properties are not supported by cssutils by default and will
    # result in warnings when premailer package is run.
    properties[Profiles.CSS_LEVEL_2]['-ms-interpolation-mode'] = r'none|bicubic|nearest-neighbor'
    properties[Profiles.CSS_LEVEL_2]['-ms-text-size-adjust'] = r'none|auto|{percentage}'
    properties[Profiles.CSS_LEVEL_2]['mso-table-lspace'] = r'0|{num}(pt)'
    properties[Profiles.CSS_LEVEL_2]['mso-table-rspace'] = r'0|{num}(pt)'
    properties[Profiles.CSS_LEVEL_2]['-webkit-text-size-adjust'] = r'none|auto|{percentage}'
    properties[Profiles.CSS_LEVEL_2]['mso-hide'] = 'all'
    properties[Profiles.CSS_LEVEL_2]['pointer-events'] = (r'auto|none|visiblePainted|'
                                                          r'visibleFill|visibleStroke|'
                                                          r'visible|painted|fill|stroke|all|inherit')

    profile.addProfiles([(Profiles.CSS_LEVEL_2, properties[Profiles.CSS_LEVEL_2],
                         macros[Profiles.CSS_LEVEL_2])])
Beispiel #3
0
def configure_cssutils() -> None:
    # These properties are not supported by cssutils by default and will
    # result in warnings when premailer package is run.
    properties[Profiles.CSS_LEVEL_2]["-ms-interpolation-mode"] = r"none|bicubic|nearest-neighbor"
    properties[Profiles.CSS_LEVEL_2]["-ms-text-size-adjust"] = r"none|auto|{percentage}"
    properties[Profiles.CSS_LEVEL_2]["mso-table-lspace"] = r"0|{num}(pt)"
    properties[Profiles.CSS_LEVEL_2]["mso-table-rspace"] = r"0|{num}(pt)"
    properties[Profiles.CSS_LEVEL_2]["-webkit-text-size-adjust"] = r"none|auto|{percentage}"
    properties[Profiles.CSS_LEVEL_2]["mso-hide"] = "all"
    properties[Profiles.CSS_LEVEL_2]["pointer-events"] = (
        r"auto|none|visiblePainted|"
        r"visibleFill|visibleStroke|"
        r"visible|painted|fill|stroke|all|inherit"
    )

    profile.addProfiles(
        [(Profiles.CSS_LEVEL_2, properties[Profiles.CSS_LEVEL_2], macros[Profiles.CSS_LEVEL_2])]
    )
Beispiel #4
0
from cssutils import profile
from cssutils.profiles import Profiles, properties, macros
#patch um up
properties[Profiles.CSS_LEVEL_2]['-ms-interpolation-mode'] = r'none|bicubic|nearest-neighbor'
properties[Profiles.CSS_LEVEL_2]['-ms-text-size-adjust'] = r'none|auto|{percentage}'
properties[Profiles.CSS_LEVEL_2]['mso-table-lspace'] = r'0|{num}(pt)'
properties[Profiles.CSS_LEVEL_2]['mso-table-rspace'] = r'0|{num}(pt)'
properties[Profiles.CSS_LEVEL_2]['-webkit-text-size-adjust'] = r'none|auto|{percentage}'
#re-add
profile.addProfiles([(Profiles.CSS_LEVEL_2,
                           properties[Profiles.CSS_LEVEL_2],
                           macros[Profiles.CSS_LEVEL_2]
                           )])