Skip to content

Commit 706848e

Browse files
committed
[changes] Rename 'approximate' to 'estimated'
Signed-off-by: DragnEmperor <[email protected]>
1 parent 5a21408 commit 706848e

File tree

20 files changed

+110
-112
lines changed

20 files changed

+110
-112
lines changed

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ the OpenWISP architecture.
4949
user/openvpn.rst
5050
user/subnet-division-rules.rst
5151
user/whois.rst
52-
user/approximate-location.rst
52+
user/estimated-location.rst
5353
user/rest-api.rst
5454
user/settings.rst
5555

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
Approximate Location
2-
====================
1+
Estimated Location
2+
==================
33

44
.. important::
55

6-
The **Approximate Location** feature is **disabled by default**.
6+
The **Estimated Location** feature is **disabled by default**.
77

88
Before enabling it, the :doc:`WHOIS Lookup feature <whois>` must be
99
enabled. Then set
10-
:ref:`OPENWISP_CONTROLLER_APPROXIMATE_LOCATION_ENABLED` to ``True``
10+
:ref:`OPENWISP_CONTROLLER_ESTIMATED_LOCATION_ENABLED` to ``True``
1111

1212
.. contents:: **Table of contents**:
1313
:depth: 1
@@ -16,20 +16,20 @@ Approximate Location
1616
Overview
1717
--------
1818

19-
The Approximate Location feature automatically creates or updates a
20-
device’s location based on latitude and longitude information retrieved
21-
from the WHOIS Lookup feature.
19+
The Estimated Location feature automatically creates or updates a device’s
20+
location based on latitude and longitude information retrieved from the
21+
WHOIS Lookup feature.
2222

2323
Trigger Conditions
2424
------------------
2525

26-
Approximate Location is triggered when:
26+
Estimated Location is triggered when:
2727

2828
- A **fresh WHOIS lookup** is performed for a device.
2929
- Or when a WHOIS record already exists for the device’s IP **and**:
3030

3131
- The device’s last IP address is **public**.
32-
- WHOIS lookup and Approximate Location is **enabled** for the device’s
32+
- WHOIS lookup and Estimated Location is **enabled** for the device’s
3333
organization.
3434

3535
Behavior
@@ -40,13 +40,13 @@ another device with same ip to the current device if:
4040

4141
- Only one device is found with that IP and it has a location.
4242
- The current device **has no location** or that location is
43-
**approximate**.
43+
**estimated**.
4444

4545
If there are multiple devices with location for the same IP, the system
4646
will **not attach any location** to the current device and a notification
4747
will be sent suggesting the user to manually assign/create a location for
4848
the device.
4949

50-
If there is **no matching location**, a new approximate location is
51-
created or the existing one is updated using coordinates from the WHOIS
52-
record, but only if the existing location is approximate.
50+
If there is **no matching location**, a new estimated location is created
51+
or the existing one is updated using coordinates from the WHOIS record,
52+
but only if the existing location is estimated.

docs/user/settings.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -796,19 +796,19 @@ Maxmind Account ID required for the :doc:`WHOIS Lookup feature <whois>`.
796796

797797
Maxmind License Key required for the :doc:`WHOIS Lookup feature <whois>`.
798798

799-
.. _openwisp_controller_whois_approximate_location_enabled:
799+
.. _openwisp_controller_whois_estimated_location_enabled:
800800

801-
``OPENWISP_CONTROLLER_WHOIS_APPROXIMATE_LOCATION_ENABLED``
802-
----------------------------------------------------------
801+
``OPENWISP_CONTROLLER_WHOIS_ESTIMATED_LOCATION_ENABLED``
802+
--------------------------------------------------------
803803

804804
============ =========
805805
**type**: ``bool``
806806
**default**: ``False``
807807
============ =========
808808

809-
Allows enabling the optional :doc:`Approximate Location feature
810-
<approximate-location>`.
809+
Allows enabling the optional :doc:`Estimated Location feature
810+
<estimated-location>`.
811811

