unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] python: Fix database.add_message
@ 2017-09-11 21:35 Dylan Baker
  2017-09-12  1:56 ` David Bremner
  0 siblings, 1 reply; 5+ messages in thread
From: Dylan Baker @ 2017-09-11 21:35 UTC (permalink / raw)
  To: notmuch; +Cc: Dylan Baker, Daniel Kahn Gillmor

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 <dkg@fifthhorseman.net>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] python: Fix database.add_message
  2017-09-11 21:35 [PATCH] python: Fix database.add_message Dylan Baker
@ 2017-09-12  1:56 ` David Bremner
  2017-09-12  1:58   ` David Bremner
  2017-09-12  7:40   ` Gaute Hope
  0 siblings, 2 replies; 5+ messages in thread
From: David Bremner @ 2017-09-12  1:56 UTC (permalink / raw)
  To: Dylan Baker, notmuch; +Cc: Daniel Kahn Gillmor

Dylan Baker <dylan@pnwbakers.com> 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 <dkg@fifthhorseman.net>

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

https://www.mail-archive.com/notmuch@notmuchmail.org/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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] python: Fix database.add_message
  2017-09-12  1:56 ` David Bremner
@ 2017-09-12  1:58   ` David Bremner
  2017-09-12 15:31     ` Dylan Baker
  2017-09-12  7:40   ` Gaute Hope
  1 sibling, 1 reply; 5+ messages in thread
From: David Bremner @ 2017-09-12  1:58 UTC (permalink / raw)
  To: Dylan Baker, notmuch; +Cc: Daniel Kahn Gillmor

David Bremner <david@tethera.net> writes:

> Dylan Baker <dylan@pnwbakers.com> 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 <dkg@fifthhorseman.net>
>
> Thanks. We have another version that I was about to commit
>
> https://www.mail-archive.com/notmuch@notmuchmail.org/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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] python: Fix database.add_message
  2017-09-12  1:56 ` David Bremner
  2017-09-12  1:58   ` David Bremner
@ 2017-09-12  7:40   ` Gaute Hope
  1 sibling, 0 replies; 5+ messages in thread
From: Gaute Hope @ 2017-09-12  7:40 UTC (permalink / raw)
  To: David Bremner, Dylan Baker, notmuch; +Cc: Daniel Kahn Gillmor

David Bremner writes on september 12, 2017 3:56:
> Dylan Baker <dylan@pnwbakers.com> 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 <dkg@fifthhorseman.net>
> 
> Thanks. We have another version that I was about to commit
> 
> https://www.mail-archive.com/notmuch@notmuchmail.org/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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] python: Fix database.add_message
  2017-09-12  1:58   ` David Bremner
@ 2017-09-12 15:31     ` Dylan Baker
  0 siblings, 0 replies; 5+ messages in thread
From: Dylan Baker @ 2017-09-12 15:31 UTC (permalink / raw)
  To: David Bremner, notmuch; +Cc: Daniel Kahn Gillmor

[-- Attachment #1: Type: text/plain, Size: 1067 bytes --]

Quoting David Bremner (2017-09-11 18:58:31)
> David Bremner <david@tethera.net> writes:
> 
> > Dylan Baker <dylan@pnwbakers.com> 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 <dkg@fifthhorseman.net>
> >
> > Thanks. We have another version that I was about to commit
> >
> > https://www.mail-archive.com/notmuch@notmuchmail.org/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

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEEUwPMqo/+5aFHLzU4CJ4WlhQGiO8FAlm3/bsACgkQCJ4WlhQG
iO9o5Qf/dwNqVJo476o+l5ljMOcilcWxdyPmyC/NnbzfS8CfMrBLlMizLRO6m5IC
w+cvLR/KwnL5chxKxowl7/P4bAVvSjbJo2nSqFtFSS1p6gqyrxeIMuRLfH0uOgyz
FiKLWPTEZhGaa0T/zaGpai6i3b60Z7Hl6jpkv/tRb9tkhIyFkz29BQRjzOucZbw0
2C4bhpT224YQfOP7hxB7Y3DWPFyyWmZxPS5h1siNiOwMpTvd0d7Qfp3IPt2C6pxr
iWbTDpflkm9XJnWUuhcME222kUqDD9VGam/VWyVTq5/cRGFbFra2Bf9elXwZNMBv
CSRkbxLJrWe37oTJ/z/VWIcmLj3ASg==
=wOa7
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-09-12 15:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11 21:35 [PATCH] python: Fix database.add_message Dylan Baker
2017-09-12  1:56 ` David Bremner
2017-09-12  1:58   ` David Bremner
2017-09-12 15:31     ` Dylan Baker
2017-09-12  7:40   ` Gaute Hope

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).