From 094b403515721dc2995ad2d254d53c069129719f Mon Sep 17 00:00:00 2001 From: Nicolas F Date: Thu, 21 Feb 2019 16:36:48 +0100 Subject: [PATCH] docs: actually fix chestFilter example oops --- docs/signs.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/signs.rst b/docs/signs.rst index 51986b9..a78d0c0 100644 --- a/docs/signs.rst +++ b/docs/signs.rst @@ -45,7 +45,7 @@ A more complicated filter function can construct a more customized display text: def chestFilter(poi): if poi['id'] == "Chest": - return "Chest with %d items" % len(poi.get('Items')) + return "Chest with %d items" % len(poi.get('Items', [])) It is also possible to return a tuple from the filter function to specify a hovertext different from the text displayed in the info window. The first entry of the tuple will @@ -53,7 +53,7 @@ be used as the hover text, the second will be used as the info window content:: def chestFilter(poi): if poi['id'] == "Chest": - return ("Chest", "Chest with %d items" % len(poi.get('Items'))) + return ("Chest", "Chest with %d items" % len(poi.get('Items', []))) Because of the way the config file is loaded, if you need to import a function or module for use in your filter function, you need to explicitly load it into the global namespace::