diff --git a/core/models/orm_models/Location.py b/core/models/orm_models/Location.py index 26d449a..39d8293 100644 --- a/core/models/orm_models/Location.py +++ b/core/models/orm_models/Location.py @@ -58,12 +58,14 @@ class Location(BaseModel): def supports_protocol(self, enum_value: ProtocolChoice|str) -> bool: """Check if a given location supports a given protocol""" + + print(f"enum_value is {enum_value}") if enum_value is None: return False # socks5 proxy name doesn't match 'proxy' - if enum_value == ProtocolChoice.SOCK5_PROXY: + if enum_value in (ProtocolChoice.TOR, "tor", ProtocolChoice.SOCK5_PROXY): return self.is_proxy_capable if isinstance(enum_value, ProtocolChoice): @@ -72,8 +74,11 @@ class Location(BaseModel): string_version = enum_value field_name = f'is_{string_version}_capable' - return bool(getattr(self, field_name)) - + try: + return bool(getattr(self, field_name)) + except Exception as e: + print(str(e)) + return False # to use: # Lookup by location/city codes