unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] python: deprecated add_message calls index_file correctly and returns result
@ 2017-08-28  7:39 Gaute Hope
  2017-08-29 22:00 ` Tomi Ollila
  2017-08-30  8:16 ` [PATCH v2] " Gaute Hope
  0 siblings, 2 replies; 10+ messages in thread
From: Gaute Hope @ 2017-08-28  7:39 UTC (permalink / raw)
  To: notmuch

The deprecated Database.add_message now calls the new index_file with
correct number of arguments (without an extra `self`), and returns the
tuple from index_file - as it used to do before.
---
 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..6199f58b 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)
+        return 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] 10+ messages in thread

* Re: [PATCH] python: deprecated add_message calls index_file correctly and returns result
  2017-08-28  7:39 [PATCH] python: deprecated add_message calls index_file correctly and returns result Gaute Hope
@ 2017-08-29 22:00 ` Tomi Ollila
  2017-08-30  6:55   ` Gaute Hope
  2017-08-30  8:16 ` [PATCH v2] " Gaute Hope
  1 sibling, 1 reply; 10+ messages in thread
From: Tomi Ollila @ 2017-08-29 22:00 UTC (permalink / raw)
  To: Gaute Hope, notmuch

On Mon, Aug 28 2017, Gaute Hope wrote:

> The deprecated Database.add_message now calls the new index_file with
> correct number of arguments (without an extra `self`), and returns the
> tuple from index_file - as it used to do before.

Instead of this change, should we just dump the whole function...

... although this looks good what message are we giving by committing
changes to deprecated functions (unless this is not deprecated enough ;)

Tomi


> ---
>  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..6199f58b 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)
> +        return 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
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [PATCH] python: deprecated add_message calls index_file correctly and returns result
  2017-08-29 22:00 ` Tomi Ollila
@ 2017-08-30  6:55   ` Gaute Hope
  2017-08-30  7:38     ` Tomi Ollila
  0 siblings, 1 reply; 10+ messages in thread
From: Gaute Hope @ 2017-08-30  6:55 UTC (permalink / raw)
  To: notmuch, Tomi Ollila

Tomi Ollila writes on august 30, 2017 0:00:
> On Mon, Aug 28 2017, Gaute Hope wrote:
>
>> The deprecated Database.add_message now calls the new index_file with
>> correct number of arguments (without an extra `self`), and returns the
>> tuple from index_file - as it used to do before.
>
> Instead of this change, should we just dump the whole function...
>
> ... although this looks good what message are we giving by committing
> changes to deprecated functions (unless this is not deprecated enough ;)

Ok.. would that not be an argument against keeping any deprecated
functions? Then n_d_add_message should perhaps be removed as well.

It would be a good idea to use `warnings` and `DeprecationWarning` here.

This deprecation-function wrapper is flawed though: the function
signature is changed from the original, and it does not correctly call
the new function. It is not valid python code.

Original change: id:20170817231426.9627-2-dkg@fifthhorseman.net

Regards, Gaute


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

* Re: [PATCH] python: deprecated add_message calls index_file correctly and returns result
  2017-08-30  6:55   ` Gaute Hope
@ 2017-08-30  7:38     ` Tomi Ollila
  0 siblings, 0 replies; 10+ messages in thread
From: Tomi Ollila @ 2017-08-30  7:38 UTC (permalink / raw)
  To: Gaute Hope, notmuch

On Wed, Aug 30 2017, Gaute Hope wrote:

> Tomi Ollila writes on august 30, 2017 0:00:
>> On Mon, Aug 28 2017, Gaute Hope wrote:
>>
>>> The deprecated Database.add_message now calls the new index_file with
>>> correct number of arguments (without an extra `self`), and returns the
>>> tuple from index_file - as it used to do before.
>>
>> Instead of this change, should we just dump the whole function...
>>
>> ... although this looks good what message are we giving by committing
>> changes to deprecated functions (unless this is not deprecated enough ;)
>
> Ok.. would that not be an argument against keeping any deprecated
> functions? Then n_d_add_message should perhaps be removed as well.
>
> It would be a good idea to use `warnings` and `DeprecationWarning` here.
>
> This deprecation-function wrapper is flawed though: the function
> signature is changed from the original, and it does not correctly call
> the new function. It is not valid python code.
>
> Original change: id:20170817231426.9627-2-dkg@fifthhorseman.net

Thanks for that information. Perhaps it is just simplest and least
effort taking action to apply that change of yours
id:20170828073923.31442-1-eg@gaute.vetsj.com
(and it makes some users happier for the time being)

Tomi

>
> Regards, Gaute
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

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

* [PATCH v2] python: deprecated add_message calls index_file correctly and returns result
  2017-08-28  7:39 [PATCH] python: deprecated add_message calls index_file correctly and returns result Gaute Hope
  2017-08-29 22:00 ` Tomi Ollila
@ 2017-08-30  8:16 ` Gaute Hope
  2017-09-12 16:07   ` Daniel Kahn Gillmor
  2017-09-12 18:28   ` David Bremner
  1 sibling, 2 replies; 10+ messages in thread
