Skip to content

Commit

Permalink
Remove mark_as_read config tag name migration.
Browse files Browse the repository at this point in the history
For #268.
  • Loading branch information
lemon24 committed Jul 23, 2022
1 parent 204ae6f commit f4861a8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 43 deletions.
11 changes: 10 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Unreleased

* Remove old database migrations.

Remove :mod:`~reader.plugins.mark_as_read` config tag name migration.

If you are upgrading from *reader* 2.10 or newer, no action is required.

.. _removed migrations 3.0:
Expand All @@ -34,8 +36,15 @@ Unreleased
python - db.sqlite << EOF
import sys
from reader import make_reader
make_reader(sys.argv[1])
from reader.plugins.mark_as_read import _migrate_pre_2_7_metadata as migrate_mark_as_read
reader = make_reader(sys.argv[1])
for feed in reader.get_feeds():
migrate_mark_as_read(reader, feed)
print("OK")
EOF
* Remove code that issued deprecation warnings in versions 2.* (:issue:`268`):
Expand Down
19 changes: 0 additions & 19 deletions src/reader/plugins/mark_as_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,5 @@ def _mark_as_read(reader, entry, status):
return


_OLD_CONFIG_TAG = 'mark_as_read'


def _migrate_pre_2_7_metadata(reader, feed):
old_key = reader.make_reader_reserved_name(_OLD_CONFIG_TAG)
old_value = reader.get_tag(feed, old_key, None)
if not old_value:
return

key = reader.make_reader_reserved_name(_CONFIG_TAG)
value = reader.get_tag(feed, key, None)
if value: # pragma: no cover
return

reader.set_tag(feed, key, old_value)
reader.delete_tag(feed, old_key)


def init_reader(reader):
reader.before_feed_update_hooks.append(_migrate_pre_2_7_metadata)
reader.after_entry_update_hooks.append(_mark_as_read)
23 changes: 0 additions & 23 deletions tests/test_plugins_mark_as_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,3 @@ def test_regex_mark_as_read_bad_metadata(make_reader, value):
reader.update_feeds()

assert [e.read for e in reader.get_entries()] == [False]


@pytest.mark.parametrize('with_entry', [False, True])
def test_regex_mark_as_read_pre_2_7_metadata(make_reader, with_entry):
reader = make_reader(':memory:', plugins=['reader.mark_as_read'])

parser = Parser()
reader._parser = parser

one = parser.feed(1, datetime(2010, 1, 1))
if with_entry:
parser.entry(1, 1, datetime(2010, 1, 1), title='match old')

reader.add_feed(one)
reader.set_tag(one, '.reader.mark_as_read', {'title': ['^match']})

reader.update_feeds()

assert all(e.read for e in reader.get_entries())

tags = dict(reader.get_tags(one))
assert '.reader.mark_as_read' not in tags
assert tags['.reader.mark-as-read'] == {'title': ['^match']}

0 comments on commit f4861a8

Please sign in to comment.