Fixing up for 2.0 release

This commit is contained in:
Adolfo Gómez García 2016-04-04 07:12:38 +02:00
parent 0b4b38abe7
commit c606b6f00e
4 changed files with 23 additions and 4 deletions

View File

@ -40,6 +40,7 @@ import socket
import stat import stat
import six import six
import sys import sys
import time
_unlinkFiles = [] _unlinkFiles = []
_tasksToWait = [] _tasksToWait = []
@ -94,6 +95,8 @@ def unlinkFiles():
''' '''
Removes all wait-and-unlink files Removes all wait-and-unlink files
''' '''
if len(_unlinkFiles) > 0:
time.sleep(5) # Wait 5 seconds before deleting anything
for f in _unlinkFiles: for f in _unlinkFiles:
try: try:
os.unlink(f) os.unlink(f)

View File

@ -33,7 +33,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
# from django.utils import simplejson as json # from django.utils import simplejson as json
import ujson as json #import ujson as json
import json
from xml_marshaller import xml_marshaller from xml_marshaller import xml_marshaller
import datetime import datetime
import time import time

View File

@ -46,7 +46,7 @@ import logging
logger = logging.getLogger(__name__) 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... # 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 plugins # To make sure plugins are loaded on memory
from . import REST # To make sure REST initializes all what it needs from . import REST # To make sure REST initializes all what it needs
plugins.appLoaded()
import uds.xmlrpc # To make actor live import uds.xmlrpc # To make actor live

View File

@ -33,18 +33,31 @@ import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
__plugins = []
def __init__(): def __init__():
''' '''
This imports all packages that are descendant of this package, and, after that, This imports all packages that are descendant of this package, and, after that,
it register all subclases of service provider as it register all subclases of service provider as
''' '''
global __plugins
import os.path, pkgutil import os.path, pkgutil
import sys import sys
logger.debug('Initializing plugins') logger.debug('Importing plugins')
# Dinamycally import children of this package. The __init__.py files must import classes # Dinamycally import children of this package. The __init__.py files must import classes
pkgpath = os.path.dirname(sys.modules[__name__].__file__) pkgpath = os.path.dirname(sys.modules[__name__].__file__)
for _, name, _ in pkgutil.iter_modules([pkgpath]): for _, name, _ in pkgutil.iter_modules([pkgpath]):
__import__(name, globals(), locals(), [], -1) __plugins.append(__import__(name, globals(), locals(), [], -1))
__init__() __init__()
def appLoaded():
global __plugins
for m in __plugins:
try:
m.appLoaded()
except Exception:
pass