î ÍbSã@sâdZddlZddlZddlZddlZddlmZmZddlm Z ddl Z e j ddkrŠddl Z n ddl Z dd„Zdd „Zd d „Zd d „Zdd„Zdd„ZdS)z'applications.py: common classes for ufwéN)ÚdebugÚwarn)ÚUFWErrorécCs&tjj|ƒs-tdƒ}t|ƒ‚nd }i}tj|ƒ}|jƒd}tjdƒ}x¸|D]°}|d|}tjj |ƒsšqnn|j |ƒr½t d|ƒqnn|j dƒs|j d ƒs|j d ƒs|j d ƒs|j d ƒs|j d ƒr+t d|ƒqnnd} ytj |ƒt j} Wn/tk r|tdƒ|} t| ƒwnYnX| |kr©tdƒ|} t| ƒqnn|| |krÙtdƒ|} t| ƒqnn|| 7}tjddkrtjƒ} n tjƒ} y| j|ƒWn/tk rStdƒ|} t| ƒwnYnXxÇ| jƒD]¹} t| ƒdkr™tdƒ| } t| ƒqant| ƒsÅtdƒ| } t| ƒqany1tjj| ƒtdƒ| } t| ƒwaWntk r YnXd} x—| j| ƒD]†\}}t|ƒdkrctdƒ| } t| ƒd} Pnt|ƒdkr!tdƒi| d6|d6} t| ƒd} Pq!q!W| r·qan| |kràtdƒ| } t| ƒni}x'| j| ƒD]\}}|||