<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
3
YÉjo  ã               @   s¦   d Z ddddgZddlZddlZddlZddlmZ ddlmZ dd	lm	Z	 dd
l
mZ ddlmZ ddlmZ G dd„ dejƒZedd„ ƒZedd„ ƒZdd„ ZdS )z>This module contains decorators for use with and without D-BusÚFirewallDBusExceptionÚhandle_exceptionsÚdbus_handle_exceptionsÚdbus_service_methodé    N)ÚDBusException)Ú	decorator)Úconfig)ÚFirewallError)Úerrors)Úlogc               @   s   e Zd Zd Zdejj ZdS )r   z%s.ExceptionN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚdbusZDBUS_INTERFACEZ_dbus_error_name© r   r   ú /usr/lib/python3.6/decorators.pyr   +   s   c             O   sd   y
| ||ŽS  t k
rD } ztjtjƒ ƒ tj|ƒ W Y dd}~X n tk
r^   tjƒ  Y nX dS )zTDecorator to handle exceptions and log them. Used if not conneced
    to D-Bus.
    N)r	   r   Údebug1Ú	tracebackÚ
format_excÚerrorÚ	ExceptionÚ	exception)ÚfuncÚargsÚkwargsr   r   r   r   r   /   s    
c             O   sè   y
| ||ŽS  t k
rŠ } zdt jt|ƒƒ}|tjtjtjtjgkrRtj	t|ƒƒ ntj
tjƒ ƒ tjt|ƒƒ tt|ƒƒ‚W Y dd}~X nZ tk
r® } z
|‚W Y dd}~X n6 tk
râ } ztjƒ  tt|ƒƒ‚W Y dd}~X nX dS )z‚Decorator to handle exceptions, log and report them into D-Bus

    :Raises DBusException: on a firewall error code problems.
    N)r	   Úget_codeÚstrr
   ZALREADY_ENABLEDZNOT_ENABLEDZZONE_ALREADY_SETZALREADY_SETr   Zwarningr   r   r   r   r   r   r   r   )r   r   r   r   ÚcodeZexr   r   r   r   <   s    

c              O   s   |j ddƒ tjj| |ŽS )zAdd sender argument for D-BusZsender_keywordZsender)Ú
setdefaultr   ZserviceÚmethod)r   r   r   r   r   r   T   s    )r   Ú__all__r   Zdbus.servicer   Zdbus.exceptionsr   r   Zfirewallr   Zfirewall.errorsr	   r
   Zfirewall.core.loggerr   r   r   r   r   r   r   r   r   Ú<module>   s   