From 22c94d0c5c94c476f807a9b68ea8f1af2c1afb2d Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Sun, 6 Jan 2019 23:23:38 +0000 Subject: [PATCH] Don't modify Journal FSDJump/Location entry Factions in-place Fixes #375 --- plugins/eddn.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/eddn.py b/plugins/eddn.py index 9d06305c..b9e6c1d7 100644 --- a/plugins/eddn.py +++ b/plugins/eddn.py @@ -403,9 +403,9 @@ def journal_entry(cmdr, is_beta, system, station, entry, state): # strip out properties disallowed by the schema for thing in ['ActiveFine', 'CockpitBreach', 'BoostUsed', 'FuelLevel', 'FuelUsed', 'JumpDist', 'Latitude', 'Longitude', 'Wanted']: entry.pop(thing, None) - for faction in entry.get('Factions', []): - for thing in ['HappiestSystem', 'HomeSystem', 'MyReputation', 'SquadronFaction']: - faction.pop(thing, None) + if 'Factions' in entry: + # Filter faction state. `entry` is a shallow copy so replace 'Factions' value rather than modify in-place. + entry['Factions'] = [ {k: v for k, v in f.iteritems() if k not in ['HappiestSystem', 'HomeSystem', 'MyReputation', 'SquadronFaction']} for f in entry['Factions']] # add planet to Docked event for planetary stations if known if entry['event'] == 'Docked' and this.planet: