[PATCH] python: Fix database.add_message

classic Classic list List threaded Threaded
5 messages Options
Dylan Baker Dylan Baker
Reply | Threaded
Open this post in threaded view
|

[PATCH] python: Fix database.add_message

b10ce6bc23002d48916b1b2f375480e7540e3164 introduced a new index_file
method as a replacement for add_message. It helpfully made add_message
an alias for index_file, unfortunately it got the signature wrong by
explicitly passing self as an argument.

cc: Daniel Kahn Gillmor <[hidden email]>
---
 bindings/python/notmuch/database.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py
index a2c025eb..f553e9d0 100644
--- a/bindings/python/notmuch/database.py
+++ b/bindings/python/notmuch/database.py
@@ -471,7 +471,7 @@ class Database(object):
     def add_message(self, filename, sync_maildir_flags=False):
         """Deprecated alias for :meth:`index_file`
         """
-        self.index_file(self, filename, sync_maildir_flags=sync_maildir_flags)
+        self.index_file(filename, sync_maildir_flags=sync_maildir_flags)
 
     _remove_message = nmlib.notmuch_database_remove_message
     _remove_message.argtypes = [NotmuchDatabaseP, c_char_p]
--
2.14.1

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] python: Fix database.add_message

Dylan Baker <[hidden email]> writes:

> b10ce6bc23002d48916b1b2f375480e7540e3164 introduced a new index_file
> method as a replacement for add_message. It helpfully made add_message
> an alias for index_file, unfortunately it got the signature wrong by
> explicitly passing self as an argument.
>
> cc: Daniel Kahn Gillmor <[hidden email]>

Thanks. We have another version that I was about to commit

https://www.mail-archive.com/notmuch@.../msg45038.html

The only difference is that Gaute (more or less by request) added a
deprecation warning.  I don't really know how warnings in python work,
does that sound sensible?

d
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] python: Fix database.add_message

David Bremner <[hidden email]> writes:

> Dylan Baker <[hidden email]> writes:
>
>> b10ce6bc23002d48916b1b2f375480e7540e3164 introduced a new index_file
>> method as a replacement for add_message. It helpfully made add_message
>> an alias for index_file, unfortunately it got the signature wrong by
>> explicitly passing self as an argument.
>>
>> cc: Daniel Kahn Gillmor <[hidden email]>
>
> Thanks. We have another version that I was about to commit
>
> https://www.mail-archive.com/notmuch@.../msg45038.html
>
> The only difference is that Gaute (more or less by request) added a
> deprecation warning.  I don't really know how warnings in python work,
> does that sound sensible?

Oof. Two minutes of internet search reveal that DeprecationWarnings are
ignored by default, so that should be OK.

d
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Gaute Hope Gaute Hope
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] python: Fix database.add_message

In reply to this post by David Bremner-2
David Bremner writes on september 12, 2017 3:56:

> Dylan Baker <[hidden email]> writes:
>
>> b10ce6bc23002d48916b1b2f375480e7540e3164 introduced a new index_file
>> method as a replacement for add_message. It helpfully made add_message
>> an alias for index_file, unfortunately it got the signature wrong by
>> explicitly passing self as an argument.
>>
>> cc: Daniel Kahn Gillmor <[hidden email]>
>
> Thanks. We have another version that I was about to commit
>
> https://www.mail-archive.com/notmuch@.../msg45038.html
>
> The only difference is that Gaute (more or less by request) added a
> deprecation warning.  I don't really know how warnings in python work,
> does that sound sensible?

Yup, also notice the missing `return`.

Regards, Gaute

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Dylan Baker Dylan Baker
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] python: Fix database.add_message

In reply to this post by David Bremner-2
Quoting David Bremner (2017-09-11 18:58:31)

> David Bremner <[hidden email]> writes:
>
> > Dylan Baker <[hidden email]> writes:
> >
> >> b10ce6bc23002d48916b1b2f375480e7540e3164 introduced a new index_file
> >> method as a replacement for add_message. It helpfully made add_message
> >> an alias for index_file, unfortunately it got the signature wrong by
> >> explicitly passing self as an argument.
> >>
> >> cc: Daniel Kahn Gillmor <[hidden email]>
> >
> > Thanks. We have another version that I was about to commit
> >
> > https://www.mail-archive.com/notmuch@.../msg45038.html
> >
> > The only difference is that Gaute (more or less by request) added a
> > deprecation warning.  I don't really know how warnings in python work,
> > does that sound sensible?
>
> Oof. Two minutes of internet search reveal that DeprecationWarnings are
> ignored by default, so that should be OK.
>
> d
I'd still add the deprecation warning. IIRC some of the linters have a mode to
check for deprecation warnings.

Dylan

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (499 bytes) Download Attachment