diff --git a/server/src/uds/REST/__init__.py b/server/src/uds/REST/__init__.py index d2b0c1bf..fee61ada 100644 --- a/server/src/uds/REST/__init__.py +++ b/server/src/uds/REST/__init__.py @@ -40,7 +40,7 @@ from django import http from django.views.generic.base import View from django.views.decorators.csrf import csrf_exempt from django.utils.decorators import method_decorator -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.core import VERSION, VERSION_STAMP from .handlers import ( diff --git a/server/src/uds/REST/methods/accounts.py b/server/src/uds/REST/methods/accounts.py index 40cab340..b9c39c4b 100644 --- a/server/src/uds/REST/methods/accounts.py +++ b/server/src/uds/REST/methods/accounts.py @@ -34,7 +34,7 @@ import datetime import logging import typing -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from uds.REST.model import ModelHandler from uds.core.util import permissions diff --git a/server/src/uds/REST/methods/accountsusage.py b/server/src/uds/REST/methods/accountsusage.py index cffcdcce..395e75e0 100644 --- a/server/src/uds/REST/methods/accountsusage.py +++ b/server/src/uds/REST/methods/accountsusage.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.REST import RequestError from uds.REST.model import DetailHandler diff --git a/server/src/uds/REST/methods/actor_token.py b/server/src/uds/REST/methods/actor_token.py index 532a8ef3..74080fe7 100644 --- a/server/src/uds/REST/methods/actor_token.py +++ b/server/src/uds/REST/methods/actor_token.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from uds.models import ActorToken from uds.REST.handlers import RequestError, NotFound diff --git a/server/src/uds/REST/methods/authenticators.py b/server/src/uds/REST/methods/authenticators.py index 28dc4ddb..13f8408a 100644 --- a/server/src/uds/REST/methods/authenticators.py +++ b/server/src/uds/REST/methods/authenticators.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext, ugettext_lazy as _ +from django.utils.translation import gettext, gettext_lazy as _ from uds.models import Authenticator, Network from uds.core import auths @@ -125,13 +125,13 @@ class Authenticators(ModelHandler): {'id': Authenticator.HIDDEN, 'text': _('Hidden')}, {'id': Authenticator.DISABLED, 'text': _('Disabled')}, ], - 'label': ugettext('Access'), - 'tooltip': ugettext( + 'label': gettext('Access'), + 'tooltip': gettext( 'Access type for this transport. Disabled means not only hidden, but also not usable as login method.' ), 'type': gui.InputField.CHOICE_TYPE, 'order': 107, - 'tab': ugettext('Display'), + 'tab': gettext('Display'), }, ) return field diff --git a/server/src/uds/REST/methods/calendarrules.py b/server/src/uds/REST/methods/calendarrules.py index 0f827882..489c0458 100644 --- a/server/src/uds/REST/methods/calendarrules.py +++ b/server/src/uds/REST/methods/calendarrules.py @@ -34,7 +34,7 @@ import datetime import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.db import IntegrityError diff --git a/server/src/uds/REST/methods/calendars.py b/server/src/uds/REST/methods/calendars.py index b32043d1..7d3065d8 100644 --- a/server/src/uds/REST/methods/calendars.py +++ b/server/src/uds/REST/methods/calendars.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from uds.models import Calendar from uds.core.util import permissions diff --git a/server/src/uds/REST/methods/client.py b/server/src/uds/REST/methods/client.py index a5a87f85..43c1275a 100644 --- a/server/src/uds/REST/methods/client.py +++ b/server/src/uds/REST/methods/client.py @@ -33,7 +33,7 @@ import codecs import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.urls import reverse from uds.REST import Handler diff --git a/server/src/uds/REST/methods/images.py b/server/src/uds/REST/methods/images.py index 9ae4bcdb..bce8cf5f 100644 --- a/server/src/uds/REST/methods/images.py +++ b/server/src/uds/REST/methods/images.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_lazy as _, ugettext +from django.utils.translation import gettext_lazy as _, gettext from uds.models import Image from uds.core.ui import gui @@ -83,8 +83,8 @@ class Images(ModelHandler): { 'name': 'data', 'value': '', - 'label': ugettext('Image'), - 'tooltip': ugettext('Image object'), + 'label': gettext('Image'), + 'tooltip': gettext('Image object'), 'type': gui.InputField.IMAGECHOICE_TYPE, 'order': 100, # At end }, diff --git a/server/src/uds/REST/methods/meta_pools.py b/server/src/uds/REST/methods/meta_pools.py index 4442ebf3..936ad2f3 100644 --- a/server/src/uds/REST/methods/meta_pools.py +++ b/server/src/uds/REST/methods/meta_pools.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext, ugettext_lazy as _ +from django.utils.translation import gettext, gettext_lazy as _ from uds.models import MetaPool, Image, ServicePoolGroup from uds.core.ui.images import DEFAULT_THUMB_BASE64 from uds.core.util.state import State @@ -150,8 +150,8 @@ class MetaPools(ModelHandler): 'values': [ gui.choiceItem(k, str(v)) for k, v in MetaPool.TYPES.items() ], - 'label': ugettext('Policy'), - 'tooltip': ugettext('Service pool policy'), + 'label': gettext('Policy'), + 'tooltip': gettext('Service pool policy'), 'type': gui.InputField.CHOICE_TYPE, 'order': 100, }, @@ -164,8 +164,8 @@ class MetaPools(ModelHandler): for v in Image.objects.all() ] ), - 'label': ugettext('Associated Image'), - 'tooltip': ugettext('Image assocciated with this service'), + 'label': gettext('Associated Image'), + 'tooltip': gettext('Image assocciated with this service'), 'type': gui.InputField.IMAGECHOICE_TYPE, 'order': 120, 'tab': gui.DISPLAY_TAB, @@ -179,8 +179,8 @@ class MetaPools(ModelHandler): for v in ServicePoolGroup.objects.all() ] ), - 'label': ugettext('Pool group'), - 'tooltip': ugettext( + 'label': gettext('Pool group'), + 'tooltip': gettext( 'Pool group for this pool (for pool classify on display)' ), 'type': gui.InputField.IMAGECHOICE_TYPE, @@ -190,8 +190,8 @@ class MetaPools(ModelHandler): { 'name': 'visible', 'value': True, - 'label': ugettext('Visible'), - 'tooltip': ugettext('If active, metapool will be visible for users'), + 'label': gettext('Visible'), + 'tooltip': gettext('If active, metapool will be visible for users'), 'type': gui.InputField.CHECKBOX_TYPE, 'order': 123, 'tab': gui.DISPLAY_TAB, @@ -199,8 +199,8 @@ class MetaPools(ModelHandler): { 'name': 'calendar_message', 'value': '', - 'label': ugettext('Calendar access denied text'), - 'tooltip': ugettext( + 'label': gettext('Calendar access denied text'), + 'tooltip': gettext( 'Custom message to be shown to users if access is limited by calendar rules.' ), 'type': gui.InputField.TEXT_TYPE, @@ -213,8 +213,8 @@ class MetaPools(ModelHandler): gui.choiceItem(k, str(v)) for k, v in MetaPool.TRANSPORT_SELECT.items() ], - 'label': ugettext('Transport Selection'), - 'tooltip': ugettext('Transport selection policy'), + 'label': gettext('Transport Selection'), + 'tooltip': gettext('Transport selection policy'), 'type': gui.InputField.CHOICE_TYPE, 'order': 125, 'tab': gui.DISPLAY_TAB, diff --git a/server/src/uds/REST/methods/meta_service_pools.py b/server/src/uds/REST/methods/meta_service_pools.py index 5fd00e07..6caad496 100644 --- a/server/src/uds/REST/methods/meta_service_pools.py +++ b/server/src/uds/REST/methods/meta_service_pools.py @@ -32,7 +32,7 @@ import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.models.meta_pool import MetaPool, MetaPoolMember from uds.models.service_pool import ServicePool diff --git a/server/src/uds/REST/methods/networks.py b/server/src/uds/REST/methods/networks.py index 124396e7..7a6b58b2 100644 --- a/server/src/uds/REST/methods/networks.py +++ b/server/src/uds/REST/methods/networks.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_lazy as _, ugettext +from django.utils.translation import gettext_lazy as _, gettext from uds.models import Network from uds.core.util import net @@ -79,7 +79,7 @@ class Networks(ModelHandler): fields['net_start'] = nr[0] fields['net_end'] = nr[1] except Exception as e: - raise SaveException(ugettext('Invalid network: {}').format(e)) + raise SaveException(gettext('Invalid network: {}').format(e)) logger.debug('Processed %s', fields) def getGui(self, type_: str) -> typing.List[typing.Any]: @@ -88,8 +88,8 @@ class Networks(ModelHandler): { 'name': 'net_string', 'value': '', - 'label': ugettext('Network range'), - 'tooltip': ugettext( + 'label': gettext('Network range'), + 'tooltip': gettext( 'Network range. Accepts most network definitions formats (range, subnet, host, etc...' ), 'type': gui.InputField.TEXT_TYPE, diff --git a/server/src/uds/REST/methods/op_calendars.py b/server/src/uds/REST/methods/op_calendars.py index d7a54362..46ce7f2d 100644 --- a/server/src/uds/REST/methods/op_calendars.py +++ b/server/src/uds/REST/methods/op_calendars.py @@ -34,7 +34,7 @@ import json import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.models import Calendar, CalendarAction from uds.models.calendar_action import CALENDAR_ACTION_DICT diff --git a/server/src/uds/REST/methods/osmanagers.py b/server/src/uds/REST/methods/osmanagers.py index 7969ce80..cf059f98 100644 --- a/server/src/uds/REST/methods/osmanagers.py +++ b/server/src/uds/REST/methods/osmanagers.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext, ugettext_lazy as _ +from django.utils.translation import gettext, gettext_lazy as _ from uds.core import osmanagers from uds.core.util import permissions @@ -80,7 +80,7 @@ class OsManagers(ModelHandler): # Only can delete if no ServicePools attached if item.deployedServices.count() > 0: raise RequestError( - ugettext('Can\'t delete an OS Manager with services pools associated') + gettext('Can\'t delete an OS Manager with services pools associated') ) # Types related diff --git a/server/src/uds/REST/methods/providers.py b/server/src/uds/REST/methods/providers.py index 825bf0cb..8876bbc6 100644 --- a/server/src/uds/REST/methods/providers.py +++ b/server/src/uds/REST/methods/providers.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext, ugettext_lazy as _ +from django.utils.translation import gettext, gettext_lazy as _ from uds.models import Provider, Service, UserService from uds.core import services @@ -87,9 +87,9 @@ class Providers(ModelHandler): # Icon can have a lot of data (1-2 Kbytes), but it's not expected to have a lot of services providers, and even so, this will work fine offers = [ { - 'name': ugettext(t.name()), + 'name': gettext(t.name()), 'type': t.type(), - 'description': ugettext(t.description()), + 'description': gettext(t.description()), 'icon': t.icon64().replace('\n', ''), } for t in type_.getServicesTypes() @@ -115,7 +115,7 @@ class Providers(ModelHandler): def checkDelete(self, item: Provider) -> None: if item.services.count() > 0: - raise RequestError(ugettext('Can\'t delete providers with services')) + raise RequestError(gettext('Can\'t delete providers with services')) # Types related def enum_types(self) -> typing.Iterable[typing.Type[services.ServiceProvider]]: diff --git a/server/src/uds/REST/methods/proxies.py b/server/src/uds/REST/methods/proxies.py index 1046f8f0..0051b74b 100644 --- a/server/src/uds/REST/methods/proxies.py +++ b/server/src/uds/REST/methods/proxies.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_lazy as _, ugettext +from django.utils.translation import gettext_lazy as _, gettext from uds.models import Proxy from uds.core.ui import gui from uds.core.util import permissions @@ -85,8 +85,8 @@ class Proxies(ModelHandler): { 'name': 'host', 'value': '', - 'label': ugettext('Host'), - 'tooltip': ugettext('Server (IP or FQDN) that will serve as proxy.'), + 'label': gettext('Host'), + 'tooltip': gettext('Server (IP or FQDN) that will serve as proxy.'), 'type': gui.InputField.TEXT_TYPE, 'order': 110, }, @@ -94,16 +94,16 @@ class Proxies(ModelHandler): 'name': 'port', 'value': '9090', 'minValue': '0', - 'label': ugettext('Port'), - 'tooltip': ugettext('Port of proxy server'), + 'label': gettext('Port'), + 'tooltip': gettext('Port of proxy server'), 'type': gui.InputField.NUMERIC_TYPE, 'order': 111, }, { 'name': 'ssl', 'value': True, - 'label': ugettext('Use SSL'), - 'tooltip': ugettext( + 'label': gettext('Use SSL'), + 'tooltip': gettext( 'If active, the proxied connections will be done using HTTPS' ), 'type': gui.InputField.CHECKBOX_TYPE, @@ -111,8 +111,8 @@ class Proxies(ModelHandler): { 'name': 'check_cert', 'value': True, - 'label': ugettext('Check Certificate'), - 'tooltip': ugettext( + 'label': gettext('Check Certificate'), + 'tooltip': gettext( 'If active, any SSL certificate will be checked (will not allow self signed certificates on proxy)' ), 'type': gui.InputField.CHECKBOX_TYPE, diff --git a/server/src/uds/REST/methods/reports.py b/server/src/uds/REST/methods/reports.py index d35195b5..ab2c452f 100644 --- a/server/src/uds/REST/methods/reports.py +++ b/server/src/uds/REST/methods/reports.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from uds.REST import model from uds import reports diff --git a/server/src/uds/REST/methods/services.py b/server/src/uds/REST/methods/services.py index 299bd774..b74c493b 100644 --- a/server/src/uds/REST/methods/services.py +++ b/server/src/uds/REST/methods/services.py @@ -34,7 +34,7 @@ import logging import typing from django.db import IntegrityError -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds import models diff --git a/server/src/uds/REST/methods/services_pool_groups.py b/server/src/uds/REST/methods/services_pool_groups.py index 110b83fe..131d3282 100644 --- a/server/src/uds/REST/methods/services_pool_groups.py +++ b/server/src/uds/REST/methods/services_pool_groups.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_lazy as _, ugettext +from django.utils.translation import gettext_lazy as _, gettext from uds.models import ServicePoolGroup, Image from uds.core.util.model import processUuid from uds.core.ui import gui @@ -97,8 +97,8 @@ class ServicesPoolGroups(ModelHandler): for v in Image.objects.all() ] ), - 'label': ugettext('Associated Image'), - 'tooltip': ugettext('Image assocciated with this service'), + 'label': gettext('Associated Image'), + 'tooltip': gettext('Image assocciated with this service'), 'type': gui.InputField.IMAGECHOICE_TYPE, 'order': 102, } diff --git a/server/src/uds/REST/methods/services_pools.py b/server/src/uds/REST/methods/services_pools.py index 61eb9f0b..fd1e96c2 100644 --- a/server/src/uds/REST/methods/services_pools.py +++ b/server/src/uds/REST/methods/services_pools.py @@ -35,7 +35,7 @@ import logging import typing from django.db.models import Q, Count -from django.utils.translation import ugettext, ugettext_lazy as _ +from django.utils.translation import gettext, gettext_lazy as _ from uds.models import ( ServicePool, OSManager, @@ -311,10 +311,10 @@ class ServicesPools(ModelHandler): # Gui related def getGui(self, type_: str) -> typing.List[typing.Any]: # if OSManager.objects.count() < 1: # No os managers, can't create db - # raise ResponseError(ugettext('Create at least one OS Manager before creating a new service pool')) + # raise ResponseError(gettext('Create at least one OS Manager before creating a new service pool')) if Service.objects.count() < 1: raise ResponseError( - ugettext('Create at least a service before creating a new service pool') + gettext('Create at least a service before creating a new service pool') ) g = self.addDefaultFields([], ['name', 'short_name', 'comments', 'tags']) @@ -329,8 +329,8 @@ class ServicesPools(ModelHandler): for v in Service.objects.all() ] ), - 'label': ugettext('Base service'), - 'tooltip': ugettext('Service used as base of this service pool'), + 'label': gettext('Base service'), + 'tooltip': gettext('Service used as base of this service pool'), 'type': gui.InputField.CHOICE_TYPE, 'rdonly': True, 'order': 100, # Ensures is At end @@ -341,8 +341,8 @@ class ServicesPools(ModelHandler): + gui.sortedChoices( [gui.choiceItem(v.uuid, v.name) for v in OSManager.objects.all()] ), - 'label': ugettext('OS Manager'), - 'tooltip': ugettext('OS Manager used as base of this service pool'), + 'label': gettext('OS Manager'), + 'tooltip': gettext('OS Manager used as base of this service pool'), 'type': gui.InputField.CHOICE_TYPE, 'rdonly': True, 'order': 101, @@ -350,44 +350,44 @@ class ServicesPools(ModelHandler): { 'name': 'allow_users_remove', 'value': False, - 'label': ugettext('Allow removal by users'), - 'tooltip': ugettext( + 'label': gettext('Allow removal by users'), + 'tooltip': gettext( 'If active, the user will be allowed to remove the service "manually". Be careful with this, because the user will have the "power" to delete it\'s own service' ), 'type': gui.InputField.CHECKBOX_TYPE, 'order': 111, - 'tab': ugettext('Advanced'), + 'tab': gettext('Advanced'), }, { 'name': 'allow_users_reset', 'value': False, - 'label': ugettext('Allow reset by users'), - 'tooltip': ugettext( + 'label': gettext('Allow reset by users'), + 'tooltip': gettext( 'If active, the user will be allowed to reset the service' ), 'type': gui.InputField.CHECKBOX_TYPE, 'order': 112, - 'tab': ugettext('Advanced'), + 'tab': gettext('Advanced'), }, { 'name': 'ignores_unused', 'value': False, - 'label': ugettext('Ignores unused'), - 'tooltip': ugettext( + 'label': gettext('Ignores unused'), + 'tooltip': gettext( 'If the option is enabled, UDS will not attempt to detect and remove the user services assigned but not in use.' ), 'type': gui.InputField.CHECKBOX_TYPE, 'order': 113, - 'tab': ugettext('Advanced'), + 'tab': gettext('Advanced'), }, { 'name': 'visible', 'value': True, - 'label': ugettext('Visible'), - 'tooltip': ugettext('If active, transport will be visible for users'), + 'label': gettext('Visible'), + 'tooltip': gettext('If active, transport will be visible for users'), 'type': gui.InputField.CHECKBOX_TYPE, 'order': 107, - 'tab': ugettext('Display'), + 'tab': gettext('Display'), }, { 'name': 'image_id', @@ -398,11 +398,11 @@ class ServicesPools(ModelHandler): for v in Image.objects.all() ] ), - 'label': ugettext('Associated Image'), - 'tooltip': ugettext('Image assocciated with this service'), + 'label': gettext('Associated Image'), + 'tooltip': gettext('Image assocciated with this service'), 'type': gui.InputField.IMAGECHOICE_TYPE, 'order': 120, - 'tab': ugettext('Display'), + 'tab': gettext('Display'), }, { 'name': 'pool_group_id', @@ -413,80 +413,80 @@ class ServicesPools(ModelHandler): for v in ServicePoolGroup.objects.all() ] ), - 'label': ugettext('Pool group'), - 'tooltip': ugettext( + 'label': gettext('Pool group'), + 'tooltip': gettext( 'Pool group for this pool (for pool classify on display)' ), 'type': gui.InputField.IMAGECHOICE_TYPE, 'order': 121, - 'tab': ugettext('Display'), + 'tab': gettext('Display'), }, { 'name': 'calendar_message', 'value': '', - 'label': ugettext('Calendar access denied text'), - 'tooltip': ugettext( + 'label': gettext('Calendar access denied text'), + 'tooltip': gettext( 'Custom message to be shown to users if access is limited by calendar rules.' ), 'type': gui.InputField.TEXT_TYPE, 'order': 122, - 'tab': ugettext('Display'), + 'tab': gettext('Display'), }, { 'name': 'initial_srvs', 'value': '0', 'minValue': '0', - 'label': ugettext('Initial available services'), - 'tooltip': ugettext('Services created initially for this service pool'), + 'label': gettext('Initial available services'), + 'tooltip': gettext('Services created initially for this service pool'), 'type': gui.InputField.NUMERIC_TYPE, 'order': 130, - 'tab': ugettext('Availability'), + 'tab': gettext('Availability'), }, { 'name': 'cache_l1_srvs', 'value': '0', 'minValue': '0', - 'label': ugettext('Services to keep in cache'), - 'tooltip': ugettext( + 'label': gettext('Services to keep in cache'), + 'tooltip': gettext( 'Services kept in cache for improved user service assignation' ), 'type': gui.InputField.NUMERIC_TYPE, 'order': 131, - 'tab': ugettext('Availability'), + 'tab': gettext('Availability'), }, { 'name': 'cache_l2_srvs', 'value': '0', 'minValue': '0', - 'label': ugettext('Services to keep in L2 cache'), - 'tooltip': ugettext( + 'label': gettext('Services to keep in L2 cache'), + 'tooltip': gettext( 'Services kept in cache of level2 for improved service generation' ), 'type': gui.InputField.NUMERIC_TYPE, 'order': 132, - 'tab': ugettext('Availability'), + 'tab': gettext('Availability'), }, { 'name': 'max_srvs', 'value': '0', 'minValue': '1', - 'label': ugettext('Maximum number of services to provide'), - 'tooltip': ugettext( + 'label': gettext('Maximum number of services to provide'), + 'tooltip': gettext( 'Maximum number of service (assigned and L1 cache) that can be created for this service' ), 'type': gui.InputField.NUMERIC_TYPE, 'order': 133, - 'tab': ugettext('Availability'), + 'tab': gettext('Availability'), }, { 'name': 'show_transports', 'value': True, - 'label': ugettext('Show transports'), - 'tooltip': ugettext( + 'label': gettext('Show transports'), + 'tooltip': gettext( 'If active, alternative transports for user will be shown' ), 'type': gui.InputField.CHECKBOX_TYPE, - 'tab': ugettext('Advanced'), + 'tab': gettext('Advanced'), 'order': 130, }, { @@ -495,10 +495,10 @@ class ServicesPools(ModelHandler): + gui.sortedChoices( [gui.choiceItem(v.uuid, v.name) for v in Account.objects.all()] ), - 'label': ugettext('Accounting'), - 'tooltip': ugettext('Account associated to this service pool'), + 'label': gettext('Accounting'), + 'tooltip': gettext('Account associated to this service pool'), 'type': gui.InputField.CHOICE_TYPE, - 'tab': ugettext('Advanced'), + 'tab': gettext('Advanced'), 'order': 131, }, ]: @@ -515,7 +515,7 @@ class ServicesPools(ModelHandler): service = Service.objects.get(uuid=processUuid(fields['service_id'])) fields['service_id'] = service.id except: - raise RequestError(ugettext('Base service does not exist anymore')) + raise RequestError(gettext('Base service does not exist anymore')) try: serviceType = service.getType() @@ -568,7 +568,7 @@ class ServicesPools(ModelHandler): except Exception: - raise RequestError(ugettext('This service requires an OS Manager')) + raise RequestError(gettext('This service requires an OS Manager')) # If max < initial or cache_1 or cache_l2 fields['max_srvs'] = max( diff --git a/server/src/uds/REST/methods/services_usage.py b/server/src/uds/REST/methods/services_usage.py index 092d49f5..acb0f3e4 100644 --- a/server/src/uds/REST/methods/services_usage.py +++ b/server/src/uds/REST/methods/services_usage.py @@ -34,7 +34,7 @@ import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.models import UserService from uds.core.util.state import State diff --git a/server/src/uds/REST/methods/transports.py b/server/src/uds/REST/methods/transports.py index 8cd6f0b4..890d1ea7 100644 --- a/server/src/uds/REST/methods/transports.py +++ b/server/src/uds/REST/methods/transports.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_lazy as _, ugettext +from django.utils.translation import gettext_lazy as _, gettext from uds.models import Transport, Network, ServicePool from uds.core import transports from uds.core.ui import gui @@ -101,8 +101,8 @@ class Transports(ModelHandler): ], key=lambda x: x['text'].lower(), ), - 'label': ugettext('Allowed Devices'), - 'tooltip': ugettext( + 'label': gettext('Allowed Devices'), + 'tooltip': gettext( 'If empty, any kind of device compatible with this transport will be allowed. Else, only devices compatible with selected values will be allowed' ), 'type': 'multichoice', @@ -120,8 +120,8 @@ class Transports(ModelHandler): for x in ServicePool.objects.all().order_by('name') if transport.protocol in x.service.getType().allowedProtocols ], - 'label': ugettext('Service Pools'), - 'tooltip': ugettext('Currently assigned services pools'), + 'label': gettext('Service Pools'), + 'tooltip': gettext('Currently assigned services pools'), 'type': 'multichoice', 'order': 103, }, @@ -132,8 +132,8 @@ class Transports(ModelHandler): 'name': 'label', 'length': 32, 'value': '', - 'label': ugettext('Label'), - 'tooltip': ugettext( + 'label': gettext('Label'), + 'tooltip': gettext( 'Metapool transport label (only used on metapool transports grouping)' ), 'type': 'text', diff --git a/server/src/uds/REST/methods/tunnel_token.py b/server/src/uds/REST/methods/tunnel_token.py index 59034344..460c604b 100644 --- a/server/src/uds/REST/methods/tunnel_token.py +++ b/server/src/uds/REST/methods/tunnel_token.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from uds.models import TunnelToken from uds.REST.handlers import RequestError, NotFound diff --git a/server/src/uds/REST/methods/user_services.py b/server/src/uds/REST/methods/user_services.py index ee237fa9..ed037ce8 100644 --- a/server/src/uds/REST/methods/user_services.py +++ b/server/src/uds/REST/methods/user_services.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds import models from uds.core.util.state import State diff --git a/server/src/uds/REST/methods/users_groups.py b/server/src/uds/REST/methods/users_groups.py index 1d4c0893..f7ef67b2 100644 --- a/server/src/uds/REST/methods/users_groups.py +++ b/server/src/uds/REST/methods/users_groups.py @@ -32,7 +32,7 @@ import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.forms.models import model_to_dict from django.db import IntegrityError from django.core.exceptions import ValidationError diff --git a/server/src/uds/REST/model.py b/server/src/uds/REST/model.py index 25de5102..b19691f4 100644 --- a/server/src/uds/REST/model.py +++ b/server/src/uds/REST/model.py @@ -38,7 +38,7 @@ import typing import logging -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.db import IntegrityError, models from uds.core.ui import gui as uiGui diff --git a/server/src/uds/REST/processors.py b/server/src/uds/REST/processors.py index 9178687e..18403605 100644 --- a/server/src/uds/REST/processors.py +++ b/server/src/uds/REST/processors.py @@ -32,10 +32,7 @@ """ import datetime # Try to use orjson if available -try: - import orjson as json -except ImportError: - import json as json # type: ignore +import json as json # type: ignore import logging import time diff --git a/server/src/uds/admin/urls.py b/server/src/uds/admin/urls.py deleted file mode 100644 index 5e2b143e..00000000 --- a/server/src/uds/admin/urls.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (c) 2012 Virtual Cable S.L. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# * Neither the name of Virtual Cable S.L. nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -""" -@author: Adolfo Gómez, dkmaster at dkmon dot com -""" -from __future__ import unicode_literals -from django.conf.urls import url - -import uds.admin.views - -__updated__ = '2019-02-04' - -urlpatterns = [ - url(r'^.*$', uds.admin.views.index, name='uds.admin.views.index'), -] diff --git a/server/src/uds/admin/views/__init__.py b/server/src/uds/admin/views/__init__.py index 4a4654b3..d3d92af0 100644 --- a/server/src/uds/admin/views/__init__.py +++ b/server/src/uds/admin/views/__init__.py @@ -33,7 +33,7 @@ import logging from django.http import HttpResponse from django.shortcuts import render from django.template import RequestContext, loader -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.core.auths.auth import webLoginRequired from uds.core.util.decorators import denyBrowsers diff --git a/server/src/uds/auths/IP/authenticator.py b/server/src/uds/auths/IP/authenticator.py index 91837edb..168292d3 100644 --- a/server/src/uds/auths/IP/authenticator.py +++ b/server/src/uds/auths/IP/authenticator.py @@ -34,7 +34,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core import auths from uds.core.util import net from uds.core.ui import gui diff --git a/server/src/uds/auths/InternalDB/authenticator.py b/server/src/uds/auths/InternalDB/authenticator.py index c775f545..d3091aea 100644 --- a/server/src/uds/auths/InternalDB/authenticator.py +++ b/server/src/uds/auths/InternalDB/authenticator.py @@ -38,7 +38,7 @@ import typing import dns.resolver import dns.reversename -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core import auths from uds.core.ui import gui from uds.core.managers import cryptoManager diff --git a/server/src/uds/auths/Radius/authenticator.py b/server/src/uds/auths/Radius/authenticator.py index 25897bdb..52a846f0 100644 --- a/server/src/uds/auths/Radius/authenticator.py +++ b/server/src/uds/auths/Radius/authenticator.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.ui import gui from uds.core import auths diff --git a/server/src/uds/auths/RegexLdap/authenticator.py b/server/src/uds/auths/RegexLdap/authenticator.py index 78272e7e..bf315b2a 100644 --- a/server/src/uds/auths/RegexLdap/authenticator.py +++ b/server/src/uds/auths/RegexLdap/authenticator.py @@ -37,7 +37,7 @@ import typing import ldap -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core import auths from uds.core.ui import gui diff --git a/server/src/uds/auths/Sample/SampleAuth.py b/server/src/uds/auths/Sample/SampleAuth.py index e9749c04..6160128a 100644 --- a/server/src/uds/auths/Sample/SampleAuth.py +++ b/server/src/uds/auths/Sample/SampleAuth.py @@ -33,16 +33,17 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.ui import gui from uds.core import auths if typing.TYPE_CHECKING: from django.http import ( HttpRequest, - HttpResponse, ) # pylint: disable=ungrouped-imports - from uds.core.util.request import ExtendedHttpRequestWithUser + from uds.core.util.request import ExtendedHttpRequestWithUser, ExtendedHttpRequest + from uds.core.auths.groups_manager import GroupsManager + logger = logging.getLogger(__name__) @@ -68,14 +69,14 @@ class SampleAuth(auths.Authenticator): we MUST register it at package __init__ :note: At class level, the translations must be simply marked as so - using ugettext_noop. This is done in this way because we will translate + using gettext_noop. This is done in this way because we will translate the string when it is sent to the administration client. """ # : Name of type, used at administration interface to identify this # : authenticator (i.e. LDAP, SAML, ...) # : This string will be translated when provided to admin interface - # : using ugettext, so you can mark it as "_" at derived classes (using ugettext_noop) + # : using gettext, so you can mark it as "_" at derived classes (using gettext_noop) # : if you want so it can be translated. typeName = _('Sample Authenticator') @@ -87,7 +88,7 @@ class SampleAuth(auths.Authenticator): # : Description shown at administration level for this authenticator. # : This string will be translated when provided to admin interface - # : using ugettext, so you can mark it as "_" at derived classes (using ugettext_noop) + # : using gettext, so you can mark it as "_" at derived classes (using gettext_noop) # : if you want so it can be translated. typeDescription = _('Sample dummy authenticator') @@ -167,7 +168,11 @@ class SampleAuth(auths.Authenticator): return res def authenticate( - self, username: str, credentials: str, groupsManager: 'auths.GroupsManager' + self, + username: str, + credentials: str, + groupsManager: 'GroupsManager', + request: 'ExtendedHttpRequest', ) -> bool: """ This method is invoked by UDS whenever it needs an user to be authenticated. diff --git a/server/src/uds/auths/SimpleLDAP/authenticator.py b/server/src/uds/auths/SimpleLDAP/authenticator.py index 99898a0e..2a051bc7 100644 --- a/server/src/uds/auths/SimpleLDAP/authenticator.py +++ b/server/src/uds/auths/SimpleLDAP/authenticator.py @@ -36,7 +36,7 @@ import typing import ldap.filter import ldap -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.ui import gui from uds.core import auths diff --git a/server/src/uds/core/auths/auth.py b/server/src/uds/core/auths/auth.py index 6adc2aac..d65285a4 100644 --- a/server/src/uds/core/auths/auth.py +++ b/server/src/uds/core/auths/auth.py @@ -45,7 +45,7 @@ from django.http import ( from django.utils.translation import get_language from django.urls import reverse -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.core import auths from uds.core.util import log diff --git a/server/src/uds/core/auths/authenticator.py b/server/src/uds/core/auths/authenticator.py index 7b01742b..53e929a6 100644 --- a/server/src/uds/core/auths/authenticator.py +++ b/server/src/uds/core/auths/authenticator.py @@ -34,7 +34,7 @@ Base module for all authenticators import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core import Module # Not imported at runtime, just for type checking @@ -99,14 +99,14 @@ class Authenticator(Module): # pylint: disable=too-many-public-methods :note: All attributes that are "_" here means that they will be translated when provided to administration interface, so remember to mark them in your own authenticators as "_" using - ugettext_noop. We have aliased it here to "_" so it's + gettext_noop. We have aliased it here to "_" so it's easier to understand. """ # : Name of type, used at administration interface to identify this # : authenticator (i.e. LDAP, SAML, ...) # : This string will be translated when provided to admin interface - # : using ugettext, so you can mark it as "_" at derived classes (using ugettext_noop) + # : using gettext, so you can mark it as "_" at derived classes (using gettext_noop) # : if you want so it can be translated. typeName: typing.ClassVar[str] = _('Base Authenticator') @@ -118,7 +118,7 @@ class Authenticator(Module): # pylint: disable=too-many-public-methods # : Description shown at administration level for this authenticator. # : This string will be translated when provided to admin interface - # : using ugettext, so you can mark it as "_" at derived classes (using ugettext_noop) + # : using gettext, so you can mark it as "_" at derived classes (using gettext_noop) # : if you want so it can be translated. typeDescription: typing.ClassVar[str] = _('Base Authenticator') diff --git a/server/src/uds/core/managers/publication.py b/server/src/uds/core/managers/publication.py index 67534b03..9626acfa 100644 --- a/server/src/uds/core/managers/publication.py +++ b/server/src/uds/core/managers/publication.py @@ -34,7 +34,7 @@ import datetime import pickle import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.db import transaction from uds.core.jobs.delayed_task import DelayedTask from uds.core.jobs.delayed_task_runner import DelayedTaskRunner diff --git a/server/src/uds/core/managers/user_preferences.py b/server/src/uds/core/managers/user_preferences.py index beed5cdc..36ab2db5 100644 --- a/server/src/uds/core/managers/user_preferences.py +++ b/server/src/uds/core/managers/user_preferences.py @@ -36,7 +36,7 @@ import logging import typing from django import forms -from django.utils.translation import ugettext as _, ugettext_lazy +from django.utils.translation import gettext as _, gettext_lazy from uds.core.util import singleton diff --git a/server/src/uds/core/managers/user_service.py b/server/src/uds/core/managers/user_service.py index 45b1d57d..f087878f 100644 --- a/server/src/uds/core/managers/user_service.py +++ b/server/src/uds/core/managers/user_service.py @@ -34,7 +34,7 @@ import logging import random import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.db.models import Q from django.db import transaction from uds.core.services.exceptions import OperationException @@ -371,12 +371,11 @@ class UserServiceManager(metaclass=singleton.Singleton): existing = servicePool.assignedUserServices().filter( user=user, state__in=State.VALID_STATES ) # , deployed_service__visible=True - lenExisting = existing.count() - if lenExisting > 0: # Already has 1 assigned + if existing.exists(): logger.debug( 'Found assigned service from %s to user %s', servicePool, user.name ) - return existing[0] + return existing.first() return None def getAssignationForUser( diff --git a/server/src/uds/core/module.py b/server/src/uds/core/module.py index 688ecbdb..fe745f42 100644 --- a/server/src/uds/core/module.py +++ b/server/src/uds/core/module.py @@ -37,7 +37,7 @@ import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.core.ui import UserInterface @@ -126,14 +126,14 @@ class Module(UserInterface, Environmentable, Serializable): @classmethod def name(cls: typing.Type['Module']) -> str: """ - Returns "translated" typeName, using ugettext for transforming + Returns "translated" typeName, using gettext for transforming cls.typeName Args: cls: This is a class method, so cls is the class Returns: - Translated type name (using ugettext) + Translated type name (using gettext) """ return _(cls.typeName) @@ -154,13 +154,13 @@ class Module(UserInterface, Environmentable, Serializable): def description(cls: typing.Type['Module']) -> str: """ This method returns the "translated" description, that is, using - ugettext for transforming cls.typeDescription. + gettext for transforming cls.typeDescription. Args: cls: This is a class method, so cls is the class Returns: - Translated description (using ugettext) + Translated description (using gettext) """ return _(cls.typeDescription) @@ -284,7 +284,7 @@ class Module(UserInterface, Environmentable, Serializable): preferable internacionalizated. Returns: - Internacionalized (using ugettext) string of result of the check. + Internacionalized (using gettext) string of result of the check. """ return _("No check method provided.") diff --git a/server/src/uds/core/osmanagers/osmanager.py b/server/src/uds/core/osmanagers/osmanager.py index 0237855f..f03e223c 100644 --- a/server/src/uds/core/osmanagers/osmanager.py +++ b/server/src/uds/core/osmanagers/osmanager.py @@ -32,7 +32,7 @@ """ import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.services import types as serviceTypes from uds.core.util.state import State from uds.core.util.stats.events import addEvent, ET_LOGIN, ET_LOGOUT diff --git a/server/src/uds/core/reports/report.py b/server/src/uds/core/reports/report.py index beb94010..9162d8d8 100644 --- a/server/src/uds/core/reports/report.py +++ b/server/src/uds/core/reports/report.py @@ -37,7 +37,7 @@ import typing from weasyprint import HTML, CSS, default_url_fetcher -from django.utils.translation import ugettext, ugettext_noop as _ +from django.utils.translation import gettext, gettext_noop as _ from django.template import loader from uds.core.ui import UserInterface, gui @@ -62,21 +62,21 @@ class Report(UserInterface): """ Helper to return translated report name """ - return ugettext(cls.name) + return gettext(cls.name) @classmethod def translated_description(cls): """ Helper to return translated report description """ - return ugettext(cls.description) + return gettext(cls.description) @classmethod def translated_group(cls): """ Helper to return translated report description """ - return ugettext(cls.group) + return gettext(cls.group) @classmethod def getUuid(cls): diff --git a/server/src/uds/core/services/provider.py b/server/src/uds/core/services/provider.py index 1425cefb..6e3cbe12 100644 --- a/server/src/uds/core/services/provider.py +++ b/server/src/uds/core/services/provider.py @@ -89,7 +89,7 @@ class ServiceProvider(Module): # : Name of type, used at administration interface to identify this # : provider (i.e. Xen server, oVirt Server, ...) # : This string will be translated when provided to admin interface - # : using ugettext, so you can mark it as "translatable" at derived classes (using ugettext_noop) + # : using gettext, so you can mark it as "translatable" at derived classes (using gettext_noop) # : if you want so it can be translated. typeName = 'Base Provider' @@ -101,7 +101,7 @@ class ServiceProvider(Module): # : Description shown at administration level for this provider. # : This string will be translated when provided to admin interface - # : using ugettext, so you can mark it as "translatable" at derived classes (using ugettext_noop) + # : using gettext, so you can mark it as "translatable" at derived classes (using gettext_noop) # : if you want so it can be translated. typeDescription = 'Base Service Provider' diff --git a/server/src/uds/core/services/publication.py b/server/src/uds/core/services/publication.py index b4246686..83998f97 100644 --- a/server/src/uds/core/services/publication.py +++ b/server/src/uds/core/services/publication.py @@ -246,7 +246,7 @@ class Publication(Environmentable, Serializable): The returned value, an string, will be used always by administration interface, meaning this that the translation environment will be ready, and that you - can use ugettext to return a version that can be translated to administration + can use gettext to return a version that can be translated to administration interface language. """ return 'unknown' diff --git a/server/src/uds/core/services/service.py b/server/src/uds/core/services/service.py index 842629aa..9cb17331 100644 --- a/server/src/uds/core/services/service.py +++ b/server/src/uds/core/services/service.py @@ -34,7 +34,7 @@ import typing import logging -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core import Module from uds.core.transports import protocols from uds.core.util.state import State @@ -100,7 +100,7 @@ class Service(Module): # : Name of type, used at administration interface to identify this # : service (i.e. Xen server, oVirt Server, ...) # : This string will be translated when provided to admin interface - # : using ugettext, so you can mark it as "_" at derived classes (using ugettext_noop) + # : using gettext, so you can mark it as "_" at derived classes (using gettext_noop) # : if you want so it can be translated. typeName = _('Base Service') @@ -112,7 +112,7 @@ class Service(Module): # : Description shown at administration level for this service. # : This string will be translated when provided to admin interface - # : using ugettext, so you can mark it as "_" at derived classes (using ugettext_noop) + # : using gettext, so you can mark it as "_" at derived classes (using gettext_noop) # : if you want so it can be translated. typeDescription = _('Base Service') diff --git a/server/src/uds/core/services/user_deployment.py b/server/src/uds/core/services/user_deployment.py index b8209289..8761fc85 100644 --- a/server/src/uds/core/services/user_deployment.py +++ b/server/src/uds/core/services/user_deployment.py @@ -542,7 +542,7 @@ class UserDeployment( for it, and it will be asked everytime it's needed to be shown to the user (when the administation asks for it). - :note: Remember that you can use ugettext to translate this error to + :note: Remember that you can use gettext to translate this error to user language whenever it is possible. (This one will get invoked directly from admin interface and, as so, will have translation environment correctly set up. diff --git a/server/src/uds/core/transports/transport.py b/server/src/uds/core/transports/transport.py index 4ece26b2..e9ac8bbc 100644 --- a/server/src/uds/core/transports/transport.py +++ b/server/src/uds/core/transports/transport.py @@ -34,7 +34,7 @@ import codecs import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.util import os_detector as OsDetector from uds.core import Module diff --git a/server/src/uds/core/ui/user_interface.py b/server/src/uds/core/ui/user_interface.py index 990c1486..900beb93 100644 --- a/server/src/uds/core/ui/user_interface.py +++ b/server/src/uds/core/ui/user_interface.py @@ -38,7 +38,7 @@ import copy import typing import logging -from django.utils.translation import get_language, ugettext as _, ugettext_noop +from django.utils.translation import get_language, gettext as _, gettext_noop from uds.core.managers import cryptoManager @@ -96,11 +96,11 @@ class gui: FALSE: typing.ClassVar[str] = 'false' # : String for advanced tabs - ADVANCED_TAB: typing.ClassVar[str] = ugettext_noop('Advanced') - PARAMETERS_TAB: typing.ClassVar[str] = ugettext_noop('Parameters') - CREDENTIALS_TAB: typing.ClassVar[str] = ugettext_noop('Credentials') - TUNNEL_TAB: typing.ClassVar[str] = ugettext_noop('Tunnel') - DISPLAY_TAB: typing.ClassVar[str] = ugettext_noop('Display') + ADVANCED_TAB: typing.ClassVar[str] = gettext_noop('Advanced') + PARAMETERS_TAB: typing.ClassVar[str] = gettext_noop('Parameters') + CREDENTIALS_TAB: typing.ClassVar[str] = gettext_noop('Credentials') + TUNNEL_TAB: typing.ClassVar[str] = gettext_noop('Tunnel') + DISPLAY_TAB: typing.ClassVar[str] = gettext_noop('Display') # : Static Callbacks simple registry callbacks: typing.Dict[ diff --git a/server/src/uds/core/util/ldaputil.py b/server/src/uds/core/util/ldaputil.py index 51d02a86..a9da3332 100644 --- a/server/src/uds/core/util/ldaputil.py +++ b/server/src/uds/core/util/ldaputil.py @@ -35,7 +35,7 @@ import typing import ldap.filter -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.core.util import tools logger = logging.getLogger(__name__) diff --git a/server/src/uds/core/util/state.py b/server/src/uds/core/util/state.py index faadbcb2..53040bda 100644 --- a/server/src/uds/core/util/state.py +++ b/server/src/uds/core/util/state.py @@ -30,7 +30,7 @@ """ @author: Adolfo Gómez, dkmaster at dkmon dot com """ -from django.utils.translation import ugettext_noop as _, ugettext_lazy +from django.utils.translation import gettext_noop as _, gettext_lazy # States for different objects. Not all objects supports all States @@ -162,5 +162,5 @@ class State: """ res = {} for k, v in State.string.items(): - res[k] = ugettext_lazy(v) + res[k] = gettext_lazy(v) return res diff --git a/server/src/uds/core/util/states/common.py b/server/src/uds/core/util/states/common.py index dba2d716..90a64547 100644 --- a/server/src/uds/core/util/states/common.py +++ b/server/src/uds/core/util/states/common.py @@ -32,7 +32,7 @@ """ import logging -from django.utils.translation import ugettext_noop as _, ugettext_lazy +from django.utils.translation import gettext_noop as _, gettext_lazy logger = logging.getLogger(__name__) @@ -150,4 +150,4 @@ def dictionary(): """ Returns a dictionary with current active locale translation of States to States String """ - return {k: ugettext_lazy(v) for k, v in string.items()} + return {k: gettext_lazy(v) for k, v in string.items()} diff --git a/server/src/uds/core/util/stats/counters.py b/server/src/uds/core/util/stats/counters.py index e644da9e..e80f99b5 100644 --- a/server/src/uds/core/util/stats/counters.py +++ b/server/src/uds/core/util/stats/counters.py @@ -34,7 +34,7 @@ import datetime import logging import typing -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from uds.core.managers.stats import StatsManager from uds.models import NEVER, Provider, Service, ServicePool, Authenticator diff --git a/server/src/uds/core/util/tools.py b/server/src/uds/core/util/tools.py index 88934ce1..d6341c1b 100644 --- a/server/src/uds/core/util/tools.py +++ b/server/src/uds/core/util/tools.py @@ -38,7 +38,7 @@ import unicodedata import typing from django.utils import formats -from django.utils.translation import ugettext +from django.utils.translation import gettext import django.template.defaultfilters as filters from uds.core import services @@ -149,7 +149,7 @@ def secondsToTimeString(seconds: int) -> str: minutes %= 60 days = hours // 24 hours %= 24 - return ugettext('{} days {:d}:{:02d}:{:02d}').format(days, hours, minutes, seconds) + return gettext('{} days {:d}:{:02d}:{:02d}').format(days, hours, minutes, seconds) def checkValidBasename(baseName: str, length: int = -1) -> None: @@ -168,22 +168,22 @@ def checkValidBasename(baseName: str, length: int = -1) -> None: """ if re.match(r'^[a-zA-Z0-9][a-zA-Z0-9-]*$', baseName) is None: raise services.Service.ValidationException( - ugettext('The basename is not a valid for a hostname') + gettext('The basename is not a valid for a hostname') ) if length == 0: raise services.Service.ValidationException( - ugettext('The length of basename plus length must be greater than 0') + gettext('The length of basename plus length must be greater than 0') ) if length != -1 and len(baseName) + length > 15: raise services.Service.ValidationException( - ugettext('The length of basename plus length must not be greater than 15') + gettext('The length of basename plus length must not be greater than 15') ) if baseName.isdigit(): raise services.Service.ValidationException( - ugettext('The machine name can\'t be only numbers') + gettext('The machine name can\'t be only numbers') ) diff --git a/server/src/uds/dispatchers/guacamole/urls.py b/server/src/uds/dispatchers/guacamole/urls.py index a8988eeb..781c9d9c 100644 --- a/server/src/uds/dispatchers/guacamole/urls.py +++ b/server/src/uds/dispatchers/guacamole/urls.py @@ -30,12 +30,12 @@ """ @author: Adolfo Gómez, dkmaster at dkmon dot com """ -from django.conf.urls import url +from django.urls import re_path from .views import guacamole urlpatterns = [ # Authenticated path - url( + re_path( r'^uds/guacamole/auth/(?P[^/]+)/(?P.+)$', guacamole, name='dispatcher.guacamole', diff --git a/server/src/uds/dispatchers/opengnsys/urls.py b/server/src/uds/dispatchers/opengnsys/urls.py index 5077bf0e..b129cdc8 100644 --- a/server/src/uds/dispatchers/opengnsys/urls.py +++ b/server/src/uds/dispatchers/opengnsys/urls.py @@ -29,12 +29,12 @@ ''' @author: Adolfo Gómez, dkmaster at dkmon dot com ''' -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url( + re_path( r'^uds/ognotify/(?P[a-z]+)/(?P[a-zA-Z0-9-_]+)/(?P[a-zA-Z0-9-_]+)$', views.opengnsys, name='dispatcher.opengnsys', diff --git a/server/src/uds/models/calendar_action.py b/server/src/uds/models/calendar_action.py index 37c30a04..e654633d 100644 --- a/server/src/uds/models/calendar_action.py +++ b/server/src/uds/models/calendar_action.py @@ -37,7 +37,7 @@ import logging import typing -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.db import models from uds.core.util import calendar @@ -51,7 +51,7 @@ from .service_pool import ServicePool from .transport import Transport from .authenticator import Authenticator -# from django.utils.translation import ugettext_lazy as _, ugettext +# from django.utils.translation import gettext_lazy as _, gettext logger = logging.getLogger(__name__) diff --git a/server/src/uds/models/calendar_rule.py b/server/src/uds/models/calendar_rule.py index 7ddd2281..1da07aaa 100644 --- a/server/src/uds/models/calendar_rule.py +++ b/server/src/uds/models/calendar_rule.py @@ -36,7 +36,7 @@ import logging import typing from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from dateutil import rrule as rules from .uuid_model import UUIDModel diff --git a/server/src/uds/models/meta_pool.py b/server/src/uds/models/meta_pool.py index 607e396c..0d9a64b6 100644 --- a/server/src/uds/models/meta_pool.py +++ b/server/src/uds/models/meta_pool.py @@ -35,7 +35,7 @@ import typing from django.db import models from django.db.models import signals, QuerySet -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.util import log from uds.core.util import states diff --git a/server/src/uds/models/permissions.py b/server/src/uds/models/permissions.py index d5a22a5b..c9eaa9da 100644 --- a/server/src/uds/models/permissions.py +++ b/server/src/uds/models/permissions.py @@ -32,7 +32,7 @@ """ import logging -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.db import models from django.db.models import Q diff --git a/server/src/uds/models/service_pool_group.py b/server/src/uds/models/service_pool_group.py index b3aae2be..5946c539 100644 --- a/server/src/uds/models/service_pool_group.py +++ b/server/src/uds/models/service_pool_group.py @@ -34,7 +34,7 @@ import logging import typing from django.db import models -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.core.ui.images import DEFAULT_THUMB_BASE64 diff --git a/server/src/uds/osmanagers/LinuxOsManager/__init__.py b/server/src/uds/osmanagers/LinuxOsManager/__init__.py index 1390d9be..feb80f6f 100644 --- a/server/src/uds/osmanagers/LinuxOsManager/__init__.py +++ b/server/src/uds/osmanagers/LinuxOsManager/__init__.py @@ -33,7 +33,7 @@ import os.path import sys -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.osmanagers.osmfactory import OSManagersFactory from uds.core.managers import downloadsManager from uds.core import VERSION diff --git a/server/src/uds/osmanagers/LinuxOsManager/linux_osmanager.py b/server/src/uds/osmanagers/LinuxOsManager/linux_osmanager.py index c24d708b..d884bb26 100644 --- a/server/src/uds/osmanagers/LinuxOsManager/linux_osmanager.py +++ b/server/src/uds/osmanagers/LinuxOsManager/linux_osmanager.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _, ugettext_lazy +from django.utils.translation import gettext_noop as _, gettext_lazy from uds.core.services import types as serviceTypes from uds.core.ui import gui @@ -63,11 +63,11 @@ class LinuxOsManager(osmanagers.OSManager): rdonly=True, tooltip=_('What to do when user logs out from service'), values=[ - {'id': 'keep', 'text': ugettext_lazy('Keep service assigned')}, - {'id': 'remove', 'text': ugettext_lazy('Remove service')}, + {'id': 'keep', 'text': gettext_lazy('Keep service assigned')}, + {'id': 'remove', 'text': gettext_lazy('Remove service')}, { 'id': 'keep-always', - 'text': ugettext_lazy('Keep service assigned even on new publication'), + 'text': gettext_lazy('Keep service assigned even on new publication'), }, ], defvalue='keep', diff --git a/server/src/uds/osmanagers/LinuxOsManager/linux_randompass_osmanager.py b/server/src/uds/osmanagers/LinuxOsManager/linux_randompass_osmanager.py index 55de0f52..79e9cf48 100644 --- a/server/src/uds/osmanagers/LinuxOsManager/linux_randompass_osmanager.py +++ b/server/src/uds/osmanagers/LinuxOsManager/linux_randompass_osmanager.py @@ -36,7 +36,7 @@ import codecs import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.ui import gui from uds.core import osmanagers from uds.core.util import log diff --git a/server/src/uds/osmanagers/WindowsOsManager/__init__.py b/server/src/uds/osmanagers/WindowsOsManager/__init__.py index efc7e8a0..6138152d 100644 --- a/server/src/uds/osmanagers/WindowsOsManager/__init__.py +++ b/server/src/uds/osmanagers/WindowsOsManager/__init__.py @@ -34,7 +34,7 @@ import os.path import sys -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core import osmanagers from uds.core import managers from uds.core import VERSION diff --git a/server/src/uds/osmanagers/WindowsOsManager/windows.py b/server/src/uds/osmanagers/WindowsOsManager/windows.py index a874e648..ff3ad1e6 100644 --- a/server/src/uds/osmanagers/WindowsOsManager/windows.py +++ b/server/src/uds/osmanagers/WindowsOsManager/windows.py @@ -12,7 +12,7 @@ import codecs import logging import typing -from django.utils.translation import ugettext_noop as _, ugettext_lazy +from django.utils.translation import gettext_noop as _, gettext_lazy from uds.core import osmanagers from uds.core.services import types as serviceTypes from uds.core.ui import gui @@ -54,11 +54,11 @@ class WindowsOsManager(osmanagers.OSManager): rdonly=True, tooltip=_('What to do when user logs out from service'), values=[ - {'id': 'keep', 'text': ugettext_lazy('Keep service assigned')}, - {'id': 'remove', 'text': ugettext_lazy('Remove service')}, + {'id': 'keep', 'text': gettext_lazy('Keep service assigned')}, + {'id': 'remove', 'text': gettext_lazy('Remove service')}, { 'id': 'keep-always', - 'text': ugettext_lazy('Keep service assigned even on new publication'), + 'text': gettext_lazy('Keep service assigned even on new publication'), }, ], defvalue='keep', diff --git a/server/src/uds/osmanagers/WindowsOsManager/windows_domain.py b/server/src/uds/osmanagers/WindowsOsManager/windows_domain.py index a7f19e70..7c6122a8 100644 --- a/server/src/uds/osmanagers/WindowsOsManager/windows_domain.py +++ b/server/src/uds/osmanagers/WindowsOsManager/windows_domain.py @@ -38,7 +38,7 @@ import typing import dns.resolver import ldap -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.ui import gui from uds.core.managers import cryptoManager from uds.core import osmanagers diff --git a/server/src/uds/osmanagers/WindowsOsManager/windows_random.py b/server/src/uds/osmanagers/WindowsOsManager/windows_random.py index 9f9799f4..cd8ae3e8 100644 --- a/server/src/uds/osmanagers/WindowsOsManager/windows_random.py +++ b/server/src/uds/osmanagers/WindowsOsManager/windows_random.py @@ -37,7 +37,7 @@ import string import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.ui import gui from uds.core.managers import cryptoManager from uds.core import osmanagers diff --git a/server/src/uds/reports/auto/__init__.py b/server/src/uds/reports/auto/__init__.py index e2212fc6..a8456103 100644 --- a/server/src/uds/reports/auto/__init__.py +++ b/server/src/uds/reports/auto/__init__.py @@ -34,7 +34,7 @@ import logging import datetime import typing -from django.utils.translation import ugettext, ugettext_noop as _ +from django.utils.translation import gettext, gettext_noop as _ from uds.core.ui import UserInterface, UserInterfaceType, gui from uds.core.reports import Report diff --git a/server/src/uds/reports/auto/fields.py b/server/src/uds/reports/auto/fields.py index 3be659d7..8fbea4d6 100644 --- a/server/src/uds/reports/auto/fields.py +++ b/server/src/uds/reports/auto/fields.py @@ -34,7 +34,7 @@ import datetime import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.ui import gui from uds import models diff --git a/server/src/uds/reports/lists/base.py b/server/src/uds/reports/lists/base.py index 0ed429e2..721c59fa 100644 --- a/server/src/uds/reports/lists/base.py +++ b/server/src/uds/reports/lists/base.py @@ -32,7 +32,7 @@ """ import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core import reports diff --git a/server/src/uds/reports/lists/users.py b/server/src/uds/reports/lists/users.py index 53081c14..634497de 100644 --- a/server/src/uds/reports/lists/users.py +++ b/server/src/uds/reports/lists/users.py @@ -38,7 +38,7 @@ import logging # import openpyxl # import openpyxl.writer.excel -from django.utils.translation import ugettext, ugettext_lazy as _ +from django.utils.translation import gettext, gettext_lazy as _ from uds.core.ui import gui from uds.models import Authenticator @@ -84,8 +84,8 @@ class ListReportUsers(ListReport): 'users': users, 'auth': auth.name, }, - header=ugettext('Users List for {}').format(auth.name), - water=ugettext('UDS Report of users in {}').format(auth.name), + header=gettext('Users List for {}').format(auth.name), + water=gettext('UDS Report of users in {}').format(auth.name), ) @@ -110,7 +110,7 @@ class ListReportsUsersCSV(ListReportUsers): users = auth.users.order_by('name') writer.writerow( - [ugettext('User ID'), ugettext('Real Name'), ugettext('Last access')] + [gettext('User ID'), gettext('Real Name'), gettext('Last access')] ) for v in users: @@ -141,7 +141,7 @@ class ListReportsUsersCSV(ListReportUsers): # auth = Authenticator.objects.get(uuid=self.authenticator.value) # users = auth.users.order_by('name') -# ws.append([ugettext('User ID'), ugettext('Real Name'), ugettext('Last access')]) +# ws.append([gettext('User ID'), gettext('Real Name'), gettext('Last access')]) # for v in users: # ws.append([v.name, v.real_name, v.last_access]) diff --git a/server/src/uds/reports/stats/auth_stats.py b/server/src/uds/reports/stats/auth_stats.py index 14570bd7..29c311d3 100644 --- a/server/src/uds/reports/stats/auth_stats.py +++ b/server/src/uds/reports/stats/auth_stats.py @@ -32,7 +32,7 @@ import logging import typing -from django.utils.translation import ugettext, ugettext_lazy as _ +from django.utils.translation import gettext, gettext_lazy as _ from uds.core.ui import gui from uds.core.util.stats import counters @@ -136,6 +136,6 @@ class AuthenticatorsStats(StatsReportAuto): return self.templateAsPDF( 'uds/reports/stats/authenticator_stats.html', dct={'data': stats}, - header=ugettext('Users usage list'), - water=ugettext('UDS Report of users usage'), + header=gettext('Users usage list'), + water=gettext('UDS Report of users usage'), ) diff --git a/server/src/uds/reports/stats/base.py b/server/src/uds/reports/stats/base.py index 4cde6ffe..b6d3d679 100644 --- a/server/src/uds/reports/stats/base.py +++ b/server/src/uds/reports/stats/base.py @@ -32,7 +32,7 @@ """ import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core import reports from ..auto import ReportAuto diff --git a/server/src/uds/reports/stats/pool_users_summary.py b/server/src/uds/reports/stats/pool_users_summary.py index f67c5edd..a4a5b929 100644 --- a/server/src/uds/reports/stats/pool_users_summary.py +++ b/server/src/uds/reports/stats/pool_users_summary.py @@ -35,7 +35,7 @@ import datetime import logging import typing -from django.utils.translation import ugettext, ugettext_lazy as _ +from django.utils.translation import gettext, gettext_lazy as _ from uds.core.ui import gui from uds.core.util.stats import events @@ -150,8 +150,8 @@ class UsageSummaryByUsersPool(StatsReport): 'beginning': self.startDate.date(), 'ending': self.endDate.date(), }, - header=ugettext('Users usage list for {}').format(poolName), - water=ugettext('UDS Report of users in {}').format(poolName), + header=gettext('Users usage list for {}').format(poolName), + water=gettext('UDS Report of users in {}').format(poolName), ) @@ -174,10 +174,10 @@ class UsageSummaryByUsersPoolCSV(UsageSummaryByUsersPool): writer.writerow( [ - ugettext('User'), - ugettext('Sessions'), - ugettext('Hours'), - ugettext('Average'), + gettext('User'), + gettext('Sessions'), + gettext('Hours'), + gettext('Average'), ] ) diff --git a/server/src/uds/reports/stats/pools_performance.py b/server/src/uds/reports/stats/pools_performance.py index 395038f4..307ec821 100644 --- a/server/src/uds/reports/stats/pools_performance.py +++ b/server/src/uds/reports/stats/pools_performance.py @@ -36,7 +36,7 @@ import datetime import logging import typing -from django.utils.translation import ugettext, ugettext_lazy as _ +from django.utils.translation import gettext, gettext_lazy as _ from django.db.models import Count import django.template.defaultfilters as filters @@ -255,8 +255,8 @@ class PoolPerformanceReport(StatsReport): 'ending': self.endDate.date(), 'intervals': self.samplingPoints.num(), }, - header=ugettext('UDS Pools Performance Report'), - water=ugettext('Pools Performance'), + header=gettext('UDS Pools Performance Report'), + water=gettext('Pools Performance'), images={'graph1': graph1.getvalue(), 'graph2': graph2.getvalue()}, ) @@ -281,10 +281,10 @@ class PoolPerformanceReportCSV(PoolPerformanceReport): writer.writerow( [ - ugettext('Pool'), - ugettext('Date range'), - ugettext('Users'), - ugettext('Accesses'), + gettext('Pool'), + gettext('Date range'), + gettext('Users'), + gettext('Accesses'), ] ) diff --git a/server/src/uds/reports/stats/pools_usage_day.py b/server/src/uds/reports/stats/pools_usage_day.py index 2a975b3b..88298538 100644 --- a/server/src/uds/reports/stats/pools_usage_day.py +++ b/server/src/uds/reports/stats/pools_usage_day.py @@ -35,7 +35,7 @@ import datetime import logging import typing -from django.utils.translation import ugettext, ugettext_lazy as _ +from django.utils.translation import gettext, gettext_lazy as _ from uds.core.ui import gui from uds.core.util.stats import counters @@ -149,8 +149,8 @@ class CountersPoolAssigned(StatsReport): ], 'beginning': self.startDate.date(), }, - header=ugettext('Services usage report for a day'), - water=ugettext('Service usage report'), + header=gettext('Services usage report for a day'), + water=gettext('Service usage report'), images={'graph1': graph1.getvalue()}, ) @@ -168,7 +168,7 @@ class CountersPoolAssignedCSV(CountersPoolAssigned): def generate(self): output = io.StringIO() writer = csv.writer(output) - writer.writerow([ugettext('Pool'), ugettext('Hour'), ugettext('Services')]) + writer.writerow([gettext('Pool'), gettext('Hour'), gettext('Services')]) items = self.getData() diff --git a/server/src/uds/reports/stats/pools_usage_summary.py b/server/src/uds/reports/stats/pools_usage_summary.py index 717041fa..2db33175 100644 --- a/server/src/uds/reports/stats/pools_usage_summary.py +++ b/server/src/uds/reports/stats/pools_usage_summary.py @@ -35,7 +35,7 @@ import datetime import typing import logging -from django.utils.translation import ugettext, ugettext_lazy as _ +from django.utils.translation import gettext, gettext_lazy as _ from .usage_by_pool import UsageByPool @@ -123,14 +123,14 @@ class PoolsUsageSummary(UsageByPool): 'start': start, 'end': end, }, - header=ugettext('Summary of Pools usage') + header=gettext('Summary of Pools usage') + ' ' + start + ' ' - + ugettext('to') + + gettext('to') + ' ' + end, - water=ugettext('UDS Report Summary of pools usage'), + water=gettext('UDS Report Summary of pools usage'), ) @@ -153,11 +153,11 @@ class PoolsUsageSummaryCSV(PoolsUsageSummary): writer.writerow( [ - ugettext('Pool'), - ugettext('Total Time (seconds)'), - ugettext('Total Accesses'), - ugettext('Unique users'), - ugettext('Mean time (seconds)'), + gettext('Pool'), + gettext('Total Time (seconds)'), + gettext('Total Accesses'), + gettext('Unique users'), + gettext('Mean time (seconds)'), ] ) @@ -168,7 +168,7 @@ class PoolsUsageSummaryCSV(PoolsUsageSummary): writer.writerow( [ - ugettext('Total'), + gettext('Total'), totalTime, totalCount, totalUsers, diff --git a/server/src/uds/reports/stats/usage.py b/server/src/uds/reports/stats/usage.py index 7b4e6504..e0d8aed8 100644 --- a/server/src/uds/reports/stats/usage.py +++ b/server/src/uds/reports/stats/usage.py @@ -30,7 +30,7 @@ .. moduleauthor:: Adolfo Gómez, dkmaster at dkmon dot com """ -""" from django.utils.translation import ugettext_noop as _ +""" from django.utils.translation import gettext_noop as _ from .base import StatsReport diff --git a/server/src/uds/reports/stats/usage_by_pool.py b/server/src/uds/reports/stats/usage_by_pool.py index e17708cd..7f17cb2a 100644 --- a/server/src/uds/reports/stats/usage_by_pool.py +++ b/server/src/uds/reports/stats/usage_by_pool.py @@ -35,7 +35,7 @@ import datetime import logging import typing -from django.utils.translation import ugettext, ugettext_lazy as _ +from django.utils.translation import gettext, gettext_lazy as _ from uds.core.ui import gui from uds.core.util.stats import events @@ -80,7 +80,7 @@ class UsageByPool(StatsReport): def initGui(self): logger.debug('Initializing gui') - vals = [gui.choiceItem('0-0-0-0', ugettext('ALL POOLS'))] + [ + vals = [gui.choiceItem('0-0-0-0', gettext('ALL POOLS'))] + [ gui.choiceItem(v.uuid, v.name) for v in ServicePool.objects.all().order_by('name') ] @@ -143,8 +143,8 @@ class UsageByPool(StatsReport): 'data': items, 'pool': poolName, }, - header=ugettext('Users usage list'), - water=ugettext('UDS Report of users usage'), + header=gettext('Users usage list'), + water=gettext('UDS Report of users usage'), ) @@ -167,11 +167,11 @@ class UsageByPoolCSV(UsageByPool): writer.writerow( [ - ugettext('Date'), - ugettext('User'), - ugettext('Seconds'), - ugettext('Pool'), - ugettext('Origin'), + gettext('Date'), + gettext('User'), + gettext('Seconds'), + gettext('Pool'), + gettext('Origin'), ] ) diff --git a/server/src/uds/reports/stats/user_access.py b/server/src/uds/reports/stats/user_access.py index 3e371202..b8cd5330 100644 --- a/server/src/uds/reports/stats/user_access.py +++ b/server/src/uds/reports/stats/user_access.py @@ -35,7 +35,7 @@ import datetime import logging import typing -from django.utils.translation import ugettext, ugettext_lazy as _ +from django.utils.translation import gettext, gettext_lazy as _ import django.template.defaultfilters as filters from uds.core.ui import gui @@ -264,8 +264,8 @@ class StatsReportLogin(StatsReport): 'ending': self.endDate.date(), 'intervals': self.samplingPoints.num(), }, - header=ugettext('Users access to UDS'), - water=ugettext('UDS Report for users access'), + header=gettext('Users access to UDS'), + water=gettext('UDS Report for users access'), images={ 'graph1': graph1.getvalue(), 'graph2': graph2.getvalue(), @@ -294,7 +294,7 @@ class StatsReportLoginCSV(StatsReportLogin): reportData = self.getRangeData()[2] - writer.writerow([ugettext('Date range'), ugettext('Users')]) + writer.writerow([gettext('Date range'), gettext('Users')]) for v in reportData: writer.writerow([v['date'], v['users']]) diff --git a/server/src/uds/services/OVirt/provider.py b/server/src/uds/services/OVirt/provider.py index ed8a6b84..a46ac117 100644 --- a/server/src/uds/services/OVirt/provider.py +++ b/server/src/uds/services/OVirt/provider.py @@ -32,7 +32,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core import services from uds.core.ui import gui @@ -64,7 +64,7 @@ class OVirtProvider( * The form fields needed by administrators to configure this provider :note: At class level, the translation must be simply marked as so - using ugettext_noop. This is so cause we will translate the string when + using gettext_noop. This is so cause we will translate the string when sent to the administration client. For this class to get visible at administration client as a provider type, @@ -76,7 +76,7 @@ class OVirtProvider( offers = [OVirtLinkedService] # : Name to show the administrator. This string will be translated BEFORE # : sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) typeName = _('oVirt/RHEV Platform Provider') # : Type used internally to identify this provider typeType = 'oVirtPlatform' @@ -84,7 +84,7 @@ class OVirtProvider( typeDescription = _('oVirt platform service provider') # : Icon file used as icon for this provider. This string will be translated # : BEFORE sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) iconFile = 'provider.png' # now comes the form fields diff --git a/server/src/uds/services/OVirt/publication.py b/server/src/uds/services/OVirt/publication.py index f8f41e13..f86eb1bd 100644 --- a/server/src/uds/services/OVirt/publication.py +++ b/server/src/uds/services/OVirt/publication.py @@ -34,7 +34,7 @@ from datetime import datetime import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.core.services import Publication from uds.core.util.state import State diff --git a/server/src/uds/services/OVirt/service.py b/server/src/uds/services/OVirt/service.py index 8b319d3a..9158f148 100644 --- a/server/src/uds/services/OVirt/service.py +++ b/server/src/uds/services/OVirt/service.py @@ -34,7 +34,7 @@ import re import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.transports import protocols from uds.core.services import Service, types as serviceTypes @@ -60,7 +60,7 @@ class OVirtLinkedService(Service): # pylint: disable=too-many-public-methods # : Name to show the administrator. This string will be translated BEFORE # : sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) typeName = _('oVirt/RHEV Linked Clone') # : Type used internally to identify this provider typeType = 'oVirtLinkedService' @@ -68,7 +68,7 @@ class OVirtLinkedService(Service): # pylint: disable=too-many-public-methods typeDescription = _('oVirt Services based on templates and COW (experimental)') # : Icon file used as icon for this provider. This string will be translated # : BEFORE sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) iconFile = 'service.png' # Functional related data diff --git a/server/src/uds/services/OpenGnsys/helpers.py b/server/src/uds/services/OpenGnsys/helpers.py index 718895d3..4974e1a9 100644 --- a/server/src/uds/services/OpenGnsys/helpers.py +++ b/server/src/uds/services/OpenGnsys/helpers.py @@ -31,7 +31,7 @@ import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.core.environment import Environment from uds.core.ui import gui diff --git a/server/src/uds/services/OpenGnsys/jobs.py b/server/src/uds/services/OpenGnsys/jobs.py index cbcbf133..fbf26b24 100644 --- a/server/src/uds/services/OpenGnsys/jobs.py +++ b/server/src/uds/services/OpenGnsys/jobs.py @@ -34,7 +34,7 @@ import datetime import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core import jobs from uds import models diff --git a/server/src/uds/services/OpenGnsys/provider.py b/server/src/uds/services/OpenGnsys/provider.py index ccfb307b..8a179ba2 100644 --- a/server/src/uds/services/OpenGnsys/provider.py +++ b/server/src/uds/services/OpenGnsys/provider.py @@ -34,7 +34,7 @@ Created on Jun 22, 2012 import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.services import ServiceProvider from uds.core.ui import gui @@ -61,7 +61,7 @@ class OGProvider(ServiceProvider): * The form fields needed by administrators to configure this provider :note: At class level, the translation must be simply marked as so - using ugettext_noop. This is so cause we will translate the string when + using gettext_noop. This is so cause we will translate the string when sent to the administration client. For this class to get visible at administration client as a provider type, @@ -73,7 +73,7 @@ class OGProvider(ServiceProvider): offers = [OGService] # : Name to show the administrator. This string will be translated BEFORE # : sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) typeName = _('OpenGnsys Platform Provider') # : Type used internally to identify this provider typeType = 'openGnsysPlatform' @@ -81,7 +81,7 @@ class OGProvider(ServiceProvider): typeDescription = _('OpenGnsys platform service provider (experimental)') # : Icon file used as icon for this provider. This string will be translated # : BEFORE sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) iconFile = 'provider.png' # now comes the form fields diff --git a/server/src/uds/services/OpenGnsys/service.py b/server/src/uds/services/OpenGnsys/service.py index 7b476e76..244698a4 100644 --- a/server/src/uds/services/OpenGnsys/service.py +++ b/server/src/uds/services/OpenGnsys/service.py @@ -32,7 +32,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.transports import protocols from uds.core.services import Service, types as serviceTypes @@ -57,7 +57,7 @@ class OGService(Service): # : Name to show the administrator. This string will be translated BEFORE # : sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) typeName = _('OpenGnsys Machines Service') # : Type used internally to identify this provider typeType = 'openGnsysMachine' @@ -65,7 +65,7 @@ class OGService(Service): typeDescription = _('OpenGnsys physical machines') # : Icon file used as icon for this provider. This string will be translated # : BEFORE sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) iconFile = 'provider.png' # Functional related data diff --git a/server/src/uds/services/OpenNebula/provider.py b/server/src/uds/services/OpenNebula/provider.py index a9677c12..343c28c3 100644 --- a/server/src/uds/services/OpenNebula/provider.py +++ b/server/src/uds/services/OpenNebula/provider.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.services import ServiceProvider from uds.core.ui import gui from uds.core.util import validators @@ -54,7 +54,7 @@ class OpenNebulaProvider(ServiceProvider): # pylint: disable=too-many-public-me offers = [LiveService] # : Name to show the administrator. This string will be translated BEFORE # : sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) typeName = _('OpenNebula Platform Provider') # : Type used internally to identify this provider typeType = 'openNebulaPlatform' @@ -62,7 +62,7 @@ class OpenNebulaProvider(ServiceProvider): # pylint: disable=too-many-public-me typeDescription = _('OpenNebula platform service provider') # : Icon file used as icon for this provider. This string will be translated # : BEFORE sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) iconFile = 'provider.png' # now comes the form fields diff --git a/server/src/uds/services/OpenNebula/service.py b/server/src/uds/services/OpenNebula/service.py index 491aa51c..ee75e765 100644 --- a/server/src/uds/services/OpenNebula/service.py +++ b/server/src/uds/services/OpenNebula/service.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.transports import protocols from uds.core.services import Service, types as serviceTypes from uds.core.util import validators @@ -58,7 +58,7 @@ class LiveService(Service): # : Name to show the administrator. This string will be translated BEFORE # : sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) typeName = _('OpenNebula Live Images') # : Type used internally to identify this provider typeType = 'openNebulaLiveService' @@ -66,7 +66,7 @@ class LiveService(Service): typeDescription = _('OpenNebula live images based service') # : Icon file used as icon for this provider. This string will be translated # : BEFORE sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) iconFile = 'provider.png' # Functional related data diff --git a/server/src/uds/services/OpenStack/helpers.py b/server/src/uds/services/OpenStack/helpers.py index cdb1d93f..a341f283 100644 --- a/server/src/uds/services/OpenStack/helpers.py +++ b/server/src/uds/services/OpenStack/helpers.py @@ -32,7 +32,7 @@ import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.core.ui import gui from . import openstack diff --git a/server/src/uds/services/OpenStack/openstack/openstack_client.py b/server/src/uds/services/OpenStack/openstack/openstack_client.py index 57c781d3..faacfcc7 100644 --- a/server/src/uds/services/OpenStack/openstack/openstack_client.py +++ b/server/src/uds/services/OpenStack/openstack/openstack_client.py @@ -38,7 +38,7 @@ import requests # import dateutil.parser -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ # Not imported at runtime, just for type checking if typing.TYPE_CHECKING: diff --git a/server/src/uds/services/OpenStack/provider.py b/server/src/uds/services/OpenStack/provider.py index 630546f5..b875e899 100644 --- a/server/src/uds/services/OpenStack/provider.py +++ b/server/src/uds/services/OpenStack/provider.py @@ -33,7 +33,7 @@ import typing import logging -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.services import ServiceProvider from uds.core.ui import gui from uds.core.util import validators @@ -64,7 +64,7 @@ class OpenStackProvider(ServiceProvider): * The form fields needed by administrators to configure this provider :note: At class level, the translation must be simply marked as so - using ugettext_noop. This is so cause we will translate the string when + using gettext_noop. This is so cause we will translate the string when sent to the administration client. For this class to get visible at administration client as a provider type, @@ -76,7 +76,7 @@ class OpenStackProvider(ServiceProvider): offers = [LiveService] # : Name to show the administrator. This string will be translated BEFORE # : sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) typeName = _('OpenStack Platform Provider') # : Type used internally to identify this provider typeType = 'openStackPlatformNew' @@ -84,7 +84,7 @@ class OpenStackProvider(ServiceProvider): typeDescription = _('OpenStack platform service provider') # : Icon file used as icon for this provider. This string will be translated # : BEFORE sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) iconFile = 'openstack.png' # now comes the form fields diff --git a/server/src/uds/services/OpenStack/provider_legacy.py b/server/src/uds/services/OpenStack/provider_legacy.py index 1cb8c2bb..32f9eccc 100644 --- a/server/src/uds/services/OpenStack/provider_legacy.py +++ b/server/src/uds/services/OpenStack/provider_legacy.py @@ -35,7 +35,7 @@ Created on Jun 22, 2012 import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.services import ServiceProvider from uds.core.ui import gui from uds.core.util import validators @@ -68,7 +68,7 @@ class ProviderLegacy(ServiceProvider): * The form fields needed by administrators to configure this provider :note: At class level, the translation must be simply marked as so - using ugettext_noop. This is so cause we will translate the string when + using gettext_noop. This is so cause we will translate the string when sent to the administration client. For this class to get visible at administration client as a provider type, @@ -80,7 +80,7 @@ class ProviderLegacy(ServiceProvider): offers = [LiveService] # : Name to show the administrator. This string will be translated BEFORE # : sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) typeName = _('OpenStack LEGACY Platform Provider') # : Type used internally to identify this provider typeType = 'openStackPlatform' @@ -90,7 +90,7 @@ class ProviderLegacy(ServiceProvider): ) # : Icon file used as icon for this provider. This string will be translated # : BEFORE sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) iconFile = 'provider.png' # now comes the form fields diff --git a/server/src/uds/services/OpenStack/service.py b/server/src/uds/services/OpenStack/service.py index 377b2533..3b6927a5 100644 --- a/server/src/uds/services/OpenStack/service.py +++ b/server/src/uds/services/OpenStack/service.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.transports import protocols from uds.core.services import Service, types as serviceTypes from uds.core.util import tools @@ -62,7 +62,7 @@ class LiveService(Service): # : Name to show the administrator. This string will be translated BEFORE # : sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) typeName = _('OpenStack Live Volume') # : Type used internally to identify this provider typeType = 'openStackLiveService' @@ -70,7 +70,7 @@ class LiveService(Service): typeDescription = _('OpenStack live images based service') # : Icon file used as icon for this provider. This string will be translated # : BEFORE sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) iconFile = 'openstack.png' # Functional related data diff --git a/server/src/uds/services/PhysicalMachines/deployment.py b/server/src/uds/services/PhysicalMachines/deployment.py index a76dbd98..4edc5950 100644 --- a/server/src/uds/services/PhysicalMachines/deployment.py +++ b/server/src/uds/services/PhysicalMachines/deployment.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ import dns.resolver diff --git a/server/src/uds/services/PhysicalMachines/provider.py b/server/src/uds/services/PhysicalMachines/provider.py index a32b2447..ffa13ef3 100644 --- a/server/src/uds/services/PhysicalMachines/provider.py +++ b/server/src/uds/services/PhysicalMachines/provider.py @@ -34,7 +34,7 @@ import configparser import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ import dns.resolver diff --git a/server/src/uds/services/Proxmox/helpers.py b/server/src/uds/services/Proxmox/helpers.py index a8307f91..cde165de 100644 --- a/server/src/uds/services/Proxmox/helpers.py +++ b/server/src/uds/services/Proxmox/helpers.py @@ -30,7 +30,7 @@ import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ logger = logging.getLogger(__name__) diff --git a/server/src/uds/services/Proxmox/provider.py b/server/src/uds/services/Proxmox/provider.py index 6c67add1..b4985211 100644 --- a/server/src/uds/services/Proxmox/provider.py +++ b/server/src/uds/services/Proxmox/provider.py @@ -30,7 +30,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core import services from uds.core.ui import gui diff --git a/server/src/uds/services/Proxmox/publication.py b/server/src/uds/services/Proxmox/publication.py index a46f039c..6250e8ac 100644 --- a/server/src/uds/services/Proxmox/publication.py +++ b/server/src/uds/services/Proxmox/publication.py @@ -33,7 +33,7 @@ import time import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.core import services from uds.core.util.state import State diff --git a/server/src/uds/services/Proxmox/service.py b/server/src/uds/services/Proxmox/service.py index 96ca98dd..33c43e5e 100644 --- a/server/src/uds/services/Proxmox/service.py +++ b/server/src/uds/services/Proxmox/service.py @@ -32,7 +32,7 @@ import re import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.transports import protocols from uds.core.services import Service, types as serviceTypes @@ -60,7 +60,7 @@ class ProxmoxLinkedService(Service): # pylint: disable=too-many-public-methods # : Name to show the administrator. This string will be translated BEFORE # : sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) typeName = _('Proxmox Linked Clone') # : Type used internally to identify this provider typeType = 'ProxmoxLinkedService' @@ -68,7 +68,7 @@ class ProxmoxLinkedService(Service): # pylint: disable=too-many-public-methods typeDescription = _('Proxmox Services based on templates and COW (experimental)') # : Icon file used as icon for this provider. This string will be translated # : BEFORE sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) iconFile = 'service.png' # Functional related data diff --git a/server/src/uds/services/Sample/deployment_two.py b/server/src/uds/services/Sample/deployment_two.py index 9d8d79f6..cb67bf4e 100644 --- a/server/src/uds/services/Sample/deployment_two.py +++ b/server/src/uds/services/Sample/deployment_two.py @@ -414,7 +414,7 @@ class SampleUserDeploymentTwo(services.UserDeployment): for it, and it will be asked everytime it's needed to be shown to the user (when the administation asks for it). - :note: Remember that you can use ugettext to translate this error to + :note: Remember that you can use gettext to translate this error to user language whenever it is possible. (This one will get invoked directly from admin interface and, as so, will have translation environment correctly set up. diff --git a/server/src/uds/services/Sample/provider.py b/server/src/uds/services/Sample/provider.py index 769719c0..41787a35 100644 --- a/server/src/uds/services/Sample/provider.py +++ b/server/src/uds/services/Sample/provider.py @@ -36,7 +36,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core import services from uds.core.ui import gui from .service import ServiceOne, ServiceTwo @@ -59,7 +59,7 @@ class Provider(services.ServiceProvider): * The form fields needed by administrators to configure this provider :note: At class level, the translation must be simply marked as so - using ugettext_noop. This is so cause we will translate the string when + using gettext_noop. This is so cause we will translate the string when sent to the administration client. For this class to get visible at administration client as a provider type, @@ -71,7 +71,7 @@ class Provider(services.ServiceProvider): offers = [ServiceOne, ServiceTwo] # : Name to show the administrator. This string will be translated BEFORE # : sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) typeName = _('Sample Provider') # : Type used internally to identify this provider typeType = 'SampleProvider' @@ -79,7 +79,7 @@ class Provider(services.ServiceProvider): typeDescription = _('Sample (and dummy) service provider') # : Icon file used as icon for this provider. This string will be translated # : BEFORE sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) iconFile = 'provider.png' # now comes the form fields @@ -93,7 +93,7 @@ class Provider(services.ServiceProvider): # "random" # : Remote host. Here core will translate label and tooltip, remember to - # : mark them as _ using ugettext_noop. + # : mark them as _ using gettext_noop. remoteHost = gui.TextField( oder=1, length=64, diff --git a/server/src/uds/services/Sample/publication.py b/server/src/uds/services/Sample/publication.py index 43847776..a6fec0d3 100644 --- a/server/src/uds/services/Sample/publication.py +++ b/server/src/uds/services/Sample/publication.py @@ -35,7 +35,7 @@ import string import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.core import services from uds.core.util.state import State diff --git a/server/src/uds/services/Sample/service.py b/server/src/uds/services/Sample/service.py index 56a9b1ee..58b77611 100644 --- a/server/src/uds/services/Sample/service.py +++ b/server/src/uds/services/Sample/service.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core import services from uds.core.ui import gui @@ -75,7 +75,7 @@ class ServiceOne(services.Service): # : Name to show the administrator. This string will be translated BEFORE # : sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) typeName = _('Sample Service One') # : Type used internally to identify this provider typeType = 'SampleService1' @@ -83,7 +83,7 @@ class ServiceOne(services.Service): typeDescription = _('Sample (and dummy) service ONE') # : Icon file used as icon for this provider. This string will be translated # : BEFORE sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) iconFile = 'service.png' # Functional related data diff --git a/server/src/uds/services/Xen/provider.py b/server/src/uds/services/Xen/provider.py index e7a3a9b5..0536f142 100644 --- a/server/src/uds/services/Xen/provider.py +++ b/server/src/uds/services/Xen/provider.py @@ -31,7 +31,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.services import ServiceProvider from uds.core.ui import gui @@ -63,7 +63,7 @@ class XenProvider(ServiceProvider): # pylint: disable=too-many-public-methods * The form fields needed by administrators to configure this provider :note: At class level, the translation must be simply marked as so - using ugettext_noop. This is so cause we will translate the string when + using gettext_noop. This is so cause we will translate the string when sent to the administration client. For this class to get visible at administration client as a provider type, @@ -75,7 +75,7 @@ class XenProvider(ServiceProvider): # pylint: disable=too-many-public-methods offers = [XenLinkedService] # : Name to show the administrator. This string will be translated BEFORE # : sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) typeName = _('Xenserver/XCP-NG Platforms Provider') # : Type used internally to identify this provider typeType = 'XenPlatform' @@ -83,7 +83,7 @@ class XenProvider(ServiceProvider): # pylint: disable=too-many-public-methods typeDescription = _('XenServer and XCP-NG platforms service provider') # : Icon file used as icon for this provider. This string will be translated # : BEFORE sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) iconFile = 'provider.png' # now comes the form fields diff --git a/server/src/uds/services/Xen/publication.py b/server/src/uds/services/Xen/publication.py index f091934e..286d06df 100644 --- a/server/src/uds/services/Xen/publication.py +++ b/server/src/uds/services/Xen/publication.py @@ -33,7 +33,7 @@ from datetime import datetime import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.core.services import Publication from uds.core.util.state import State diff --git a/server/src/uds/services/Xen/service.py b/server/src/uds/services/Xen/service.py index 545df345..10f853a5 100644 --- a/server/src/uds/services/Xen/service.py +++ b/server/src/uds/services/Xen/service.py @@ -32,7 +32,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.services import Service, types as serviceTypes from uds.core.util import tools from uds.core.ui import gui @@ -57,7 +57,7 @@ class XenLinkedService(Service): # pylint: disable=too-many-public-methods # : Name to show the administrator. This string will be translated BEFORE # : sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) typeName = _('Xen Linked Clone') # : Type used internally to identify this provider typeType = 'XenLinkedService' @@ -65,7 +65,7 @@ class XenLinkedService(Service): # pylint: disable=too-many-public-methods typeDescription = _('Xen Services based on templates') # : Icon file used as icon for this provider. This string will be translated # : BEFORE sending it to administration interface, so don't forget to - # : mark it as _ (using ugettext_noop) + # : mark it as _ (using gettext_noop) iconFile = 'service.png' # Functional related data diff --git a/server/src/uds/transports/HTML5RDP/html5rdp.py b/server/src/uds/transports/HTML5RDP/html5rdp.py index cf2d31fe..f375867f 100644 --- a/server/src/uds/transports/HTML5RDP/html5rdp.py +++ b/server/src/uds/transports/HTML5RDP/html5rdp.py @@ -36,7 +36,7 @@ import logging import typing from uds.models.util import getSqlDatetime -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.ui import gui diff --git a/server/src/uds/transports/HTML5VNC/html5vnc.py b/server/src/uds/transports/HTML5VNC/html5vnc.py index d8901776..307c45bd 100644 --- a/server/src/uds/transports/HTML5VNC/html5vnc.py +++ b/server/src/uds/transports/HTML5VNC/html5vnc.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from django.urls import reverse from django.http import HttpResponseRedirect diff --git a/server/src/uds/transports/RDP/__init__.py b/server/src/uds/transports/RDP/__init__.py index ac477f1c..71d70702 100644 --- a/server/src/uds/transports/RDP/__init__.py +++ b/server/src/uds/transports/RDP/__init__.py @@ -31,7 +31,7 @@ @author: Adolfo Gómez, dkmaster at dkmon dot com """ -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.managers.user_preferences import UserPrefsManager, CommonPrefs from .rdp import RDPTransport from .rdptunnel import TRDPTransport diff --git a/server/src/uds/transports/RDP/rdp.py b/server/src/uds/transports/RDP/rdp.py index 33630df5..bdee3853 100644 --- a/server/src/uds/transports/RDP/rdp.py +++ b/server/src/uds/transports/RDP/rdp.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.util import os_detector as OsDetector from .rdp_base import BaseRDPTransport from .rdp_file import RDPFile diff --git a/server/src/uds/transports/RDP/rdp_base.py b/server/src/uds/transports/RDP/rdp_base.py index 9775e2b2..185ee653 100644 --- a/server/src/uds/transports/RDP/rdp_base.py +++ b/server/src/uds/transports/RDP/rdp_base.py @@ -34,7 +34,7 @@ import os import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.ui import gui from uds.core import transports from uds.models import UserService diff --git a/server/src/uds/transports/RDP/rdptunnel.py b/server/src/uds/transports/RDP/rdptunnel.py index b463861f..e4910bc6 100644 --- a/server/src/uds/transports/RDP/rdptunnel.py +++ b/server/src/uds/transports/RDP/rdptunnel.py @@ -32,7 +32,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.ui import gui from uds.core import transports from uds.models import TicketStore diff --git a/server/src/uds/transports/SPICE/spice.py b/server/src/uds/transports/SPICE/spice.py index 0b15dc73..3234e7ad 100644 --- a/server/src/uds/transports/SPICE/spice.py +++ b/server/src/uds/transports/SPICE/spice.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.util import os_detector as OsDetector from .spice_base import BaseSpiceTransport from .remote_viewer_file import RemoteViewerFile diff --git a/server/src/uds/transports/SPICE/spice_base.py b/server/src/uds/transports/SPICE/spice_base.py index 005ff65c..054a73fa 100644 --- a/server/src/uds/transports/SPICE/spice_base.py +++ b/server/src/uds/transports/SPICE/spice_base.py @@ -34,7 +34,7 @@ import os import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.ui import gui from uds.core import transports from uds.core.transports import protocols diff --git a/server/src/uds/transports/SPICE/spice_tunnel.py b/server/src/uds/transports/SPICE/spice_tunnel.py index c1d316e7..498624ee 100644 --- a/server/src/uds/transports/SPICE/spice_tunnel.py +++ b/server/src/uds/transports/SPICE/spice_tunnel.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.ui import gui from uds.core import transports from uds.core.util import os_detector as OsDetector diff --git a/server/src/uds/transports/URL/url_custom.py b/server/src/uds/transports/URL/url_custom.py index f75e1807..6df71a07 100644 --- a/server/src/uds/transports/URL/url_custom.py +++ b/server/src/uds/transports/URL/url_custom.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from django.urls import reverse from django.http import HttpResponseRedirect diff --git a/server/src/uds/transports/X2GO/__init__.py b/server/src/uds/transports/X2GO/__init__.py index a253d6f9..f5d55afd 100644 --- a/server/src/uds/transports/X2GO/__init__.py +++ b/server/src/uds/transports/X2GO/__init__.py @@ -31,7 +31,7 @@ @author: Adolfo Gómez, dkmaster at dkmon dot com """ -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.managers.user_preferences import UserPrefsManager, CommonPrefs from .x2go import X2GOTransport from .x2go_tunnel import TX2GOTransport diff --git a/server/src/uds/transports/X2GO/x2go.py b/server/src/uds/transports/X2GO/x2go.py index c9aedf1b..7a710f5d 100644 --- a/server/src/uds/transports/X2GO/x2go.py +++ b/server/src/uds/transports/X2GO/x2go.py @@ -33,7 +33,7 @@ import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.util import os_detector as OsDetector from .x2go_base import BaseX2GOTransport from . import x2go_file diff --git a/server/src/uds/transports/X2GO/x2go_base.py b/server/src/uds/transports/X2GO/x2go_base.py index 0f474d27..fff009bc 100644 --- a/server/src/uds/transports/X2GO/x2go_base.py +++ b/server/src/uds/transports/X2GO/x2go_base.py @@ -37,7 +37,7 @@ import typing import paramiko -from django.utils.translation import ugettext_noop as _, ugettext_lazy +from django.utils.translation import gettext_noop as _, gettext_lazy from uds.core.managers import userServiceManager from uds.core.managers.user_preferences import CommonPrefs from uds.core.ui import gui @@ -83,7 +83,7 @@ class BaseX2GOTransport(transports.Transport): {'id': CommonPrefs.SZ_1024x768, 'text': '1024x768'}, {'id': CommonPrefs.SZ_1366x768, 'text': '1366x768'}, {'id': CommonPrefs.SZ_1920x1080, 'text': '1920x1080'}, - {'id': CommonPrefs.SZ_FULLSCREEN, 'text': ugettext_lazy('Full Screen')}, + {'id': CommonPrefs.SZ_FULLSCREEN, 'text': gettext_lazy('Full Screen')}, ], tab=gui.PARAMETERS_TAB, ) diff --git a/server/src/uds/transports/X2GO/x2go_tunnel.py b/server/src/uds/transports/X2GO/x2go_tunnel.py index f1adea33..27df9ab5 100644 --- a/server/src/uds/transports/X2GO/x2go_tunnel.py +++ b/server/src/uds/transports/X2GO/x2go_tunnel.py @@ -34,7 +34,7 @@ import string import logging import typing -from django.utils.translation import ugettext_noop as _ +from django.utils.translation import gettext_noop as _ from uds.core.ui import gui from uds.core.managers.user_preferences import CommonPrefs from uds.core.util import os_detector as OsDetector diff --git a/server/src/uds/urls.py b/server/src/uds/urls.py index 8d5c5022..982bdc00 100644 --- a/server/src/uds/urls.py +++ b/server/src/uds/urls.py @@ -37,8 +37,11 @@ from django.views.generic.base import RedirectView from uds import REST import uds.web.views +import uds.admin.views + from uds.core.util.modfinder import loadModulesUrls + urlpatterns = [ # Root url placeholder path( @@ -202,7 +205,7 @@ urlpatterns = [ # REST API re_path(r'^uds/rest/(?P.*)$', REST.Dispatcher.as_view(), name="REST"), # Web admin GUI - re_path(r'^uds/adm', include('uds.admin.urls')), + re_path(r'^uds/adm/.*$', uds.admin.views.index, name='uds.admin.views.index'), ] # Append urls from special dispatchers diff --git a/server/src/uds/web/forms/LoginForm.py b/server/src/uds/web/forms/LoginForm.py index b2d0e50e..04c22f3d 100644 --- a/server/src/uds/web/forms/LoginForm.py +++ b/server/src/uds/web/forms/LoginForm.py @@ -31,7 +31,7 @@ """ import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django import forms from uds.models import Authenticator diff --git a/server/src/uds/web/util/authentication.py b/server/src/uds/web/util/authentication.py index 9da99b8b..dd152186 100644 --- a/server/src/uds/web/util/authentication.py +++ b/server/src/uds/web/util/authentication.py @@ -31,7 +31,7 @@ import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from uds.core.auths.auth import authenticate, authLogLogin from uds.models import Authenticator diff --git a/server/src/uds/web/util/errors.py b/server/src/uds/web/util/errors.py index 7a53b6e5..d9386ef3 100644 --- a/server/src/uds/web/util/errors.py +++ b/server/src/uds/web/util/errors.py @@ -34,7 +34,7 @@ import codecs import logging import typing -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.shortcuts import render from django.http import HttpResponseRedirect diff --git a/server/src/uds/web/util/services.py b/server/src/uds/web/util/services.py index b0bdd516..493738f3 100644 --- a/server/src/uds/web/util/services.py +++ b/server/src/uds/web/util/services.py @@ -31,7 +31,7 @@ import logging import typing -from django.utils.translation import ugettext +from django.utils.translation import gettext from django.utils import formats from django.urls import reverse @@ -316,7 +316,7 @@ def getServicesData( # tbr = False if toBeReplaced: toBeReplaced = formats.date_format(toBeReplaced, 'SHORT_DATETIME_FORMAT') - toBeReplacedTxt = ugettext( + toBeReplacedTxt = gettext( 'This service is about to be replaced by a new version. Please, close the session before {} and save all your work to avoid loosing it.' ).format(toBeReplaced) else: @@ -392,7 +392,7 @@ def enableService( # Maybe we could even protect this even more by limiting referer to own server /? (just a meditation..) logger.debug('idService: %s, idTransport: %s', idService, idTransport) url = '' - error = ugettext('Service not ready. Please, try again in a while.') + error = gettext('Service not ready. Please, try again in a while.') # If meta service, process and rebuild idService & idTransport @@ -427,7 +427,7 @@ def enableService( logger.debug('Service not ready') # Not ready, show message and return to this page in a while # error += ' (code {0:04X})'.format(e.code) - error = ugettext( + error = gettext( 'Your service is being created, please, wait for a few seconds while we complete it.)' ) + '({}%)'.format(int(e.code * 25)) except MaxServicesReachedError: diff --git a/server/src/uds/web/views/auth.py b/server/src/uds/web/views/auth.py index 8fe78bd7..0e3a56d5 100644 --- a/server/src/uds/web/views/auth.py +++ b/server/src/uds/web/views/auth.py @@ -33,7 +33,7 @@ import typing from django.urls import reverse from django.http import HttpRequest, HttpResponse, HttpResponseRedirect -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.views.decorators.cache import never_cache from django.views.decorators.csrf import csrf_exempt diff --git a/server/src/uds/web/views/service.py b/server/src/uds/web/views/service.py index 282c10bd..71d3dd72 100644 --- a/server/src/uds/web/views/service.py +++ b/server/src/uds/web/views/service.py @@ -32,7 +32,7 @@ import json import logging import typing -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.urls import reverse from django.http import HttpResponse from django.views.decorators.cache import cache_page, never_cache