From 232fe3f2e0d6c513e124b434b7198bd0cafbc36e Mon Sep 17 00:00:00 2001 From: bashmak Date: Mon, 4 Sep 2017 14:56:57 +0300 Subject: [PATCH] =?UTF-8?q?REFACTOR:=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=20?= =?UTF-8?q?=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=81=D0=BE=D0=BB=D1=8C=20=D1=82?= =?UTF-8?q?=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20=D0=B5=D1=81=D0=BB=D0=B8=20?= =?UTF-8?q?=D0=B5=D1=81=D1=82=D1=8C=20=D1=87=D1=82=D0=BE=20=D0=B2=D1=8B?= =?UTF-8?q?=D0=B2=D0=BE=D0=B4=D0=B8=D1=82=D1=8C.=20=D0=95=D1=81=D0=BB?= =?UTF-8?q?=D0=B8=20=D1=81=D0=BF=D0=B8=D1=81=D0=BE=D0=BA=20=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=BA=20=D0=B4=D0=BB=D1=8F=20=D1=83=D0=B4=D0=B0?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=B5=200=20=D1=82=D0=BE=20=D1=82=D0=BE=D0=B3=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=BF=D0=B8=D1=88=D0=B5=D0=BC=20=D0=BD=D0=B0=D0=B7=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=81=D0=BF=D0=B8=D1=81=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B8=20=D1=83=D0=B4=D0=B0=D0=BB=D1=8F=D0=B5=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent/core.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/agent/core.py b/agent/core.py index f984105..3b04294 100644 --- a/agent/core.py +++ b/agent/core.py @@ -124,11 +124,13 @@ class BaseTransmitter(metaclass=ABCMeta): def sync_nas(self, users_from_db): list_for_add, list_for_del = self._diff_users(users_from_db) - print('FOR DELETE') - for ld in list_for_del: - print(ld) - print('FOR ADD') - for la in list_for_add: - print(la) - self.remove_user_range( list_for_del ) - self.add_user_range( list_for_add ) + if len(list_for_del) > 0: + print('FOR DELETE') + for ld in list_for_del: + print(ld) + self.remove_user_range(list_for_del) + if len(list_for_add) > 0: + print('FOR ADD') + for la in list_for_add: + print(la) + self.add_user_range(list_for_add)