details:   https://code.tryton.org/tryton/commit/d9169aaeb05d
branch:    default
user:      Cédric Krier <[email protected]>
date:      Thu Nov 20 22:07:43 2025 +0100
description:
        Remove unused mailto function

        It is no more used since 83287ed2d759
diffstat:

 tryton/tryton/common/__init__.py |   3 +-
 tryton/tryton/common/common.py   |  48 ----------------------------------------
 tryton/tryton/config.py          |   1 -
 3 files changed, 1 insertions(+), 51 deletions(-)

diffs (103 lines):

diff -r 28cae9983afc -r d9169aaeb05d tryton/tryton/common/__init__.py
--- a/tryton/tryton/common/__init__.py  Thu Nov 13 15:23:47 2025 +0100
+++ b/tryton/tryton/common/__init__.py  Thu Nov 20 22:07:43 2025 +0100
@@ -10,7 +10,7 @@
     file_write, filter_domain, generateColorscheme, get_align, get_credentials,
     get_gdk_backend, get_hostname, get_monitor_size, get_port,
     get_sensible_widget, get_toplevel_window, hex2rgb, highlight_rgb, humanize,
-    idle_add, mailto, message, node_attributes, open_documentation, play_sound,
+    idle_add, message, node_attributes, open_documentation, play_sound,
     process_exception, resize_pixbuf, selection, setup_window, slugify, sur,
     sur_3b, timezoned_date, to_xml, untimezoned_date, url_open, userwarning,
     warning)
@@ -70,7 +70,6 @@
     idle_add,
     inverse_leaf,
     localize_domain,
-    mailto,
     merge,
     message,
     node_attributes,
diff -r 28cae9983afc -r d9169aaeb05d tryton/tryton/common/common.py
--- a/tryton/tryton/common/common.py    Thu Nov 13 15:23:47 2025 +0100
+++ b/tryton/tryton/common/common.py    Thu Nov 20 22:07:43 2025 +0100
@@ -25,7 +25,6 @@
 except ImportError:
     from http import client as HTTPStatus
 
-import shlex
 import socket
 import sys
 import traceback
@@ -35,7 +34,6 @@
 import webbrowser
 import zipfile
 from functools import wraps
-from string import Template
 from threading import Lock, Thread
 
 from gi.repository import Gdk, GdkPixbuf, Gio, GLib, GObject, Gtk
@@ -684,52 +682,6 @@
             raise
 
 
-def mailto(to=None, cc=None, subject=None, body=None, attachment=None):
-    if CONFIG['client.email']:
-        cmd = Template(CONFIG['client.email']).substitute(
-                to=to or '',
-                cc=cc or '',
-                subject=subject or '',
-                body=body or '',
-                attachment=attachment or '',
-                )
-        args = shlex.split(str(cmd))
-        subprocess.Popen(args)
-        return
-    if os.name != 'nt' and sys.platform != 'darwin':
-        args = ['xdg-email', '--utf8']
-        if cc:
-            args.extend(['--cc', cc])
-        if subject:
-            args.extend(['--subject', subject])
-        if body:
-            args.extend(['--body', body])
-        if attachment:
-            args.extend(['--attach', attachment])
-        if to:
-            args.append(to)
-        try:
-            subprocess.Popen(args)
-            return
-        except OSError:
-            pass
-    # http://www.faqs.org/rfcs/rfc2368.html
-    url = "mailto:";
-    if to:
-        url += urllib.parse.quote(to.strip(), "@,")
-    url += '?'
-    if cc:
-        url += "&cc=" + urllib.parse.quote(cc, "@,")
-    if subject:
-        url += "&subject=" + urllib.parse.quote(subject, "")
-    if body:
-        body = "\r\n".join(body.splitlines())
-        url += "&body=" + urllib.parse.quote(body, "")
-    if attachment:
-        url += "&attachment=" + urllib.parse.quote(attachment, "")
-    webbrowser_open(url, new=1)
-
-
 class UniqueDialog(object):
 
     def __init__(self):
diff -r 28cae9983afc -r d9169aaeb05d tryton/tryton/config.py
--- a/tryton/tryton/config.py   Thu Nov 13 15:23:47 2025 +0100
+++ b/tryton/tryton/config.py   Thu Nov 20 22:07:43 2025 +0100
@@ -90,7 +90,6 @@
             'client.code_scanner_sound': True,
             'client.lang': locale.getdefaultlocale()[0],
             'client.language_direction': 'ltr',
-            'client.email': '',
             'client.limit': 1000,
             'client.check_version': True,
             'client.bus_timeout': 10 * 60,

Reply via email to