Skip to content

Commit

Permalink
removed decorator
Browse files Browse the repository at this point in the history
removed the old decorator

Signed-off-by: Alex <[email protected]>
#744
  • Loading branch information
agmes4 committed Sep 18, 2024
1 parent 5e4bfec commit 1c6b326
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 1 addition & 5 deletions pycroft/lib/mpsk_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@
# the Apache License, Version 2.0. See the LICENSE file for details
from pycroft.model.mpsk_client import MPSKClient
from pycroft.model.user import User
from pycroft.model.session import with_transaction, session
from pycroft.model.session import session
from pycroft.lib.logging import log_user_event
from pycroft.helpers.i18n import deferred_gettext


@with_transaction
def mpsk_delete(host: MPSKClient, processor: User) -> None:
message = deferred_gettext("Deleted host '{}'.").format(host.name)
log_user_event(author=processor, user=host.owner, message=message.to_json())

session.delete(host)


@with_transaction
def change_mac(client: MPSKClient, mac: str, processor: User) -> MPSKClient:
"""
This method will change the mac address of the given interface to the new
Expand All @@ -35,7 +33,6 @@ def change_mac(client: MPSKClient, mac: str, processor: User) -> MPSKClient:
return client


@with_transaction
def mpsk_client_create(owner: User, name: str, mac: str, processor: User) -> MPSKClient:
client = MPSKClient(name=name, owner_id=owner.id, mac=mac)

Expand All @@ -51,7 +48,6 @@ def mpsk_client_create(owner: User, name: str, mac: str, processor: User) -> MPS
return client


@with_transaction
def mpsk_edit(client: MPSKClient, owner: User, name: str, mac: str, processor: User) -> None:
if client.name != name:
message = deferred_gettext("Changed name of client '{}' to '{}'.").format(client.name, name)
Expand Down
5 changes: 2 additions & 3 deletions web/blueprints/mpskclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def default_response() -> ResponseReturnValue:

with abort_on_error(default_response), session.session.begin_nested():
lib_mpsk.mpsk_edit(mpsk, mpsk.owner, form.name.data, form.mac.data, current_user)
session.session.add(mpsk)
session.session.commit()
flash("MPSK Client erfolgreich bearbeitet.", "success")
return redirect(url_for("user.user_show", user_id=mpsk.owner_id, _anchor="mpsks"))
Expand All @@ -133,9 +134,7 @@ def user_clients_json(user_id: int) -> ResponseReturnValue:
).model_dump()


def _mpsk_row(client, user_id: int) -> MPSKRow:
# println(f"{client}")
# client = get_wlan_host_or_404(client)
def _mpsk_row(client: MPSKClient, user_id: int) -> MPSKRow:
return MPSKRow(
id=client.id,
name=client.name,
Expand Down

0 comments on commit 1c6b326

Please sign in to comment.