From: Gaute Hope @ 2017-08-30  8:16 UTC (permalink / raw)
  To: notmuch

The deprecated Database.add_message now calls the new index_file with
correct number of arguments (without an extra `self`), and returns the
tuple from index_file - as it used to do before.

This change also adds a DeprecationWarning to the function.
---
 bindings/python/notmuch/database.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py
index a2c025eb..1279804a 100644
--- a/bindings/python/notmuch/database.py
+++ b/bindings/python/notmuch/database.py
@@ -19,6 +19,7 @@ Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>
 
 import os
 import codecs
+import warnings
 from ctypes import c_char_p, c_void_p, c_uint, byref, POINTER
 from .compat import SafeConfigParser
 from .globals import (
@@ -471,7 +472,10 @@ 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)
+        warnings.warn(
+                "This function is deprecated and will be removed in the future, use index_file.", DeprecationWarning)
+
+        return 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] 10+ messages in thread

* Re: [PATCH v2] python: deprecated add_message calls index_file correctly and returns result
  2017-08-30  8:16 ` [PATCH v2] " Gaute Hope
@ 2017-09-12 16:07   ` Daniel Kahn Gillmor
  2017-09-12 18:28   ` David Bremner
  1 sibling, 0 replies; 10+ messages in thread
From: Daniel Kahn Gillmor @ 2017-09-12 16:07 UTC (permalink / raw)
  To: Gaute Hope, notmuch

On Wed 2017-08-30 10:16:33 +0200, Gaute Hope wrote:
> The deprecated Database.add_message now calls the new index_file with
> correct number of arguments (without an extra `self`), and returns the
> tuple from index_file - as it used to do before.
>
> This change also adds a DeprecationWarning to the function.

lgtm.  thanks for fixing my bugs, Gaute.

       --dkg

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

* Re: [PATCH v2] python: deprecated add_message calls index_file correctly and returns result
  2017-08-30  8:16 ` [PATCH v2] " Gaute Hope
  2017-09-12 16:07   ` Daniel Kahn Gillmor
@ 2017-09-12 18:28   ` David Bremner
  2017-09-12 22:24     ` Dylan Baker
  1 sibling, 1 reply; 10+ messages in thread
From: David Bremner @ 2017-09-12 18:28 UTC (permalink / raw)
  To: Gaute Hope, notmuch

Gaute Hope <eg@gaute.vetsj.com> writes:

> The deprecated Database.add_message now calls the new index_file with
> correct number of arguments (without an extra `self`), and returns the
> tuple from index_file - as it used to do before.
>
> This change also adds a DeprecationWarning to the function.

Pushed to master, thanks

d

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

* Re: [PATCH v2] python: deprecated add_message calls index_file correctly and returns result
  2017-09-12 18:28   ` David Bremner
@ 2017-09-12 22:24     ` Dylan Baker
  2017-09-12 23:29       ` David Bremner
  0 siblings, 1 reply; 10+ messages in thread
From: Dylan Baker @ 2017-09-12 22:24 UTC (permalink / raw)
  To: David Bremner, notmuch

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

The broken commit is in 0.25.1, but this patch isn't correct? It's going to
break alot if that's the case.

Dylan

Quoting David Bremner (2017-09-12 11:28:17)
> Gaute Hope <eg@gaute.vetsj.com> writes:
> 
> > The deprecated Database.add_message now calls the new index_file with
> > correct number of arguments (without an extra `self`), and returns the
> > tuple from index_file - as it used to do before.
> >
> > This change also adds a DeprecationWarning to the function.
> 
> Pushed to master, thanks
> 
> d
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

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

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

iQEzBAABCAAdFiEEUwPMqo/+5aFHLzU4CJ4WlhQGiO8FAlm4XrcACgkQCJ4WlhQG
iO818QgAltiFIPU8Ti6EkFDRkyzmVzDVDg/cdBjGYPaVTGRoSh0xaoFgM7Eihr3X
+uYroUcxjUEOPTXaHvUzX4zPL1s9uNqsUCczKVO+CLso7UqI37nk6/0//+RxJGzT
x+V9By/ok0hrfIG0eCC350rfyvEk+qge1xMiv2NbqINusU+POrO870pe11PpZSLe
KKmFOxPeaMHTT6RbDL4HpQ+181YzcYmCeVCstFxz89zJVbuEUoJqFutF6u+zjHEx
NIX98h19VmgFSFDGK010/CotsWBDcDypDyn7OcO7q2eJGZiYvr4wv1i2x6TPjzIT
J4FLNBD4A4SrOL77ibTe+kpe3Ktpjw==
=LVxg
-----END PGP SIGNATURE-----

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

