diff --git a/source/jormungandr/jormungandr/interfaces/v1/Journeys.py b/source/jormungandr/jormungandr/interfaces/v1/Journeys.py index 4be51d8178..e397615c03 100644 --- a/source/jormungandr/jormungandr/interfaces/v1/Journeys.py +++ b/source/jormungandr/jormungandr/interfaces/v1/Journeys.py @@ -69,7 +69,6 @@ UnsignedInteger, PositiveInteger, DepthArgument, - PositiveFloat, ) from jormungandr.interfaces.common import add_poi_infos_types, handle_poi_infos from jormungandr.fallback_modes import FallbackModes @@ -672,35 +671,6 @@ def __init__(self): help="Compute pathways using the street_network engine for transfers between surface physical modes", ) - parser_get.add_argument( - "_asgard_max_walking_duration_coeff", - type=PositiveFloat(), - default=1.12, - hidden=True, - help="used to adjust the search range in Asgard when computing matrix", - ) - parser_get.add_argument( - "_asgard_max_bike_duration_coeff", - type=PositiveFloat(), - default=2.8, - hidden=True, - help="used to adjust the search range in Asgard when computing matrix", - ) - parser_get.add_argument( - "_asgard_max_bss_duration_coeff", - type=PositiveFloat(), - default=0.46, - hidden=True, - help="used to adjust the search range in Asgard when computing matrix", - ) - parser_get.add_argument( - "_asgard_max_car_duration_coeff", - type=PositiveFloat(), - default=1, - hidden=True, - help="used to adjust the search range in Asgard when computing matrix", - ) - parser_get.add_argument( "_loki_pt_journey_fare", type=OptionValue(['kraken']), @@ -856,9 +826,6 @@ def _set_specific_params(mod): if args.get('_loki_compute_pt_journey_fare') is None: args['_loki_compute_pt_journey_fare'] = mod.loki_compute_pt_journey_fare - if args.get('_use_excluded_zones') is None: - args['_use_excluded_zones'] = app.config['USE_EXCLUDED_ZONES'] - # When computing 'same_journey_schedules'(is_journey_schedules=True), some parameters need to be overridden # because they are contradictory to the request if args.get("is_journey_schedules"): diff --git a/source/jormungandr/jormungandr/interfaces/v1/journey_common.py b/source/jormungandr/jormungandr/interfaces/v1/journey_common.py index 0accbab1f8..c230f0f1f0 100644 --- a/source/jormungandr/jormungandr/interfaces/v1/journey_common.py +++ b/source/jormungandr/jormungandr/interfaces/v1/journey_common.py @@ -30,7 +30,7 @@ # www.navitia.io from __future__ import absolute_import, print_function, unicode_literals, division -from jormungandr import i_manager, fallback_modes, partner_services +from jormungandr import i_manager, fallback_modes, partner_services, app from jormungandr.interfaces.v1.ResourceUri import ResourceUri from datetime import datetime from jormungandr.resources_utils import ResourceUtc @@ -56,6 +56,7 @@ SpeedRange, FloatRange, KeyValueType, + PositiveFloat, ) from navitiacommon import type_pb2 @@ -788,6 +789,34 @@ def __init__(self, output_type_serializer): help="only available for Asgard so far: take into account excluded zones pre-defined in Asgard, " "Warning: this feature may be performance impacting.", ) + parser_get.add_argument( + "_asgard_max_walking_duration_coeff", + type=PositiveFloat(), + default=1.12, + hidden=True, + help="used to adjust the search range in Asgard when computing matrix", + ) + parser_get.add_argument( + "_asgard_max_bike_duration_coeff", + type=PositiveFloat(), + default=2.8, + hidden=True, + help="used to adjust the search range in Asgard when computing matrix", + ) + parser_get.add_argument( + "_asgard_max_bss_duration_coeff", + type=PositiveFloat(), + default=0.46, + hidden=True, + help="used to adjust the search range in Asgard when computing matrix", + ) + parser_get.add_argument( + "_asgard_max_car_duration_coeff", + type=PositiveFloat(), + default=1, + hidden=True, + help="used to adjust the search range in Asgard when computing matrix", + ) def parse_args(self, region=None, uri=None): args = self.parsers['get'].parse_args() @@ -818,6 +847,9 @@ def parse_args(self, region=None, uri=None): if 'last_section_mode' in args and args['last_section_mode']: args['destination_mode'] = args['last_section_mode'] + if args.get('_use_excluded_zones') is None: + args['_use_excluded_zones'] = app.config['USE_EXCLUDED_ZONES'] + if region: if uri: objects = uri.split('/')