forked from shaba/openuds
Fixing up for 2.0 release
This commit is contained in:
parent
0b4b38abe7
commit
c606b6f00e
@ -40,6 +40,7 @@ import socket
|
||||
import stat
|
||||
import six
|
||||
import sys
|
||||
import time
|
||||
|
||||
_unlinkFiles = []
|
||||
_tasksToWait = []
|
||||
@ -94,6 +95,8 @@ def unlinkFiles():
|
||||
'''
|
||||
Removes all wait-and-unlink files
|
||||
'''
|
||||
if len(_unlinkFiles) > 0:
|
||||
time.sleep(5) # Wait 5 seconds before deleting anything
|
||||
for f in _unlinkFiles:
|
||||
try:
|
||||
os.unlink(f)
|
||||
|
@ -33,7 +33,8 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# from django.utils import simplejson as json
|
||||
import ujson as json
|
||||
#import ujson as json
|
||||
import json
|
||||
from xml_marshaller import xml_marshaller
|
||||
import datetime
|
||||
import time
|
||||
|
@ -46,7 +46,7 @@ import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
__updated__ = '2016-02-19'
|
||||
__updated__ = '2016-04-04'
|
||||
|
||||
|
||||
# Default ssl context is unverified, as MOST servers that we will connect will be with self signed certificates...
|
||||
@ -79,6 +79,8 @@ class UDSAppConfig(AppConfig):
|
||||
from . import plugins # To make sure plugins are loaded on memory
|
||||
from . import REST # To make sure REST initializes all what it needs
|
||||
|
||||
plugins.appLoaded()
|
||||
|
||||
import uds.xmlrpc # To make actor live
|
||||
|
||||
|
||||
|
@ -33,18 +33,31 @@ import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
__plugins = []
|
||||
|
||||
def __init__():
|
||||
'''
|
||||
This imports all packages that are descendant of this package, and, after that,
|
||||
it register all subclases of service provider as
|
||||
'''
|
||||
global __plugins
|
||||
import os.path, pkgutil
|
||||
import sys
|
||||
logger.debug('Initializing plugins')
|
||||
logger.debug('Importing plugins')
|
||||
|
||||
|
||||
# Dinamycally import children of this package. The __init__.py files must import classes
|
||||
pkgpath = os.path.dirname(sys.modules[__name__].__file__)
|
||||
for _, name, _ in pkgutil.iter_modules([pkgpath]):
|
||||
__import__(name, globals(), locals(), [], -1)
|
||||
__plugins.append(__import__(name, globals(), locals(), [], -1))
|
||||
|
||||
__init__()
|
||||
|
||||
def appLoaded():
|
||||
global __plugins
|
||||
for m in __plugins:
|
||||
try:
|
||||
m.appLoaded()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user