diff --git a/server/src/uds/REST/__init__.py b/server/src/uds/REST/__init__.py index ee7aa8cc..b03c912e 100644 --- a/server/src/uds/REST/__init__.py +++ b/server/src/uds/REST/__init__.py @@ -38,7 +38,16 @@ from django.views.decorators.csrf import csrf_exempt from django.utils.decorators import method_decorator from django.utils.translation import ugettext as _, activate from django.conf import settings -from uds.REST.handlers import Handler, HandlerError, AccessDenied, NotFound, RequestError, ResponseError, NotSupportedError + +from .handlers import ( + Handler, + HandlerError, + AccessDenied, + NotFound, + RequestError, + ResponseError, + NotSupportedError +) from . import processors diff --git a/server/src/uds/REST/methods/accounts.py b/server/src/uds/REST/methods/accounts.py index 6fb17292..41ebf5cf 100644 --- a/server/src/uds/REST/methods/accounts.py +++ b/server/src/uds/REST/methods/accounts.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2017 Virtual Cable S.L. +# Copyright (c) 2017-2019 Virtual Cable S.L. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -30,8 +30,6 @@ """ @itemor: Adolfo Gómez, dkmaster at dkmon dot com """ -from __future__ import unicode_literals - import datetime import logging @@ -66,13 +64,13 @@ class Accounts(ModelHandler): {'tags': {'title': _('tags'), 'visible': False}}, ] - def item_as_dict(self, account): + def item_as_dict(self, item): return { - 'id': account.uuid, - 'name': account.name, - 'tags': [tag.tag for tag in account.tags.all()], - 'comments': account.comments, - 'time_mark': account.time_mark, + 'id': item.uuid, + 'name': item.name, + 'tags': [tag.tag for tag in item.tags.all()], + 'comments': item.comments, + 'time_mark': item.time_mark, 'permission': permissions.getEffectivePermission(self._user, account) } @@ -82,7 +80,6 @@ class Accounts(ModelHandler): def timemark(self, item): item.time_mark = datetime.datetime.now() item.save() - return def clear(self, item): self.ensureAccess(item, permissions.PERMISSION_MANAGEMENT) diff --git a/server/src/uds/REST/methods/accountsusage.py b/server/src/uds/REST/methods/accountsusage.py index 74ce09fa..5af98735 100644 --- a/server/src/uds/REST/methods/accountsusage.py +++ b/server/src/uds/REST/methods/accountsusage.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2017 Virtual Cable S.L. +# Copyright (c) 2017-2019 Virtual Cable S.L. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -30,8 +30,6 @@ """ @author: Adolfo Gómez, dkmaster at dkmon dot com """ -from __future__ import unicode_literals - import logging from django.utils.translation import ugettext as _ @@ -82,7 +80,7 @@ class AccountsUsage(DetailHandler): # pylint: disable=too-many-public-methods k = parent.usages.get(uuid=processUuid(item)) return AccountsUsage.usageToDict(k, perm) except Exception: - logger.exception('itemId {}'.format(item)) + logger.exception('itemId %s', item) self.invalidItemException() def getFields(self, parent): @@ -103,7 +101,7 @@ class AccountsUsage(DetailHandler): # pylint: disable=too-many-public-methods raise RequestError('Accounts usage cannot be edited') def deleteItem(self, parent, item): - logger.debug('Deleting account usage {} from {}'.format(item, parent)) + logger.debug('Deleting account usage %s from %s', item, parent) try: usage = parent.usages.get(uuid=processUuid(item)) usage.delete() diff --git a/server/src/uds/REST/methods/actor.py b/server/src/uds/REST/methods/actor.py index 9c47a71f..13dae8bc 100644 --- a/server/src/uds/REST/methods/actor.py +++ b/server/src/uds/REST/methods/actor.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2014 Virtual Cable S.L. +# Copyright (c) 2014-2019 Virtual Cable S.L. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -108,7 +108,7 @@ class Actor(Handler): """ This will get the client from the IDs passed from parameters """ - logger.debug('Getting User services from ids: {}'.format(self._params.get('id'))) + logger.debug('Getting User services from ids: %s', self._params.get('id')) try: clientIds = [i.upper() for i in self._params.get('id').split(',')[:5]] @@ -129,7 +129,7 @@ class Actor(Handler): Processes get requests in order to obtain a ticket content GET /rest/actor/ticket/[ticketId]?key=masterKey&[secure=true|1|false|0] """ - logger.debug("Ticket args for GET: {0}".format(self._args)) + logger.debug('Ticket args for GET: %s', self._args) # secure = self._params.get('secure') in ('1', 'true') @@ -141,13 +141,13 @@ class Actor(Handler): except Exception: return Actor.result({}) - def get(self): + def get(self): # pylint: disable=too-many-return-statements """ Processes get requests """ - logger.debug("Actor args for GET: {0}".format(self._args)) + logger.debug('Actor args for GET: %s', self._args) - if len(self._args) < 1: + if not self._args: raise RequestError('Invalid request') if self._args[0] == 'PostThoughGet': @@ -172,7 +172,7 @@ class Actor(Handler): actorVersion = self._params.get('version', 'unknown') service = self.getUserServiceByIds() if service is None: - logger.info('Unmanaged host request: {}'.format(self._args)) + logger.info('Unmanaged host request: %s', self._args) return Actor.result(_('Unmanaged host'), error=ERR_HOST_NOT_MANAGED) else: # Set last seen actor version @@ -180,7 +180,7 @@ class Actor(Handler): maxIdle = None if service.deployed_service.osmanager is not None: maxIdle = service.deployed_service.osmanager.getInstance().maxIdle() - logger.debug('Max idle: {}'.format(maxIdle)) + logger.debug('Max idle: %s', maxIdle) return Actor.result((service.uuid, service.unique_id, 0 if maxIdle is None else maxIdle) @@ -208,7 +208,7 @@ class Actor(Handler): return Actor.result(_('User service not found'), error=ERR_USER_SERVICE_NOT_FOUND) if message == 'notifyComms': - logger.debug('Setting comms url to {}'.format(data)) + logger.debug('Setting comms url to %s', data) service.setCommsUrl(data) return Actor.result('ok') elif message == 'ssoAvailable': @@ -217,7 +217,7 @@ class Actor(Handler): return Actor.result('ok') elif message == 'version': version = self._params.get('version', 'unknown') - logger.debug('Got notified version {}'.format(version)) + logger.debug('Got notified version %s', version) service.setProperty('actor_version', version) # "Cook" some messages, common to all clients, such as "log" diff --git a/server/src/uds/REST/methods/authenticators.py b/server/src/uds/REST/methods/authenticators.py index 69e3bc42..a0e04c88 100644 --- a/server/src/uds/REST/methods/authenticators.py +++ b/server/src/uds/REST/methods/authenticators.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2014 Virtual Cable S.L. +# Copyright (c) 2014-2019 Virtual Cable S.L. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -30,7 +30,7 @@ """ @author: Adolfo Gómez, dkmaster at dkmon dot com """ -from __future__ import unicode_literals +import logging from django.utils.translation import ugettext_lazy as _ from uds.models import Authenticator @@ -42,7 +42,6 @@ from uds.core.util import permissions from .users_groups import Users, Groups -import logging logger = logging.getLogger(__name__) @@ -88,21 +87,21 @@ class Authenticators(ModelHandler): except Exception: raise NotFound('type not found') - def item_as_dict(self, auth): - type_ = auth.getType() + def item_as_dict(self, item): + type_ = item.getType() return { - 'numeric_id': auth.id, - 'id': auth.uuid, - 'name': auth.name, - 'tags': [tag.tag for tag in auth.tags.all()], - 'comments': auth.comments, - 'priority': auth.priority, - 'small_name': auth.small_name, - 'users_count': auth.users.count(), + 'numeric_id': item.id, + 'id': item.uuid, + 'name': item.name, + 'tags': [tag.tag for tag in item.tags.all()], + 'comments': item.comments, + 'priority': item.priority, + 'small_name': item.small_name, + 'users_count': item.users.count(), 'type': type_.type(), 'type_name': type_.name(), 'type_info': self.typeInfo(type_), - 'permission': permissions.getEffectivePermission(self._user, auth) + 'permission': permissions.getEffectivePermission(self._user, item) } # Custom "search" method @@ -146,12 +145,12 @@ class Authenticators(ModelHandler): else: return res[1] - def deleteItem(self, auth): + def deleteItem(self, item): # For every user, remove assigned services (mark them for removal) - for user in auth.users.all(): + for user in item.users.all(): for userService in user.userServices.all(): userService.user = None userService.removeOrCancel() - auth.delete() + item.delete() diff --git a/server/src/uds/REST/methods/cache.py b/server/src/uds/REST/methods/cache.py index 9e150540..b4baa2da 100644 --- a/server/src/uds/REST/methods/cache.py +++ b/server/src/uds/REST/methods/cache.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2014 Virtual Cable S.L. +# Copyright (c) 2014-2019 Virtual Cable S.L. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -30,13 +30,12 @@ """ @author: Adolfo Gómez, dkmaster at dkmon dot com """ -from __future__ import unicode_literals +import logging -from uds.core.util.Cache import Cache as uCache from django.core.cache import cache as djCache +from uds.core.util.Cache import Cache as uCache from uds.REST import Handler, RequestError -import logging logger = logging.getLogger(__name__) @@ -50,8 +49,8 @@ class Cache(Handler): """ Processes get method. Basically, clears & purges the cache, no matter what params """ - logger.debug('Params: {0}'.format(self._params)) - if len(self._args) == 0: + logger.debug('Params: %s', self._params) + if not self._args: return {} if len(self._args) != 1: diff --git a/server/src/uds/REST/methods/calendarrules.py b/server/src/uds/REST/methods/calendarrules.py index 12a23be3..61d06e15 100644 --- a/server/src/uds/REST/methods/calendarrules.py +++ b/server/src/uds/REST/methods/calendarrules.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2014 Virtual Cable S.L. +# Copyright (c) 2014-2019 Virtual Cable S.L. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -30,9 +30,11 @@ """ @author: Adolfo Gómez, dkmaster at dkmon dot com """ -from __future__ import unicode_literals +import logging +import datetime from django.utils.translation import ugettext as _ +from django.db import IntegrityError from uds.models.CalendarRule import freqs, CalendarRule @@ -42,11 +44,7 @@ from uds.core.util import permissions from uds.core.util.model import processUuid from uds.REST.model import DetailHandler from uds.REST import RequestError -from django.db import IntegrityError -import six -import logging -import datetime logger = logging.getLogger(__name__) @@ -88,7 +86,7 @@ class CalendarRules(DetailHandler): # pylint: disable=too-many-public-methods k = parent.rules.get(uuid=processUuid(item)) return CalendarRules.ruleToDict(k, perm) except Exception: - logger.exception('itemId {}'.format(item)) + logger.exception('itemId %s', item) self.invalidItemException() def getFields(self, parent): @@ -96,7 +94,7 @@ class CalendarRules(DetailHandler): # pylint: disable=too-many-public-methods {'name': {'title': _('Rule name')}}, {'start': {'title': _('Starts'), 'type': 'datetime'}}, {'end': {'title': _('Ends'), 'type': 'date'}}, - {'frequency': {'title': _('Repeats'), 'type': 'dict', 'dict': dict((v[0], six.text_type(v[1])) for v in freqs)}}, + {'frequency': {'title': _('Repeats'), 'type': 'dict', 'dict': dict((v[0], str(v[1])) for v in freqs)}}, {'interval': {'title': _('Every'), 'type': 'callback'}}, {'duration': {'title': _('Duration'), 'type': 'callback'}}, {'comments': {'title': _('Comments')}}, @@ -105,7 +103,7 @@ class CalendarRules(DetailHandler): # pylint: disable=too-many-public-methods def saveItem(self, parent, item): # Extract item db fields # We need this fields for all - logger.debug('Saving rule {0} / {1}'.format(parent, item)) + logger.debug('Saving rule %s / %s', parent, item) fields = self.readFieldsFromParams(['name', 'comments', 'frequency', 'start', 'end', 'interval', 'duration', 'duration_unit']) if int(fields['interval']) < 1: @@ -135,7 +133,7 @@ class CalendarRules(DetailHandler): # pylint: disable=too-many-public-methods return self.getItems(parent, calRule.uuid) def deleteItem(self, parent, item): - logger.debug('Deleting rule {} from {}'.format(item, parent)) + logger.debug('Deleting rule %s from %s', item, parent) try: calRule = parent.rules.get(uuid=processUuid(item)) calRule.calendar.modified = getSqlDatetime() diff --git a/server/src/uds/REST/methods/calendars.py b/server/src/uds/REST/methods/calendars.py index 96d8707b..510af803 100644 --- a/server/src/uds/REST/methods/calendars.py +++ b/server/src/uds/REST/methods/calendars.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2014 Virtual Cable S.L. +# Copyright (c) 2014-2019 Virtual Cable S.L. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -30,16 +30,15 @@ """ @itemor: Adolfo Gómez, dkmaster at dkmon dot com """ -from __future__ import unicode_literals +import logging -from django.utils.translation import ugettext_lazy as _, ugettext +from django.utils.translation import ugettext_lazy as _ from uds.models import Calendar from uds.core.util import permissions from uds.REST.model import ModelHandler from .calendarrules import CalendarRules -import logging logger = logging.getLogger(__name__) @@ -63,14 +62,14 @@ class Calendars(ModelHandler): {'tags': {'title': _('tags'), 'visible': False}}, ] - def item_as_dict(self, calendar): + def item_as_dict(self, item): return { - 'id': calendar.uuid, - 'name': calendar.name, - 'tags': [tag.tag for tag in calendar.tags.all()], - 'comments': calendar.comments, - 'modified': calendar.modified, - 'permission': permissions.getEffectivePermission(self._user, calendar) + 'id': item.uuid, + 'name': item.name, + 'tags': [tag.tag for tag in item.tags.all()], + 'comments': item.comments, + 'modified': item.modified, + 'permission': permissions.getEffectivePermission(self._user, item) } def getGui(self, type_): diff --git a/server/src/uds/REST/methods/client.py b/server/src/uds/REST/methods/client.py index 2028d4f4..91f60313 100644 --- a/server/src/uds/REST/methods/client.py +++ b/server/src/uds/REST/methods/client.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2014 Virtual Cable S.L. +# Copyright (c) 2014-2019 Virtual Cable S.L. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -30,7 +30,8 @@ """ @author: Adolfo Gómez, dkmaster at dkmon dot com """ -from __future__ import unicode_literals +import logging +import json from django.utils.translation import ugettext as _ @@ -46,10 +47,6 @@ from uds.core.services.Exceptions import ServiceNotReadyError from uds.core import VERSION as UDS_VERSION from uds.core.util import encoders -import six -import json - -import logging logger = logging.getLogger(__name__) @@ -85,7 +82,7 @@ class Client(Handler): res['error'] = error res['retryable'] = retryable and '1' or '0' - logger.debug('Client Result: {}'.format(res)) + logger.debug('Client Result: %s', res) return res @@ -99,9 +96,9 @@ class Client(Handler): """ Processes get requests """ - logger.debug("Client args for GET: {0}".format(self._args)) + logger.debug('Client args for GET: %s', self._args) - if len(self._args) == 0: # Gets version + if not self._args: # Gets version url = self._request.build_absolute_uri(reverse('page.client-download')) return Client.result({ 'availableVersion': CLIENT_VERSION, @@ -113,7 +110,7 @@ class Client(Handler): return Client.result(_('Correct')) try: - ticket, scrambler = self._args # If more than 2 args, got an error + ticket, scrambler = self._args # If more than 2 args, got an error. pylint: disable=unbalanced-tuple-unpacking hostname = self._params['hostname'] # Or if hostname is not included... srcIp = self._request.ip @@ -124,7 +121,7 @@ class Client(Handler): except Exception: raise RequestError('Invalid request') - logger.debug('Got Ticket: {}, scrambled: {}, Hostname: {}, Ip: {}'.format(ticket, scrambler, hostname, srcIp)) + logger.debug('Got Ticket: %s, scrambled: %s, Hostname: %s, Ip: %s', ticket, scrambler, hostname, srcIp) try: data = TicketStore.get(ticket) @@ -136,7 +133,7 @@ class Client(Handler): try: logger.debug(data) res = userServiceManager().getService(self._request.user, self._request.os, self._request.ip, data['service'], data['transport']) - logger.debug('Res: {}'.format(res)) + logger.debug('Res: %s', res) ip, userService, userServiceInstance, transport, transportInstance = res password = cryptoManager().symDecrpyt(data['password'], scrambler) @@ -144,8 +141,8 @@ class Client(Handler): transportScript, signature, params = transportInstance.getEncodedTransportScript(userService, transport, ip, self._request.os, self._request.user, password, self._request) - logger.debug('Signature: {}'.format(signature)) - logger.debug('Data:#######\n{}\n###########'.format(params)) + logger.debug('Signature: %s', signature) + logger.debug('Data:#######\n%s\n###########', params) return Client.result(result={ 'script': transportScript, @@ -158,7 +155,7 @@ class Client(Handler): return Client.result(error=errors.SERVICE_IN_PREPARATION, errorCode=e.code, retryable=True) except Exception as e: logger.exception("Exception") - return Client.result(error=six.text_type(e)) + return Client.result(error=str(e)) # Will never reach this raise RuntimeError('Unreachable point reached!!!') diff --git a/server/src/uds/REST/methods/config.py b/server/src/uds/REST/methods/config.py index d072073e..831986c1 100644 --- a/server/src/uds/REST/methods/config.py +++ b/server/src/uds/REST/methods/config.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2014 Virtual Cable S.L. +# Copyright (c) 2014-2019 Virtual Cable S.L. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -30,13 +30,11 @@ """ @author: Adolfo Gómez, dkmaster at dkmon dot com """ -from __future__ import unicode_literals +import logging from uds.core.util.Config import Config as cfgConfig - from uds.REST import Handler -import logging logger = logging.getLogger(__name__) @@ -46,7 +44,7 @@ REMOVED = { 'Cluster': ('Destination CPU Load', 'Migration CPU Load', 'Migration Free Memory'), 'IPAUTH': ('autoLogin',), 'VMWare': ('minUsableDatastoreGB', 'maxRetriesOnError'), -}; +} # Enclosed methods under /config path @@ -75,7 +73,7 @@ class Config(Handler): 'type': cfg.getType(), 'params': cfg.getParams() } - logger.debug('Configuration: {0}'.format(res)) + logger.debug('Configuration: %s', res) return res def put(self): diff --git a/server/src/uds/REST/methods/connection.py b/server/src/uds/REST/methods/connection.py index bf91e27e..16ca3879 100644 --- a/server/src/uds/REST/methods/connection.py +++ b/server/src/uds/REST/methods/connection.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2015 Virtual Cable S.L. +# Copyright (c) 2015-2019 Virtual Cable S.L. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -30,24 +30,17 @@ """ @author: Adolfo Gómez, dkmaster at dkmon dot com """ -from __future__ import unicode_literals +import datetime -from django.utils.translation import ugettext as _ +import logging from uds.REST import Handler from uds.REST import RequestError -from uds.models import MetaPool, ServicePool, ServicesPoolGroup from uds.core.managers import userServiceManager from uds.core.managers import cryptoManager -from uds.core.ui.images import DEFAULT_THUMB_BASE64 -from uds.core.util.Config import GlobalConfig from uds.core.services.Exceptions import ServiceNotReadyError from uds.web.util import errors -import datetime -import six - -import logging logger = logging.getLogger(__name__) @@ -94,7 +87,7 @@ class Connection(Handler): idService = self._args[0] idTransport = self._args[1] try: - ip, userService, iads, trans, itrans = userServiceManager().getService( + ip, userService, iads, trans, itrans = userServiceManager().getService( # pylint: disable=unused-variable self._user, self._request.os, self._request.ip, idService, idTransport, not doNotCheck ) ci = { @@ -112,7 +105,7 @@ class Connection(Handler): return Connection.result(error=errors.SERVICE_IN_PREPARATION, errorCode=e.code, retryable=True) except Exception as e: logger.exception("Exception") - return Connection.result(error=six.text_type(e)) + return Connection.result(error=str(e)) def script(self): idService = self._args[0] @@ -122,8 +115,8 @@ class Connection(Handler): try: res = userServiceManager().getService(self._user, self._request.os, self._request.ip, idService, idTransport) - logger.debug('Res: {}'.format(res)) - ip, userService, userServiceInstance, transport, transportInstance = res + logger.debug('Res: %s', res) + ip, userService, userServiceInstance, transport, transportInstance = res # pylint: disable=unused-variable password = cryptoManager().symDecrpyt(self.getValue('password'), scrambler) userService.setConnectionSource(self._request.ip, hostname) # Store where we are accessing from so we can notify Service @@ -136,7 +129,7 @@ class Connection(Handler): return Connection.result(error=errors.SERVICE_IN_PREPARATION, errorCode=e.code, retryable=True) except Exception as e: logger.exception("Exception") - return Connection.result(error=six.text_type(e)) + return Connection.result(error=str(e)) return password @@ -144,7 +137,7 @@ class Connection(Handler): """ Processes get requests """ - logger.debug("Connection args for GET: {0}".format(self._args)) + logger.debug('Connection args for GET: %s', self._args) if len(self._args) == 0: # Return list of services/transports diff --git a/server/src/uds/REST/model.py b/server/src/uds/REST/model.py index 21616640..451ddf01 100644 --- a/server/src/uds/REST/model.py +++ b/server/src/uds/REST/model.py @@ -38,19 +38,25 @@ import typing import logging -import six - from django.utils.translation import ugettext as _ from django.db import IntegrityError, models -from uds.REST.handlers import NotFound, RequestError, ResponseError, AccessDenied, NotSupportedError from uds.core.ui.UserInterface import gui as uiGui -from uds.REST.handlers import Handler, HandlerError from uds.core.util import log from uds.core.util import permissions from uds.core.util.model import processUuid from uds.models import Tag +from .handlers import ( + Handler, + HandlerError, + NotFound, + RequestError, + ResponseError, + AccessDenied, + NotSupportedError +) + logger = logging.getLogger(__name__) @@ -225,7 +231,7 @@ class BaseModelHandler(Handler): args[key] = self._params[key] del self._params[key] except KeyError as e: - raise RequestError('needed parameter not found in data {0}'.format(six.text_type(e))) + raise RequestError('needed parameter not found in data {0}'.format(e)) return args @@ -239,8 +245,8 @@ class BaseModelHandler(Handler): if hasattr(item, 'getInstance'): i = item.getInstance() i.initGui() # Defaults & stuff - for key, value in six.iteritems(i.valuesDict()): - if isinstance(value, six.string_types): + for key, value in i.valuesDict().items(): + if isinstance(value, str): value = {"true": True, "false": False}.get(value, value) # Translate "true" & "false" to True & False (booleans) logger.debug('%s = %s', key, value) res[key] = value @@ -903,7 +909,7 @@ class ModelHandler(BaseModelHandler): except IntegrityError: # Duplicate key probably raise RequestError('Element already exists (duplicate key error)') except SaveException as e: - raise RequestError(six.text_type(e)) + raise RequestError(str(e)) except (RequestError, ResponseError): raise except Exception: diff --git a/server/src/uds/models/CalendarRule.py b/server/src/uds/models/CalendarRule.py index 755ee9f7..373f2bc1 100644 --- a/server/src/uds/models/CalendarRule.py +++ b/server/src/uds/models/CalendarRule.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2016 Virtual Cable S.L. +# Copyright (c) 2016-2019 Virtual Cable S.L. # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, @@ -31,21 +31,18 @@ .. moduleauthor:: Adolfo Gómez, dkmaster at dkmon dot com """ -from __future__ import unicode_literals - -__updated__ = '2017-12-12' +import datetime +import logging from django.db import models from django.utils.encoding import python_2_unicode_compatible -from django.utils.translation import ugettext_lazy as _, ugettext +from django.utils.translation import ugettext_lazy as _ from dateutil import rrule as rules from .UUIDModel import UUIDModel from .Calendar import Calendar from .Util import getSqlDatetime -import datetime -import logging logger = logging.getLogger(__name__)