imio.smartweb.common 1.2.39__py3-none-any.whl → 1.2.40__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- imio/smartweb/common/tests/test_utils.py +16 -0
- imio/smartweb/common/utils.py +13 -1
- {imio_smartweb_common-1.2.39.dist-info → imio_smartweb_common-1.2.40.dist-info}/METADATA +9 -1
- {imio_smartweb_common-1.2.39.dist-info → imio_smartweb_common-1.2.40.dist-info}/RECORD +10 -10
- /imio.smartweb.common-1.2.39-py3.12-nspkg.pth → /imio.smartweb.common-1.2.40-py3.13-nspkg.pth +0 -0
- {imio_smartweb_common-1.2.39.dist-info → imio_smartweb_common-1.2.40.dist-info}/WHEEL +0 -0
- {imio_smartweb_common-1.2.39.dist-info → imio_smartweb_common-1.2.40.dist-info}/licenses/LICENSE.GPL +0 -0
- {imio_smartweb_common-1.2.39.dist-info → imio_smartweb_common-1.2.40.dist-info}/licenses/LICENSE.rst +0 -0
- {imio_smartweb_common-1.2.39.dist-info → imio_smartweb_common-1.2.40.dist-info}/namespace_packages.txt +0 -0
- {imio_smartweb_common-1.2.39.dist-info → imio_smartweb_common-1.2.40.dist-info}/top_level.txt +0 -0
|
@@ -102,6 +102,22 @@ class TestUtils(unittest.TestCase):
|
|
|
102
102
|
self.assertEqual(obj.geolocation.latitude, 1)
|
|
103
103
|
self.assertEqual(obj.geolocation.longitude, 2)
|
|
104
104
|
|
|
105
|
+
def test_geocode_object_geocoder_unavailable(self):
|
|
106
|
+
obj = GeolocatedObject()
|
|
107
|
+
obj.street = "Test Street"
|
|
108
|
+
obj.number = "1"
|
|
109
|
+
obj.complement = ""
|
|
110
|
+
obj.zipcode = "12345"
|
|
111
|
+
obj.city = "Testville"
|
|
112
|
+
obj.country = "be"
|
|
113
|
+
with patch("geopy.geocoders.Nominatim") as mock_nominatim, patch(
|
|
114
|
+
"geopy.exc.GeocoderUnavailable", new=geopy.exc.GeocoderUnavailable
|
|
115
|
+
):
|
|
116
|
+
instance = mock_nominatim.return_value
|
|
117
|
+
instance.geocode.side_effect = geopy.exc.GeocoderUnavailable
|
|
118
|
+
result = geocode_object(obj)
|
|
119
|
+
self.assertFalse(result)
|
|
120
|
+
|
|
105
121
|
def test_get_uncroppable_scales_infos(self):
|
|
106
122
|
folder = api.content.create(
|
|
107
123
|
container=self.portal,
|
imio/smartweb/common/utils.py
CHANGED
|
@@ -14,6 +14,7 @@ from plone.namedfile.field import NamedBlobImage
|
|
|
14
14
|
from plone.namedfile.interfaces import IAvailableSizes
|
|
15
15
|
from urllib.parse import urlparse
|
|
16
16
|
from zope.component import getUtility
|
|
17
|
+
from zope.globalrequest import getRequest
|
|
17
18
|
from zope.i18n import translate
|
|
18
19
|
from zope.schema import getFields
|
|
19
20
|
from zope.schema.interfaces import IVocabularyFactory
|
|
@@ -77,7 +78,18 @@ def geocode_object(obj):
|
|
|
77
78
|
if not address:
|
|
78
79
|
return
|
|
79
80
|
geolocator = geopy.geocoders.Nominatim(user_agent="contact@imio.be", timeout=3)
|
|
80
|
-
location =
|
|
81
|
+
location = None
|
|
82
|
+
try:
|
|
83
|
+
location = geolocator.geocode(address)
|
|
84
|
+
except geopy.exc.GeocoderUnavailable:
|
|
85
|
+
api.portal.show_message(
|
|
86
|
+
_(
|
|
87
|
+
"Error: Geolocation service is unavailable. Your content is not geocoded."
|
|
88
|
+
),
|
|
89
|
+
request=getRequest(),
|
|
90
|
+
type="warning",
|
|
91
|
+
)
|
|
92
|
+
return False
|
|
81
93
|
if location:
|
|
82
94
|
obj.geolocation = Geolocation(
|
|
83
95
|
latitude=location.latitude, longitude=location.longitude
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: imio.smartweb.common
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.40
|
|
4
4
|
Summary: Common utilities, vocabularies, taxonomies for imio.smartweb & co products
|
|
5
5
|
Home-page: https://github.com/imio/imio.smartweb.common
|
|
6
6
|
Author: iMio
|
|
@@ -178,6 +178,14 @@ Changelog
|
|
|
178
178
|
=========
|
|
179
179
|
|
|
180
180
|
|
|
181
|
+
1.2.40 (2025-11-05)
|
|
182
|
+
-------------------
|
|
183
|
+
|
|
184
|
+
- Catch Exception on geocoding to avoid blocking content creation
|
|
185
|
+
if geopy service is down
|
|
186
|
+
[remdub]
|
|
187
|
+
|
|
188
|
+
|
|
181
189
|
1.2.39 (2025-11-03)
|
|
182
190
|
-------------------
|
|
183
191
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
imio.smartweb.common-1.2.
|
|
1
|
+
imio.smartweb.common-1.2.40-py3.13-nspkg.pth,sha256=XZ3YhlzwpUCC8tXtelHRqxVxo3NWomIiMsUfUshrbeE,1011
|
|
2
2
|
imio/smartweb/common/__init__.py,sha256=Na9XBfEQUMrm2c5jbqQgwWeg40ih0aXVG1vT8NeAjMQ,2709
|
|
3
3
|
imio/smartweb/common/adapters.py,sha256=dG4MALuHPQI6lTeNvs5p4vVOxHoBBYaWN6g8J96KxzQ,1507
|
|
4
4
|
imio/smartweb/common/adapters.zcml,sha256=VO3luZDtRL9FIIEghxPrqpx8paZF3m6MGEy-8kF1sOQ,437
|
|
@@ -20,7 +20,7 @@ imio/smartweb/common/subscribers.zcml,sha256=8v2lqNNVAHlrh2G3jtjVgr3Asrw8WJLS9jS
|
|
|
20
20
|
imio/smartweb/common/testing.py,sha256=GKlYMHJUSxZFVX0o_R_c_Au1VYlkd-GjykQqfONHv7I,1985
|
|
21
21
|
imio/smartweb/common/testing.zcml,sha256=7N-ALtklyWeLSzZmlxN2Tp-aZe_3An--w_6BGl1991E,172
|
|
22
22
|
imio/smartweb/common/utility_overrides.zcml,sha256=Nn1q1FwQUyktB-EJM2qzPfsc-zUmHxX0Gj9OQTlYKQM,413
|
|
23
|
-
imio/smartweb/common/utils.py,sha256=
|
|
23
|
+
imio/smartweb/common/utils.py,sha256=Or5oV0l33wuoc9-Y4WDeVjXzGgluFZVyQWBoc_PRUjo,8195
|
|
24
24
|
imio/smartweb/common/vocabularies.py,sha256=L4H73GQxLbIRZOpn_fHBU4-J-gY6BeiYjDyU90jV0U8,4809
|
|
25
25
|
imio/smartweb/common/vocabularies.zcml,sha256=hnsIJYrof0k4gCj1wAJQtekXznvfFHIQXu-58eqXevk,1306
|
|
26
26
|
imio/smartweb/common/widgets.zcml,sha256=GQ0aJblx44OJpj0HGXiyQJnFeSaJlOTMd1RAZn_1Qgk,375
|
|
@@ -104,7 +104,7 @@ imio/smartweb/common/tests/test_setup.py,sha256=TxoQZrESFOgGRBN9uO8FzEOx57G550YI
|
|
|
104
104
|
imio/smartweb/common/tests/test_subscribers.py,sha256=AiJ5LTqGP2JKGJFYNeCCAMJL53DWO41iYQ9VYiA7DIA,1699
|
|
105
105
|
imio/smartweb/common/tests/test_taxonomy.py,sha256=z4WawTa_hIsW7kVqQSlGBDWSnkeHAa2CPYFkfjZ0oRg,2600
|
|
106
106
|
imio/smartweb/common/tests/test_text.py,sha256=Ll6TYnYxEBtpYe3T0yTOVT9wXWJaWGWW23eUV2jK92A,1570
|
|
107
|
-
imio/smartweb/common/tests/test_utils.py,sha256=
|
|
107
|
+
imio/smartweb/common/tests/test_utils.py,sha256=7cYVfHCxsty6U1UgW1Knzpi1yfzb8IG4TLVDQ2AZ6c8,9946
|
|
108
108
|
imio/smartweb/common/tests/test_viewlets.py,sha256=NVEZWEmYo4K_-81Q6w-JTx2nT_3NBcJCl3946MAUnhU,1738
|
|
109
109
|
imio/smartweb/common/tests/test_vocabularies.py,sha256=C-78USTvOHljuMSLkNb9onSRxLEJmBQLpktetAO74RE,848
|
|
110
110
|
imio/smartweb/common/tests/test_vocabulary.py,sha256=4E5i5znt_hLhnnRay1iBaOZRmQyFJs8-OMdPm4iSGSg,1638
|
|
@@ -151,10 +151,10 @@ imio/smartweb/common/viewlets/skip_to_content.py,sha256=wm22NUf8Qh5uzz8p4vkLCdFN
|
|
|
151
151
|
imio/smartweb/common/widgets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
152
152
|
imio/smartweb/common/widgets/select.py,sha256=5sV0UIgwu4AvwpgVmJeSZwUWz7OPD9VxYMowfmjcfbA,1313
|
|
153
153
|
imio/smartweb/common/widgets/templates/ajaxselect_display.pt,sha256=v8TT2Xc19er6SUGWabgNfIdrayFYIjxyLK9H_XkIG3M,1209
|
|
154
|
-
imio_smartweb_common-1.2.
|
|
155
|
-
imio_smartweb_common-1.2.
|
|
156
|
-
imio_smartweb_common-1.2.
|
|
157
|
-
imio_smartweb_common-1.2.
|
|
158
|
-
imio_smartweb_common-1.2.
|
|
159
|
-
imio_smartweb_common-1.2.
|
|
160
|
-
imio_smartweb_common-1.2.
|
|
154
|
+
imio_smartweb_common-1.2.40.dist-info/licenses/LICENSE.GPL,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
|
|
155
|
+
imio_smartweb_common-1.2.40.dist-info/licenses/LICENSE.rst,sha256=5dd78Fdt0e-oM2ICBrMpjHnT8vEP-jhBDF7akXni6B4,655
|
|
156
|
+
imio_smartweb_common-1.2.40.dist-info/METADATA,sha256=bbUZwn_XP16TqLQeimrjRCkdjBeW7sHPRhmdgfXH-k0,19254
|
|
157
|
+
imio_smartweb_common-1.2.40.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
158
|
+
imio_smartweb_common-1.2.40.dist-info/namespace_packages.txt,sha256=Pg8AH8t9viMMW1hJbNZvTy_n2jXG2igIYUpon5RA4Js,19
|
|
159
|
+
imio_smartweb_common-1.2.40.dist-info/top_level.txt,sha256=ZktC0EGzThvMTAin9_q_41rzvvfMT2FYbP8pbhSLMSA,5
|
|
160
|
+
imio_smartweb_common-1.2.40.dist-info/RECORD,,
|
/imio.smartweb.common-1.2.39-py3.12-nspkg.pth → /imio.smartweb.common-1.2.40-py3.13-nspkg.pth
RENAMED
|
File without changes
|
|
File without changes
|
{imio_smartweb_common-1.2.39.dist-info → imio_smartweb_common-1.2.40.dist-info}/licenses/LICENSE.GPL
RENAMED
|
File without changes
|
{imio_smartweb_common-1.2.39.dist-info → imio_smartweb_common-1.2.40.dist-info}/licenses/LICENSE.rst
RENAMED
|
File without changes
|
|
File without changes
|
{imio_smartweb_common-1.2.39.dist-info → imio_smartweb_common-1.2.40.dist-info}/top_level.txt
RENAMED
|
File without changes
|