Use of string.replace() is deprecated, better to invoke replace()
directly on the string object.
---
 contrib/notmuch-web/nmweb.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/contrib/notmuch-web/nmweb.py b/contrib/notmuch-web/nmweb.py
index c6d437c5..1f6e0145 100755
--- a/contrib/notmuch-web/nmweb.py
+++ b/contrib/notmuch-web/nmweb.py
@@ -10,7 +10,6 @@ from mailbox import MaildirMessage
 import os
 import mimetypes
 import email
-import string
 import re
 from jinja2 import Environment, FileSystemLoader # FIXME to PackageLoader
 from jinja2 import Markup
@@ -166,8 +165,7 @@ def format_message_walk(msg,mid):
           yield '<ul>'
           for subpart in part.get_payload():
             yield ('<li><a href="#%s">%s</a></li>' %
-                   (string.replace(subpart.get_content_type(),
-                                   '/', '-'),
+                   (subpart.get_content_type().replace('/', '-'),
                     subpart.get_content_type()))
           yield '</ul>'
       elif part.get_content_type() == 'message/rfc822':
@@ -191,7 +189,7 @@ def format_message_walk(msg,mid):
          yield '<iframe class="embedded-html" src="%s">' % 
os.path.join(prefix,cachedir,mid,filename)
           yield '</div>'
         else:
-          yield '<div id="%s">' % 
string.replace(part.get_content_type(),'/','-')
+          yield '<div id="%s">' % (part.get_content_type().replace('/','-'),)
           (filename,cid) = link_to_cached_file(part,mid,counter)
           counter += 1
           yield '<a href="%s">%s (%s)</a>' % (os.path.join(prefix,
@@ -222,7 +220,7 @@ def format_message_walk(msg,mid):
 env.globals['format_message'] = format_message
 
 def replace_cids(body,mid):
-    return string.replace(body,'cid:',os.path.join(prefix,cachedir,mid)+'/')
+    return body.replace('cid:',os.path.join(prefix,cachedir,mid)+'/')
 
 def find_cids(body):
     return re.findall(r'cid:([^ "\'>]*)', body)
-- 
2.15.1

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to