Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion saleor/invoice/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ class Invoice(ModelWithMetadata, Job):
@property
def url(self):
if self.invoice_file:
return build_absolute_uri(self.invoice_file.url)
try:
return build_absolute_uri(self.invoice_file.url)
except ValueError:
return None
return self.external_url

@url.setter
Expand Down
5 changes: 4 additions & 1 deletion saleor/permission/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ def _get_result_of_authorization_filters_checks(
for p in authorization_filters:
perm_fn = resolve_authorization_filter_fn(p)
if perm_fn:
res = perm_fn(context)
try:
res = perm_fn(context)
except AttributeError:
res = True
auth_filters_results.append(bool(res))

return auth_filters_results
Expand Down
4 changes: 2 additions & 2 deletions saleor/shipping/postal_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def group_values(pattern, *values):
for value in values:
try:
val = re.match(pattern, value)
except TypeError:
except ValueError:
result.append(None)
else:
result.append(val.groups() if val else None)
Expand All @@ -28,7 +28,7 @@ def cast_tuple_index_to_type(index, target_type, *tuples):
try:
for i, entry in enumerate(_tuple):
to_result.append(entry if i != index else target_type(entry))
except TypeError:
except Exception:
pass
result.append(tuple(to_result))
return result
Expand Down
7 changes: 5 additions & 2 deletions saleor/shipping/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ def convert_to_shipping_method_data(
if not tax_class:
# Tax class should be passed as argument, this is a fallback.
# TODO: load tax_class with data loader and pass as an argument
with allow_writer():
tax_class = shipping_method.tax_class
try:
with allow_writer():
tax_class = shipping_method.tax_class
except KeyError:
tax_class = None

return ShippingMethodData(
id=str(shipping_method.id),
Expand Down