812-
.. image:: https://raw.githubusercontent.com/openwisp/openwisp-controller/docs/docs/1.3/approximate-location-setting.png
813-
:target: https://raw.githubusercontent.com/openwisp/openwisp-controller/docs/docs/1.3/approximate-location-setting.png
814-
:alt: Approximate Location setting
812+
.. image:: https://raw.githubusercontent.com/openwisp/openwisp-controller/docs/docs/1.3/estimated-location-setting.png
813+
:target: https://raw.githubusercontent.com/openwisp/openwisp-controller/docs/docs/1.3/estimated-location-setting.png
814+
:alt: Estimated Location setting

openwisp_controller/config/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ def get_fields(self, request, obj=None):
13841384
if app_settings.REGISTRATION_ENABLED:
13851385
fields += ["registration_enabled", "shared_secret"]
13861386
if app_settings.WHOIS_CONFIGURED:
1387-
fields += ["whois_enabled", "approximate_location_enabled"]
1387+
fields += ["whois_enabled", "estimated_location_enabled"]
13881388
fields += ["context"]
13891389
return fields
13901390

openwisp_controller/config/base/multitenancy.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ class AbstractOrganizationConfigSettings(UUIDModel):
3939
fallback=app_settings.WHOIS_ENABLED,
4040
verbose_name=_("WHOIS Enabled"),
4141
)
42-
approximate_location_enabled = FallbackBooleanChoiceField(
43-
help_text=_("Whether the approximate location feature is enabled"),
44-
fallback=app_settings.APPROXIMATE_LOCATION_ENABLED,
45-
verbose_name=_("Approximate Location Enabled"),
42+
estimated_location_enabled = FallbackBooleanChoiceField(
43+
help_text=_("Whether the estimated location feature is enabled"),
44+
fallback=app_settings.ESTIMATED_LOCATION_ENABLED,
45+
verbose_name=_("Estimated Location Enabled"),
4646
)
4747
context = JSONField(
4848
blank=True,
@@ -76,11 +76,11 @@ def clean(self):
7676
)
7777
}
7878
)
79-
if not self.whois_enabled and self.approximate_location_enabled:
79+
if not self.whois_enabled and self.estimated_location_enabled:
8080
raise ValidationError(
8181
{
82-
"approximate_location_enabled": _(
83-
"Approximate Location feature requires "
82+
"estimated_location_enabled": _(
83+
"Estimated Location feature requires "
8484
"WHOIS Lookup feature to be enabled."
8585
)
8686
}

openwisp_controller/config/migrations/0062_organizationconfigsettings_approximate_location_enabled_and_more.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ class Migration(migrations.Migration):
1515
operations = [
1616
migrations.AddField(
1717
model_name="organizationconfigsettings",
18-
name="approximate_location_enabled",
18+
name="estimated_location_enabled",
1919
field=openwisp_utils.fields.FallbackBooleanChoiceField(
2020
blank=True,
2121
default=None,
2222
fallback=False,
23-
help_text="Whether the approximate location feature is enabled",
23+
help_text="Whether the estimated location feature is enabled",
2424
null=True,
25-
verbose_name="Approximate Location Enabled",
25+
verbose_name="Estimated Location Enabled",
2626
),
2727
),
2828
migrations.AddField(

openwisp_controller/config/settings.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ def get_setting(option, default):
7777
"WHOIS_GEOIP_ACCOUNT and WHOIS_GEOIP_KEY must be set "
7878
+ "when WHOIS_ENABLED is True."
7979
)
80-
APPROXIMATE_LOCATION_ENABLED = get_setting("APPROXIMATE_LOCATION_ENABLED", False)
81-
if APPROXIMATE_LOCATION_ENABLED and not WHOIS_ENABLED:
80+
ESTIMATED_LOCATION_ENABLED = get_setting("ESTIMATED_LOCATION_ENABLED", False)
81+
if ESTIMATED_LOCATION_ENABLED and not WHOIS_ENABLED:
8282
raise ImproperlyConfigured(
83-
"WHOIS must be enabled before enabling APPROXIMATE_LOCATION globally"
83+
"WHOIS must be enabled before enabling ESTIMATED_LOCATION globally"
8484
)

openwisp_controller/config/whois/service.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from openwisp_controller.config import settings as app_settings
88

9-
from .tasks import fetch_whois_details, manage_approximate_locations
9+
from .tasks import fetch_whois_details, manage_estimated_locations
1010

1111

1212
class WHOISService:
@@ -73,16 +73,16 @@ def is_whois_enabled(self):
7373
return getattr(org_settings, "whois_enabled", app_settings.WHOIS_ENABLED)
7474

7575
@property
76-
def is_approximate_location_enabled(self):
76+
def is_estimated_location_enabled(self):
7777
"""
78-
Check if the Approximate location feature is enabled.
78+
Check if the Estimated location feature is enabled.
7979
This does not require to set cache as `is_whois_enabled` already sets it
8080
"""
8181
org_settings = cache.get(self.get_cache_key(org_id=self.device.organization.pk))
8282
return getattr(
8383
org_settings,
84-
"approximate_location_enabled",
85-
app_settings.APPROXIMATE_LOCATION_ENABLED,
84+
"estimated_location_enabled",
85+
app_settings.ESTIMATED_LOCATION_ENABLED,
8686
)
8787

8888
def _need_whois_lookup(self, new_ip):
@@ -105,9 +105,9 @@ def _need_whois_lookup(self, new_ip):
105105

106106
return self.is_whois_enabled
107107

108-
def _need_approximate_location_management(self, new_ip):
108+
def _need_estimated_location_management(self, new_ip):
109109
"""
110-
Used to determine if Approximate locations need to be created/updated
110+
Used to determine if Estimated locations need to be created/updated
111111
or not during WHOIS lookup.
112112
"""
113113
if not self.is_valid_public_ip_address(new_ip):
@@ -116,7 +116,7 @@ def _need_approximate_location_management(self, new_ip):
116116
if not self.is_whois_enabled:
117117
return False
118118

119-
return self.is_approximate_location_enabled
119+
return self.is_estimated_location_enabled
120120

121121
def get_device_whois_info(self):
122122
"""
@@ -145,10 +145,10 @@ def trigger_whois_lookup(self):
145145
)
146146
# `add_existing` is `True` to handle the case when WHOIS already exists
147147
# as in that case WHOIS lookup is not triggered but we still need to
148-
# manage approximate locations.
149-
elif self._need_approximate_location_management(new_ip):
148+
# manage estimated locations.
149+
elif self._need_estimated_location_management(new_ip):
150150
transaction.on_commit(
151-
lambda: manage_approximate_locations.delay(
151+
lambda: manage_estimated_locations.delay(
152152
device_pk=self.device.pk, ip_address=new_ip, add_existing=True
153153
)
154154
)

openwisp_controller/config/whois/tasks.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
from geoip2 import webservice as geoip2_webservice
88
from swapper import load_model
99

10-
from openwisp_controller.geo.approximate_location.tasks import (
11-
manage_approximate_locations,
12-
)
10+
from openwisp_controller.geo.estimated_location.tasks import manage_estimated_locations
1311
from openwisp_utils.tasks import OpenwispCeleryTask
1412

1513
from .. import settings as app_settings
@@ -126,8 +124,8 @@ def fetch_whois_details(self, device_pk, initial_ip_address, new_ip_address):
126124
whois_obj.save()
127125
logger.info(f"Successfully fetched WHOIS details for {new_ip_address}.")
128126

129-
if device._get_organization__config_settings().approximate_location_enabled:
130-
manage_approximate_locations.delay(
127+
if device._get_organization__config_settings().estimated_location_enabled:
128+
manage_estimated_locations.delay(
131129
device_pk=device_pk, ip_address=new_ip_address
132130
)
133131

openwisp_controller/config/whois/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"location_error": {
2424
"message": _(
25-
"Unable to create approximate location for device "
25+
"Unable to create estimated location for device "
2626
"[{notification.target}]({notification.target_link}). "
2727
"Please assign/create a location manually."
2828
),

0 commit comments

Comments
 (0)