Skip to content

Commit

Permalink
rename new @connection_dependent decorator accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasjuhrich committed Sep 28, 2023
1 parent a6b4d7b commit b7d63aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sipa/model/fancy_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def unsupported_prop(func):
return property(lambda self: UnsupportedProperty(name=func.__name__))


def connection_dependent_(func):
def connection_dependent(func):
"""A decorator to “deactivate” the property if the user's not active."""

@wraps(func)
Expand Down
8 changes: 4 additions & 4 deletions sipa/model/pycroft/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
ActiveProperty,
UnsupportedProperty,
Capabilities,
connection_dependent_,
connection_dependent,
)
from sipa.model.misc import PaymentDetails
from sipa.model.exceptions import UserNotFound, PasswordInvalid, \
Expand Down Expand Up @@ -110,13 +110,13 @@ def login(self) -> ActiveProperty[str, str]:
return ActiveProperty[str, str](name="login", value=self.user_data.login)

@property
@connection_dependent_
@connection_dependent
def ips(self) -> ActiveProperty[str, str]:
ips = sorted(ip for i in self.user_data.interfaces for ip in i.ips)
return ActiveProperty[str, str](name="ips", value=", ".join(ips))

@property
@connection_dependent_
@connection_dependent
def mac(self) -> ActiveProperty[str, str]:
macs = ", ".join(i.mac for i in self.user_data.interfaces)
return ActiveProperty[str, str](
Expand All @@ -138,7 +138,7 @@ def change_mac_address(self, new_mac, host_name):
raise MacAlreadyExists

@property
@connection_dependent_
@connection_dependent
def network_access_active(self) -> ActiveProperty[bool, bool]:
can_edit = (
self.user_data.room is not None
Expand Down

0 comments on commit b7d63aa

Please sign in to comment.