Skip to content

Instantly share code, notes, and snippets.

View frisi's full-sized avatar

Harald Friessnegger frisi

View GitHub Profile
@frisi
frisi / copy.py
Created April 5, 2017 07:22
create copy of linguaplone translation folder and fix internal links and embedded images after that (see https://community.plone.org/t/translating-website-for-different-regions/3792)
# -*- coding: utf-8 -*-
from OFS.CopySupport import CopyError
from Products.Archetypes.Field import ReferenceField
from Products.Archetypes.Field import TextField
from Products.Archetypes.exceptions import ReferenceException
from Products.CMFCore.WorkflowCore import WorkflowException
from Products.statusmessages.interfaces import IStatusMessage
from plone import api
from z3c.form import field, button
from z3c.form.form import Form
@frisi
frisi / mail.py
Created May 18, 2016 23:39
create html email out of zope template and compute txt version using
# for information how to use a zope page template to rende the html see
# https://github.com/collective/collective.dancing/blob/1.0.1/collective/dancing/composer.py#L342
from Products.CMFPlone.utils import safe_unicode
from email.Header import Header
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.Utils import formatdate
import email
import html2text