How to use mailto method in Kiwi

Best Python code snippet using Kiwi_python

0070_fix_mailto_fields.py

Source:0070_fix_mailto_fields.py Github

copy

Full Screen

1# Generated by Django 1.11.6 on 2018-02-09 14:522from django.db import migrations3def fix_mailto_fields(ContactField):4 mailto_fields = list(ContactField.objects.filter(key="mailto", is_active=True).select_related("org"))5 email_fields = list(ContactField.objects.filter(key="email", is_active=True).select_related("org"))6 if not mailto_fields:7 return8 print("Found %d mailto fields to fix..." % len(mailto_fields))9 orgs_with_email_field = {f.org for f in email_fields}10 for mailto_field in mailto_fields:11 if mailto_field.org not in orgs_with_email_field:12 mailto_field.key = "email"13 mailto_field.label = "Email"14 mailto_field.save(update_fields=("key", "label"))15 print(" > Renamed mailto field #%d for org #%d" % (mailto_field.id, mailto_field.org.id))16 else:17 print(18 " > Unable to rename mailto field #%d for org #%d because field called email already exists"19 % (mailto_field.id, mailto_field.org.id)20 )21def apply_manual():22 from temba.contacts.models import ContactField23 fix_mailto_fields(ContactField)24def apply_as_migration(apps, schema_editor):25 ContactField = apps.get_model("contacts", "ContactField")26 fix_mailto_fields(ContactField)27class Migration(migrations.Migration):28 dependencies = [("contacts", "0069_iso639-3")]...

Full Screen

Full Screen

mailto.py

Source:mailto.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2from __future__ import absolute_import3import codecs4from pelican import signals5from pelican.generators import Generator6from linker import linker7def encode_mailto_link(mailto):8 return 'mailto/' + codecs.encode(mailto, 'rot_13') + '/'9class MailtoLinker(linker.LinkerBase):10 commands = ['mailto']11 def link(self, link):12 mailto = link.path13 link.path = '/' + encode_mailto_link(mailto) # a.href for JS parsing14 link.context['mailtos'].add(mailto) # remember mail address for fallback15class MailtoFallbackGenerator(Generator):16 def generate_context(self):17 self.context['mailtos'] = set() # populated on {mailto} link processing18 def generate_output(self, writer):19 for mailto in self.context['mailtos']:20 save_as = encode_mailto_link(mailto) + 'index.html'21 writer.write_file(save_as, self.get_template('mailto_fallback'),22 self.context, mailto=mailto)23def return_mailto_fallback_generator(generators):24 return MailtoFallbackGenerator25def register():26 linker.register()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Kiwi automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful