Migrating to Django 4.0 (fixes)

This commit is contained in:
Adolfo Gómez García 2021-12-10 13:41:10 +01:00
parent 9ac2aaef81
commit b3a8ae8abe
129 changed files with 346 additions and 383 deletions

View File

@ -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 (

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
},

View File

@ -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,

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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]]:

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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,
}

View File

@ -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(

View File

@ -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

View File

@ -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',

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'),
]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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')

View File

@ -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

View File

@ -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

View File

@ -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(

View File

@ -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.")

View File

@ -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

View File

@ -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):

View File

@ -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'

View File

@ -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'

View File

@ -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')

View File

@ -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.

View File

@ -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

View File

@ -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[

View File

@ -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__)

View File

@ -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

View File

@ -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()}

View File

@ -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

View File

@ -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')
)

View File

@ -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<token>[^/]+)/(?P<tunnelId>.+)$',
guacamole,
name='dispatcher.guacamole',

View File

@ -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<msg>[a-z]+)/(?P<token>[a-zA-Z0-9-_]+)/(?P<uuid>[a-zA-Z0-9-_]+)$',
views.opengnsys,
name='dispatcher.opengnsys',

View File

@ -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__)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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',

View File

@ -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

View File

@ -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

View File

@ -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',

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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])

View File

@ -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'),
)

View File

@ -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

View File

@ -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'),
]
)

View File

@ -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'),
]
)

View File

@ -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()

View File

@ -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,

View File

@ -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

View File

@ -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'),
]
)

View File

@ -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']])

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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__)

View File

@ -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

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More