File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 6060
6161loaded_valid_sites = valid_l10n_mappings ().keys ()
6262valid_sites = valid_sites .union (set (loaded_valid_sites ))
63-
6463live_sites = []
6564
6665
Original file line number Diff line number Diff line change @@ -219,12 +219,13 @@ def create_localized_faker(self, country_code: str):
219219 """
220220
221221 # Check if locale exists, otherwise return None
222- locale = next (filter (lambda x : country_code in x , AVAILABLE_LOCALES [:: - 1 ]), None )
222+ locales = list (filter (lambda x : country_code in x , AVAILABLE_LOCALES ) )
223223
224- if not locale :
224+ if not locales :
225225 logging .error (f"Invalid country code `{ country_code } `. No faker instance created." )
226226 return None # No fallback
227227
228+ locale = next (filter (lambda x : 'en' in x , locales ), locales [- 1 ])
228229 try :
229230 # seed to get consistent data
230231 if self .fake is None :
@@ -299,7 +300,7 @@ def fake_autofill_data(self, country_code) -> AutofillAddressBase:
299300 getattr (fake , valid_attribute )() if valid_attribute else valid_attribute
300301 )
301302 address_level_2 = fake .city ()
302- postal_code = fake .postcode ()[: 4 ]
303+ postal_code = fake .postcode ()
303304 country = fake .current_country ()
304305 email = fake .email ()
305306 telephone = self .generate_localized_phone (country_code , fake )
You can’t perform that action at this time.
0 commit comments