mirror of
https://github.com/dkmstr/openuds.git
synced 2025-02-25 01:58:29 +03:00
refactoring to camel_case, some fixes
This commit is contained in:
parent
914d541748
commit
4a1a1c3e43
@ -142,7 +142,7 @@ class Users(DetailHandler):
|
|||||||
res['staff_member'] and (res['is_admin'] and _('Admin') or _('Staff member')) or _('User')
|
res['staff_member'] and (res['is_admin'] and _('Admin') or _('Staff member')) or _('User')
|
||||||
)
|
)
|
||||||
usr = aUser(u)
|
usr = aUser(u)
|
||||||
res['groups'] = [g.dbGroup().uuid for g in usr.groups()]
|
res['groups'] = [g.db_group().uuid for g in usr.groups()]
|
||||||
logger.debug('Item: %s', res)
|
logger.debug('Item: %s', res)
|
||||||
return res
|
return res
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -230,7 +230,7 @@ class Users(DetailHandler):
|
|||||||
) # this throws an exception if there is an error (for example, this auth can't create users)
|
) # this throws an exception if there is an error (for example, this auth can't create users)
|
||||||
user = parent.users.create(**fields)
|
user = parent.users.create(**fields)
|
||||||
else:
|
else:
|
||||||
auth.modift_user(fields) # Notifies authenticator
|
auth.modify_user(fields) # Notifies authenticator
|
||||||
user = parent.users.get(uuid=processUuid(item))
|
user = parent.users.get(uuid=processUuid(item))
|
||||||
user.__dict__.update(fields)
|
user.__dict__.update(fields)
|
||||||
user.save()
|
user.save()
|
||||||
|
@ -542,7 +542,7 @@ class RegexLdap(auths.Authenticator):
|
|||||||
return username
|
return username
|
||||||
return self.__getUserRealName(res)
|
return self.__getUserRealName(res)
|
||||||
|
|
||||||
def modift_user(self, usrData: dict[str, str]) -> None:
|
def modify_user(self, usrData: dict[str, str]) -> None:
|
||||||
"""
|
"""
|
||||||
We must override this method in authenticators not based on external sources (i.e. database users, text file users, etc..)
|
We must override this method in authenticators not based on external sources (i.e. database users, text file users, etc..)
|
||||||
Modify user has no reason on external sources, so it will never be used (probably)
|
Modify user has no reason on external sources, so it will never be used (probably)
|
||||||
|
@ -314,7 +314,7 @@ class SampleAuth(auths.Authenticator):
|
|||||||
usrData['real_name'] = usrData['name'] + ' ' + usrData['name']
|
usrData['real_name'] = usrData['name'] + ' ' + usrData['name']
|
||||||
usrData['state'] = State.INACTIVE
|
usrData['state'] = State.INACTIVE
|
||||||
|
|
||||||
def modift_user(self, usrData: dict[str, str]) -> None:
|
def modify_user(self, usrData: dict[str, str]) -> None:
|
||||||
"""
|
"""
|
||||||
This method provides a "check opportunity" to authenticator for users modified
|
This method provides a "check opportunity" to authenticator for users modified
|
||||||
at administration interface.
|
at administration interface.
|
||||||
|
@ -492,7 +492,7 @@ class SimpleLDAPAuthenticator(auths.Authenticator):
|
|||||||
return username
|
return username
|
||||||
return self.__getUserRealName(res)
|
return self.__getUserRealName(res)
|
||||||
|
|
||||||
def modift_user(self, usrData: dict[str, str]) -> None:
|
def modify_user(self, usrData: dict[str, str]) -> None:
|
||||||
'''
|
'''
|
||||||
We must override this method in authenticators not based on external sources (i.e. database users, text file users, etc..)
|
We must override this method in authenticators not based on external sources (i.e. database users, text file users, etc..)
|
||||||
Modify user has no reason on external sources, so it will never be used (probably)
|
Modify user has no reason on external sources, so it will never be used (probably)
|
||||||
|
@ -228,7 +228,7 @@ class Authenticator(Module):
|
|||||||
groupsManager = GroupsManager(self.db_obj())
|
groupsManager = GroupsManager(self.db_obj())
|
||||||
self.get_groups(user.name, groupsManager)
|
self.get_groups(user.name, groupsManager)
|
||||||
# cast for typechecking. user.groups is a "simmmilar to a QuerySet", but it's not a QuerySet, so "set" is not there
|
# cast for typechecking. user.groups is a "simmmilar to a QuerySet", but it's not a QuerySet, so "set" is not there
|
||||||
typing.cast(typing.Any, user.groups).set([g.dbGroup() for g in groupsManager.getValidGroups()])
|
typing.cast(typing.Any, user.groups).set([g.db_group() for g in groupsManager.getValidGroups()])
|
||||||
|
|
||||||
def callback_url(self) -> str:
|
def callback_url(self) -> str:
|
||||||
"""
|
"""
|
||||||
@ -622,7 +622,7 @@ class Authenticator(Module):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def modift_user(self, usrData: dict[str, str]) -> None:
|
def modify_user(self, usrData: dict[str, str]) -> None:
|
||||||
"""
|
"""
|
||||||
This method is used when modifying an user to allow the authenticator:
|
This method is used when modifying an user to allow the authenticator:
|
||||||
|
|
||||||
|
@ -50,13 +50,14 @@ class Group:
|
|||||||
|
|
||||||
It's only constructor expect a database group as parameter.
|
It's only constructor expect a database group as parameter.
|
||||||
"""
|
"""
|
||||||
|
_db_group: 'DBGroup'
|
||||||
|
|
||||||
def __init__(self, dbGroup: 'DBGroup'):
|
def __init__(self, db_group: 'DBGroup'):
|
||||||
"""
|
"""
|
||||||
Initializes internal data
|
Initializes internal data
|
||||||
"""
|
"""
|
||||||
self._manager = dbGroup.getManager()
|
self._manager = db_group.getManager()
|
||||||
self._dbGroup = dbGroup
|
self._db_group = db_group
|
||||||
|
|
||||||
def manager(self) -> 'AuthenticatorInstance':
|
def manager(self) -> 'AuthenticatorInstance':
|
||||||
"""
|
"""
|
||||||
@ -64,8 +65,8 @@ class Group:
|
|||||||
"""
|
"""
|
||||||
return self._manager
|
return self._manager
|
||||||
|
|
||||||
def dbGroup(self) -> 'DBGroup':
|
def db_group(self) -> 'DBGroup':
|
||||||
"""
|
"""
|
||||||
Returns the database group associated with this
|
Returns the database group associated with this
|
||||||
"""
|
"""
|
||||||
return self._dbGroup
|
return self._db_group
|
||||||
|
@ -131,7 +131,7 @@ class GroupsManager:
|
|||||||
as where inserted inside Database (most probably using administration interface)
|
as where inserted inside Database (most probably using administration interface)
|
||||||
"""
|
"""
|
||||||
for g in self._groups:
|
for g in self._groups:
|
||||||
yield g.group.dbGroup().name
|
yield g.group.db_group().name
|
||||||
|
|
||||||
def getValidGroups(self) -> typing.Generator['Group', None, None]:
|
def getValidGroups(self) -> typing.Generator['Group', None, None]:
|
||||||
"""
|
"""
|
||||||
@ -143,7 +143,7 @@ class GroupsManager:
|
|||||||
valid_id_list: list[int] = []
|
valid_id_list: list[int] = []
|
||||||
for group in self._groups:
|
for group in self._groups:
|
||||||
if group.is_valid:
|
if group.is_valid:
|
||||||
valid_id_list.append(group.group.dbGroup().id)
|
valid_id_list.append(group.group.db_group().id)
|
||||||
yield group.group
|
yield group.group
|
||||||
|
|
||||||
# Now, get metagroups and also return them
|
# Now, get metagroups and also return them
|
||||||
|
@ -54,25 +54,25 @@ class User:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
_manager: 'AuthenticatorInstance'
|
_manager: 'AuthenticatorInstance'
|
||||||
_grpsManager: typing.Optional['GroupsManager']
|
grps_manager: typing.Optional['GroupsManager']
|
||||||
_dbUser: 'DBUser'
|
_db_user: 'DBUser'
|
||||||
_groups: typing.Optional[list[Group]]
|
_groups: typing.Optional[list[Group]]
|
||||||
|
|
||||||
def __init__(self, dbUser):
|
def __init__(self, db_user: 'DBUser') -> None:
|
||||||
self._manager = dbUser.getManager()
|
self._manager = db_user.getManager()
|
||||||
self._grpsManager = None
|
self.grps_manager = None
|
||||||
self._dbUser = dbUser
|
self._db_user = db_user
|
||||||
self._groups = None
|
self._groups = None
|
||||||
|
|
||||||
def _groupsManager(self) -> 'GroupsManager':
|
def _groups_manager(self) -> 'GroupsManager':
|
||||||
"""
|
"""
|
||||||
If the groups manager for this user already exists, it returns this.
|
If the groups manager for this user already exists, it returns this.
|
||||||
If it does not exists, it creates one default from authenticator and
|
If it does not exists, it creates one default from authenticator and
|
||||||
returns it.
|
returns it.
|
||||||
"""
|
"""
|
||||||
if self._grpsManager is None:
|
if self.grps_manager is None:
|
||||||
self._grpsManager = GroupsManager(self._manager.db_obj())
|
self.grps_manager = GroupsManager(self._manager.db_obj())
|
||||||
return self._grpsManager
|
return self.grps_manager
|
||||||
|
|
||||||
def groups(self) -> list[Group]:
|
def groups(self) -> list[Group]:
|
||||||
"""
|
"""
|
||||||
@ -88,15 +88,15 @@ class User:
|
|||||||
|
|
||||||
if self._groups is None:
|
if self._groups is None:
|
||||||
if self._manager.isExternalSource:
|
if self._manager.isExternalSource:
|
||||||
self._manager.get_groups(self._dbUser.name, self._groupsManager())
|
self._manager.get_groups(self._db_user.name, self._groups_manager())
|
||||||
self._groups = list(self._groupsManager().getValidGroups())
|
self._groups = list(self._groups_manager().getValidGroups())
|
||||||
logger.debug(self._groups)
|
logger.debug(self._groups)
|
||||||
# This is just for updating "cached" data of this user, we only get real groups at login and at modify user operation
|
# This is just for updating "cached" data of this user, we only get real groups at login and at modify user operation
|
||||||
usr = DBUser.objects.get(pk=self._dbUser.id) # @UndefinedVariable
|
usr = DBUser.objects.get(pk=self._db_user.id) # @UndefinedVariable
|
||||||
usr.groups.set((g.dbGroup().id for g in self._groups if g.dbGroup().is_meta is False)) # type: ignore
|
usr.groups.set((g.db_group().id for g in self._groups if g.db_group().is_meta is False)) # type: ignore
|
||||||
else:
|
else:
|
||||||
# From db
|
# From db
|
||||||
usr = DBUser.objects.get(pk=self._dbUser.id) # @UndefinedVariable
|
usr = DBUser.objects.get(pk=self._db_user.id) # @UndefinedVariable
|
||||||
self._groups = [Group(g) for g in usr.getGroups()]
|
self._groups = [Group(g) for g in usr.getGroups()]
|
||||||
return self._groups
|
return self._groups
|
||||||
|
|
||||||
@ -106,8 +106,8 @@ class User:
|
|||||||
"""
|
"""
|
||||||
return self._manager
|
return self._manager
|
||||||
|
|
||||||
def dbUser(self) -> 'DBUser':
|
def db_user(self) -> 'DBUser':
|
||||||
"""
|
"""
|
||||||
Returns the database user
|
Returns the database user
|
||||||
"""
|
"""
|
||||||
return self._dbUser
|
return self._db_user
|
||||||
|
@ -53,9 +53,9 @@ MOBILE_OS_LIST: typing.Final[tuple[types.os.KnownOS, ...]] = tuple(set(ALL_OS_LI
|
|||||||
DEFAULT_OS: typing.Final[types.os.KnownOS] = types.os.KnownOS.WINDOWS
|
DEFAULT_OS: typing.Final[types.os.KnownOS] = types.os.KnownOS.WINDOWS
|
||||||
|
|
||||||
|
|
||||||
knownBrowsers: typing.Final[tuple[types.os.KnownBrowser, ...]] = tuple(types.os.KnownBrowser)
|
known_browsers: typing.Final[tuple[types.os.KnownBrowser, ...]] = tuple(types.os.KnownBrowser)
|
||||||
|
|
||||||
browsersREs: dict[types.os.KnownBrowser, tuple] = {
|
browsers_re: dict[types.os.KnownBrowser, tuple] = {
|
||||||
types.os.KnownBrowser.FIREFOX: (re.compile(r'Firefox/([0-9.]+)'),),
|
types.os.KnownBrowser.FIREFOX: (re.compile(r'Firefox/([0-9.]+)'),),
|
||||||
types.os.KnownBrowser.SEAMONKEY: (re.compile(r'Seamonkey/([0-9.]+)'),),
|
types.os.KnownBrowser.SEAMONKEY: (re.compile(r'Seamonkey/([0-9.]+)'),),
|
||||||
types.os.KnownBrowser.CHROME: (re.compile(r'Chrome/([0-9.]+)'),),
|
types.os.KnownBrowser.CHROME: (re.compile(r'Chrome/([0-9.]+)'),),
|
||||||
@ -72,7 +72,7 @@ browsersREs: dict[types.os.KnownBrowser, tuple] = {
|
|||||||
types.os.KnownBrowser.EDGE: (re.compile(r'Edg/([0-9.]+)'),),
|
types.os.KnownBrowser.EDGE: (re.compile(r'Edg/([0-9.]+)'),),
|
||||||
}
|
}
|
||||||
|
|
||||||
browserRules: dict[types.os.KnownBrowser, tuple] = {
|
browser_rules: dict[types.os.KnownBrowser, tuple] = {
|
||||||
types.os.KnownBrowser.EDGE: (types.os.KnownBrowser.EDGE, ()),
|
types.os.KnownBrowser.EDGE: (types.os.KnownBrowser.EDGE, ()),
|
||||||
types.os.KnownBrowser.CHROME: (
|
types.os.KnownBrowser.CHROME: (
|
||||||
types.os.KnownBrowser.CHROME,
|
types.os.KnownBrowser.CHROME,
|
||||||
|
@ -74,7 +74,7 @@ class DelayedTask(Environmentable):
|
|||||||
"""
|
"""
|
||||||
from .delayed_task_runner import DelayedTaskRunner # pylint: disable=import-outside-toplevel
|
from .delayed_task_runner import DelayedTaskRunner # pylint: disable=import-outside-toplevel
|
||||||
|
|
||||||
if check and DelayedTaskRunner.runner().checkExists(tag):
|
if check and DelayedTaskRunner.runner().tag_exists(tag):
|
||||||
return
|
return
|
||||||
|
|
||||||
DelayedTaskRunner.runner().insert(self, suggestedTime, tag)
|
DelayedTaskRunner.runner().insert(self, suggestedTime, tag)
|
||||||
|
@ -57,17 +57,17 @@ class DelayedTaskThread(threading.Thread):
|
|||||||
Class responsible of executing a delayed task in its own thread
|
Class responsible of executing a delayed task in its own thread
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__slots__ = ('_taskInstance',)
|
__slots__ = ('_task_instance',)
|
||||||
|
|
||||||
_taskInstance: DelayedTask
|
_task_instance: DelayedTask
|
||||||
|
|
||||||
def __init__(self, taskInstance: DelayedTask) -> None:
|
def __init__(self, task_instance: DelayedTask) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._taskInstance = taskInstance
|
self._task_instance = task_instance
|
||||||
|
|
||||||
def run(self) -> None:
|
def run(self) -> None:
|
||||||
try:
|
try:
|
||||||
self._taskInstance.execute()
|
self._task_instance.execute()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception("Exception in thread %s: %s", e.__class__, e)
|
logger.exception("Exception in thread %s: %s", e.__class__, e)
|
||||||
finally:
|
finally:
|
||||||
@ -83,11 +83,11 @@ class DelayedTaskRunner(metaclass=singleton.Singleton):
|
|||||||
|
|
||||||
granularity: typing.ClassVar[int] = 2 # we check for delayed tasks every "granularity" seconds
|
granularity: typing.ClassVar[int] = 2 # we check for delayed tasks every "granularity" seconds
|
||||||
_hostname: typing.ClassVar[str] # "Our" hostname
|
_hostname: typing.ClassVar[str] # "Our" hostname
|
||||||
_keepRunning: typing.ClassVar[bool] # If we should keep it running
|
_keep_running: typing.ClassVar[bool] # If we should keep it running
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
DelayedTaskRunner._hostname = gethostname()
|
DelayedTaskRunner._hostname = gethostname()
|
||||||
DelayedTaskRunner._keepRunning = True
|
DelayedTaskRunner._keep_running = True
|
||||||
logger.debug("Initialized delayed task runner for host %s", DelayedTaskRunner._hostname)
|
logger.debug("Initialized delayed task runner for host %s", DelayedTaskRunner._hostname)
|
||||||
|
|
||||||
def notifyTermination(self) -> None:
|
def notifyTermination(self) -> None:
|
||||||
@ -95,7 +95,7 @@ class DelayedTaskRunner(metaclass=singleton.Singleton):
|
|||||||
Invoke this whenever you want to terminate the delayed task runner thread
|
Invoke this whenever you want to terminate the delayed task runner thread
|
||||||
It will mark the thread to "stop" ASAP
|
It will mark the thread to "stop" ASAP
|
||||||
"""
|
"""
|
||||||
DelayedTaskRunner._keepRunning = False
|
DelayedTaskRunner._keep_running = False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def runner() -> 'DelayedTaskRunner':
|
def runner() -> 'DelayedTaskRunner':
|
||||||
@ -106,7 +106,7 @@ class DelayedTaskRunner(metaclass=singleton.Singleton):
|
|||||||
"""
|
"""
|
||||||
return DelayedTaskRunner()
|
return DelayedTaskRunner()
|
||||||
|
|
||||||
def executeOneDelayedTask(self) -> None:
|
def execute_delayed_task(self) -> None:
|
||||||
now = getSqlDatetime()
|
now = getSqlDatetime()
|
||||||
filt = Q(execution_time__lt=now) | Q(insert_date__gt=now + timedelta(seconds=30))
|
filt = Q(execution_time__lt=now) | Q(insert_date__gt=now + timedelta(seconds=30))
|
||||||
# If next execution is before now or last execution is in the future (clock changed on this server, we take that task as executable)
|
# If next execution is before now or last execution is in the future (clock changed on this server, we take that task as executable)
|
||||||
@ -196,7 +196,7 @@ class DelayedTaskRunner(metaclass=singleton.Singleton):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception('Exception removing a delayed task %s: %s', e.__class__, e)
|
logger.exception('Exception removing a delayed task %s: %s', e.__class__, e)
|
||||||
|
|
||||||
def checkExists(self, tag: str) -> bool:
|
def tag_exists(self, tag: str) -> bool:
|
||||||
if not tag:
|
if not tag:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -210,10 +210,10 @@ class DelayedTaskRunner(metaclass=singleton.Singleton):
|
|||||||
|
|
||||||
def run(self) -> None:
|
def run(self) -> None:
|
||||||
logger.debug("At loop")
|
logger.debug("At loop")
|
||||||
while DelayedTaskRunner._keepRunning:
|
while DelayedTaskRunner._keep_running:
|
||||||
try:
|
try:
|
||||||
time.sleep(self.granularity)
|
time.sleep(self.granularity)
|
||||||
self.executeOneDelayedTask()
|
self.execute_delayed_task()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error('Unexpected exception at run loop %s: %s', e.__class__, e)
|
logger.error('Unexpected exception at run loop %s: %s', e.__class__, e)
|
||||||
try:
|
try:
|
||||||
|
@ -121,10 +121,12 @@ class Scheduler:
|
|||||||
|
|
||||||
# to keep singleton Scheduler
|
# to keep singleton Scheduler
|
||||||
_scheduler: typing.Optional['Scheduler'] = None
|
_scheduler: typing.Optional['Scheduler'] = None
|
||||||
|
_hostname: str
|
||||||
|
_keep_running: bool
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self._hostname = platform.node()
|
self._hostname = platform.node()
|
||||||
self._keepRunning = True
|
self._keep_running = True
|
||||||
logger.info('Initialized scheduler for host "%s"', self._hostname)
|
logger.info('Initialized scheduler for host "%s"', self._hostname)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -136,13 +138,13 @@ class Scheduler:
|
|||||||
Scheduler._scheduler = Scheduler()
|
Scheduler._scheduler = Scheduler()
|
||||||
return Scheduler._scheduler
|
return Scheduler._scheduler
|
||||||
|
|
||||||
def notifyTermination(self) -> None:
|
def notify_termination(self) -> None:
|
||||||
"""
|
"""
|
||||||
Invoked to signal that termination of scheduler task(s) is requested
|
Invoked to signal that termination of scheduler task(s) is requested
|
||||||
"""
|
"""
|
||||||
self._keepRunning = False
|
self._keep_running = False
|
||||||
|
|
||||||
def executeOneJob(self) -> None:
|
def execute_job(self) -> None:
|
||||||
"""
|
"""
|
||||||
Looks for the best waiting job and executes it
|
Looks for the best waiting job and executes it
|
||||||
"""
|
"""
|
||||||
@ -192,7 +194,7 @@ class Scheduler:
|
|||||||
) from e
|
) from e
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def releaseOwnShedules() -> None:
|
def release_own_shedules() -> None:
|
||||||
"""
|
"""
|
||||||
Releases all scheduleds being executed by this server
|
Releases all scheduleds being executed by this server
|
||||||
"""
|
"""
|
||||||
@ -222,10 +224,10 @@ class Scheduler:
|
|||||||
logger.debug('Run Scheduler thread')
|
logger.debug('Run Scheduler thread')
|
||||||
JobsFactory().ensureJobsInDatabase()
|
JobsFactory().ensureJobsInDatabase()
|
||||||
logger.debug("At loop")
|
logger.debug("At loop")
|
||||||
while self._keepRunning:
|
while self._keep_running:
|
||||||
try:
|
try:
|
||||||
time.sleep(self.granularity)
|
time.sleep(self.granularity)
|
||||||
self.executeOneJob()
|
self.execute_job()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# This can happen often on sqlite, and this is not problem at all as we recover it.
|
# This can happen often on sqlite, and this is not problem at all as we recover it.
|
||||||
# The log is removed so we do not get increased workers.log file size with no information at all
|
# The log is removed so we do not get increased workers.log file size with no information at all
|
||||||
@ -238,4 +240,4 @@ class Scheduler:
|
|||||||
except Exception:
|
except Exception:
|
||||||
logger.exception('Exception clossing connection at delayed task')
|
logger.exception('Exception clossing connection at delayed task')
|
||||||
logger.info('Exiting Scheduler because stop has been requested')
|
logger.info('Exiting Scheduler because stop has been requested')
|
||||||
self.releaseOwnShedules()
|
self.release_own_shedules()
|
||||||
|
@ -55,7 +55,7 @@ class SchedulerThread(BaseThread):
|
|||||||
Scheduler.scheduler().run()
|
Scheduler.scheduler().run()
|
||||||
|
|
||||||
def notifyTermination(self):
|
def notifyTermination(self):
|
||||||
Scheduler.scheduler().notifyTermination()
|
Scheduler.scheduler().notify_termination()
|
||||||
|
|
||||||
|
|
||||||
class DelayedTaskThread(BaseThread):
|
class DelayedTaskThread(BaseThread):
|
||||||
@ -120,7 +120,7 @@ class TaskManager(metaclass=singleton.Singleton):
|
|||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
# Releases owned schedules so anyone can access them...
|
# Releases owned schedules so anyone can access them...
|
||||||
Scheduler.releaseOwnShedules()
|
Scheduler.release_own_shedules()
|
||||||
|
|
||||||
self.registerScheduledTasks()
|
self.registerScheduledTasks()
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ class UserServiceOpChecker(DelayedTask):
|
|||||||
@param pi: Instance of Publication manager for the object
|
@param pi: Instance of Publication manager for the object
|
||||||
"""
|
"""
|
||||||
# Do not add task if already exists one that updates this service
|
# Do not add task if already exists one that updates this service
|
||||||
if DelayedTaskRunner.runner().checkExists(USERSERVICE_TAG + userService.uuid):
|
if DelayedTaskRunner.runner().tag_exists(USERSERVICE_TAG + userService.uuid):
|
||||||
return
|
return
|
||||||
DelayedTaskRunner.runner().insert(
|
DelayedTaskRunner.runner().insert(
|
||||||
UserServiceOpChecker(userService),
|
UserServiceOpChecker(userService),
|
||||||
|
@ -79,7 +79,7 @@ def detect_os(
|
|||||||
# Try to detect browser from Sec-Ch-Ua first
|
# Try to detect browser from Sec-Ch-Ua first
|
||||||
secChUa = headers.get('Sec-Ch-Ua')
|
secChUa = headers.get('Sec-Ch-Ua')
|
||||||
if secChUa is not None:
|
if secChUa is not None:
|
||||||
for browser in consts.os.knownBrowsers:
|
for browser in consts.os.known_browsers:
|
||||||
if browser in secChUa:
|
if browser in secChUa:
|
||||||
res.browser = browser
|
res.browser = browser
|
||||||
break
|
break
|
||||||
@ -88,16 +88,16 @@ def detect_os(
|
|||||||
match = None
|
match = None
|
||||||
|
|
||||||
ruleKey, ruleValue = None, None
|
ruleKey, ruleValue = None, None
|
||||||
for ruleKey, ruleValue in consts.os.browserRules.items():
|
for ruleKey, ruleValue in consts.os.browser_rules.items():
|
||||||
must, mustNot = ruleValue
|
must, mustNot = ruleValue
|
||||||
|
|
||||||
for mustRe in consts.os.browsersREs[must]:
|
for mustRe in consts.os.browsers_re[must]:
|
||||||
match = mustRe.search(ua)
|
match = mustRe.search(ua)
|
||||||
if match is None:
|
if match is None:
|
||||||
continue
|
continue
|
||||||
# Check against no maching rules
|
# Check against no maching rules
|
||||||
for mustNotREs in mustNot:
|
for mustNotREs in mustNot:
|
||||||
for cre in consts.os.browsersREs[mustNotREs]:
|
for cre in consts.os.browsers_re[mustNotREs]:
|
||||||
if cre.search(ua) is not None:
|
if cre.search(ua) is not None:
|
||||||
match = None
|
match = None
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user