* Re: [PATCH v2] python: deprecated add_message calls index_file correctly and returns result
  2017-09-12 22:24     ` Dylan Baker
@ 2017-09-12 23:29       ` David Bremner
  2017-09-13 15:48         ` Dylan Baker
  0 siblings, 1 reply; 10+ messages in thread
From: David Bremner @ 2017-09-12 23:29 UTC (permalink / raw)
  To: Dylan Baker, notmuch

Dylan Baker <dylan@pnwbakers.com> writes:

> The broken commit is in 0.25.1, but this patch isn't correct? It's going to
> break alot if that's the case.
>
> Dylan

I don't believe b10ce6bc2 is in 0.25.1; it's in master, and 0.25.1 is
merged into master, so maybe that's the source of confusion.

%-% git log --oneline  0.24..0.25.1 bindings/python        
0fa257cb version: bump to 0.25.1
7a4c60e4 version: bump to 0.25
b8ccfe34 version: bump to 0.25~rc1
87bdfbc9 Fix orthography
694e443d version: bump version to 0.25~rc0
1ec63446 Merge branch 'release'
4fb08341 version: bump to 0.24.2
d877240f Merge branch 'release'
d9ec7e34 version: bump to 0.24.1
a35040ee python: bump SOVERSION to 5
3721bd45 lib: replace deprecated n_q_count_threads with status returning version
5ce8e0b1 lib: replace deprecated n_q_count_messages with status returning version
86cbd215 lib: replace deprecated n_q_search_messages with status returning version
1e982de5 lib: replace n_query_search_threads with status returning version
c0c56455 Merge branch 'release'
a39a1ee1 bindings/python: add bindings for notmuch_database_get_revision
4e872c64 Merge branch 'release'
91524d5d Merge tag '0.24_rc0'

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

* Re: [PATCH v2] python: deprecated add_message calls index_file correctly and returns result
  2017-09-12 23:29       ` David Bremner
@ 2017-09-13 15:48         ` Dylan Baker
  0 siblings, 0 replies; 10+ messages in thread
From: Dylan Baker @ 2017-09-13 15:48 UTC (permalink / raw)
  To: David Bremner, notmuch

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

Quoting David Bremner (2017-09-12 16:29:16)
> Dylan Baker <dylan@pnwbakers.com> writes:
> 
> > The broken commit is in 0.25.1, but this patch isn't correct? It's going to
> > break alot if that's the case.
> >
> > Dylan
> 
> I don't believe b10ce6bc2 is in 0.25.1; it's in master, and 0.25.1 is
> merged into master, so maybe that's the source of confusion.
> 
> %-% git log --oneline  0.24..0.25.1 bindings/python        
> 0fa257cb version: bump to 0.25.1
> 7a4c60e4 version: bump to 0.25
> b8ccfe34 version: bump to 0.25~rc1
> 87bdfbc9 Fix orthography
> 694e443d version: bump version to 0.25~rc0
> 1ec63446 Merge branch 'release'
> 4fb08341 version: bump to 0.24.2
> d877240f Merge branch 'release'
> d9ec7e34 version: bump to 0.24.1
> a35040ee python: bump SOVERSION to 5
> 3721bd45 lib: replace deprecated n_q_count_threads with status returning version
> 5ce8e0b1 lib: replace deprecated n_q_count_messages with status returning version
> 86cbd215 lib: replace deprecated n_q_search_messages with status returning version
> 1e982de5 lib: replace n_query_search_threads with status returning version
> c0c56455 Merge branch 'release'
> a39a1ee1 bindings/python: add bindings for notmuch_database_get_revision
> 4e872c64 Merge branch 'release'
> 91524d5d Merge tag '0.24_rc0'

Okay, that doesn't look like it's in there. Thanks for clarifying!

Dylan

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

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

iQEzBAABCAAdFiEEUwPMqo/+5aFHLzU4CJ4WlhQGiO8FAlm5U1wACgkQCJ4WlhQG
iO/UpAf9HUFVFN9aZLnIpJgzAPv6CiRZTCVu3KJXnle9ErPOnmFPIpAENT2jHGPH
9YCSqXH4qFBqXzYsgYoNxGB+n/l07DZ9h8IbpjXmMCtaeE65G+ZO80EyGsF92DQC
JGESqrBf7eQze5Qyrr+GOfIYgv0Wmz0xxPbQ8496ys9k4z3GVRr05RW7ObMCCNIB
KQHrbJ1DI9h7Bu4giwolB0P5WX15oek5mmjmOX0IVeUYFQfMWoTdp/yyXhPY8gwf
I3S71HZK0sIWvrK1J4wU9uVMg2y56Zj2a/bEMTf7913ZZ7KyRTzRDnTAC+psjajX
91wvuqWL7ekRF5xjGSSJboAkNCOS7Q==
=2lBz
-----END PGP SIGNATURE-----

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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-28  7:39 [PATCH] python: deprecated add_message calls index_file correctly and returns result Gaute Hope
2017-08-29 22:00 ` Tomi Ollila
2017-08-30  6:55   ` Gaute Hope
2017-08-30  7:38     ` Tomi Ollila
2017-08-30  8:16 ` [PATCH v2] " Gaute Hope
2017-09-12 16:07   ` Daniel Kahn Gillmor
2017-09-12 18:28   ` David Bremner
2017-09-12 22:24     ` Dylan Baker
2017-09-12 23:29       ` David Bremner
2017-09-13 15:48         ` Dylan Baker

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).