From 0ed1ee63e1d24d0e073eac6a846a0d64b555a021 Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Mon, 9 Apr 2007 15:35:24 -0400 Subject: [PATCH] if new_date is set, ensure that new_channel is also set --- planet/shell/tmpl.py | 2 +- tests/data/filter/tmpl/new_channel_date.xml | 35 +++++++++++++++++++++ tests/data/filter/tmpl/new_date.xml | 23 ++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 tests/data/filter/tmpl/new_channel_date.xml create mode 100644 tests/data/filter/tmpl/new_date.xml diff --git a/planet/shell/tmpl.py b/planet/shell/tmpl.py index 0902e24..e6d3745 100644 --- a/planet/shell/tmpl.py +++ b/planet/shell/tmpl.py @@ -226,7 +226,7 @@ def template_info(source): date = item['new_date'] if item.has_key('new_channel'): - if item['new_channel'] == channel: + if item['new_channel'] == channel and not item.has_key('new_date'): del item['new_channel'] else: channel = item['new_channel'] diff --git a/tests/data/filter/tmpl/new_channel_date.xml b/tests/data/filter/tmpl/new_channel_date.xml new file mode 100644 index 0000000..3b50d0f --- /dev/null +++ b/tests/data/filter/tmpl/new_channel_date.xml @@ -0,0 +1,35 @@ + + + + + 2004-02-28T18:14:55Z + + http://example.com/ + + + + 2004-02-28T14:14:55Z + + http://example.com/ + + + + 2004-02-27T14:14:55Z + + http://example.org/ + + + + 2004-02-26T14:14:55Z + + http://example.org/ + + + + http://example.com/ + + + diff --git a/tests/data/filter/tmpl/new_date.xml b/tests/data/filter/tmpl/new_date.xml new file mode 100644 index 0000000..902801f --- /dev/null +++ b/tests/data/filter/tmpl/new_date.xml @@ -0,0 +1,23 @@ + + + + + 2004-02-28T18:14:55Z + + + 2004-02-28T14:14:55Z + + + 2004-02-27T14:14:55Z + + + 2004-02-26T14:14:55Z + + + http://example.com/ + + +