Fix RebrickableSet not using url in database for sets

This commit is contained in:
Gregoo 2025-01-24 12:04:15 +01:00
parent 6c342ec3f3
commit d22ca2c7cb
3 changed files with 1 additions and 11 deletions

View File

@ -178,10 +178,6 @@
# Default: https://rebrickable.com/parts/{number}/_/{color}
# BK_REBRICKABLE_LINK_PART_PATTERN=
# Optional: Pattern of the link to Rebrickable for a set. Will be passed to Python .format()
# Default: https://rebrickable.com/sets/{number}
# BK_REBRICKABLE_LINK_SET_PATTERN=
# Optional: Display Rebrickable links wherever applicable
# Default: false
# Legacy name: LINKS

View File

@ -43,7 +43,6 @@ CONFIG: Final[list[dict[str, Any]]] = [
{'n': 'REBRICKABLE_IMAGE_NIL_MINIFIGURE', 'd': 'https://rebrickable.com/static/img/nil_mf.jpg'}, # noqa: E501
{'n': 'REBRICKABLE_LINK_MINIFIGURE_PATTERN', 'd': 'https://rebrickable.com/minifigs/{number}'}, # noqa: E501
{'n': 'REBRICKABLE_LINK_PART_PATTERN', 'd': 'https://rebrickable.com/parts/{number}/_/{color}'}, # noqa: E501
{'n': 'REBRICKABLE_LINK_SET_PATTERN', 'd': 'https://rebrickable.com/sets/{number}'}, # noqa: E501
{'n': 'REBRICKABLE_LINKS', 'e': 'LINKS', 'c': bool},
{'n': 'REBRICKABLE_PAGE_SIZE', 'd': 100, 'c': int},
{'n': 'RETIRED_SETS_FILE_URL', 'd': 'https://docs.google.com/spreadsheets/d/1rlYfEXtNKxUOZt2Mfv0H17DvK7bj6Pe0CuYwq6ay8WA/gviz/tq?tqx=out:csv&sheet=Sorted%20by%20Retirement%20Date'}, # noqa: E501

View File

@ -165,12 +165,7 @@ class RebrickableSet(BrickRecord):
# Compute the url for the rebrickable page
def url_for_rebrickable(self, /) -> str:
if current_app.config['REBRICKABLE_LINKS']:
try:
return current_app.config['REBRICKABLE_LINK_SET_PATTERN'].format( # noqa: E501
number=self.fields.number,
)
except Exception:
pass
return self.fields.url
return ''