# Path: ermesms/lib/singletonmixin.py
# class Singleton(object):
#     __metaclass__ = MetaSingleton
# 
#     def getInstance(cls, *lstArgs):
#         """
#         Call this to instantiate an instance or retrieve the existing instance.
#         If the singleton requires args to be instantiated, include them the first
#         time you call getInstance.
#         """
#         if cls._isInstantiated():
#             if len(lstArgs) != 0:
#                 raise SingletonException, 'If no supplied args, singleton must already be instantiated, or __init__ must require no args'
#         else:
#             if cls._getConstructionArgCountNotCountingSelf() > 0 and len(lstArgs) <= 0:
#                 raise SingletonException, 'If the singleton requires __init__ args, supply them on first instantiation'
#             instance = cls.__new__(cls)
#             instance.__init__(*lstArgs)
#             cls.cInstance = instance
#         return cls.cInstance
#     getInstance = classmethod(getInstance)
# 
#     def _isInstantiated(cls):
#         return hasattr(cls, 'cInstance')
#     _isInstantiated = classmethod(_isInstantiated)
# 
#     def _getConstructionArgCountNotCountingSelf(cls):
#         try:
#             return cls.__init__.im_func.func_code.co_argcount - 1
#         except AttributeError:
#             return 0
#     _getConstructionArgCountNotCountingSelf = classmethod(_getConstructionArgCountNotCountingSelf)
# 
#     def _forgetClassInstanceReferenceForTesting(cls):
#         """
#         This is designed for convenience in testing -- sometimes you
#         want to get rid of a singleton during test code to see what
#         happens when you call getInstance() under a new situation.
# 
#         To really delete the object, all external references to it
#         also need to be deleted.
#         """
#         try:
#             delattr(cls,'cInstance')
#         except AttributeError:
#             # run up the chain of base classes until we find the one that has the instance
#             # and then delete it there
#             for baseClass in cls.__bases__:
#                 if issubclass(baseClass, Singleton):
#                     baseClass._forgetClassInstanceReferenceForTesting()
#     _forgetClassInstanceReferenceForTesting = classmethod(_forgetClassInstanceReferenceForTesting)
# 
# Path: ermesms/errors/StopError.py
# class StopError(Exception):
#     """Indica l'interruzione di invio da parte dell'utente"""
# 
#     def __init__(self):
#         """Costruttore standard."""
#         Exception.__init__(self)
# 
#     def __str__(self):
#         return u"Invio interrotto per richiesta dell'utente"


import re
import time
import pycurl
from cStringIO import StringIO
from ermesms.lib.singletonmixin import Singleton
from ermesms.errors.StopError import StopError
# -*- coding: utf-8 -*-



class ConnectionManager(Singleton):
    """Ritorna e configura gli oggetti Curl.
    Questa classe vorrebbe essere un Facade su pycurl, anche se al momento
    non lo è completamente."""

    debug = None

# Path: ermesms/lib/singletonmixin.py
# class Singleton(object):
#     __metaclass__ = MetaSingleton
# 
#     def getInstance(cls, *lstArgs):
#         """
#         Call this to instantiate an instance or retrieve the existing instance.
#         If the singleton requires args to be instantiated, include them the first
#         time you call getInstance.
#         """
#         if cls._isInstantiated():
#             if len(lstArgs) != 0:
#                 raise SingletonException, 'If no supplied args, singleton must already be instantiated, or __init__ must require no args'
#         else:
#             if cls._getConstructionArgCountNotCountingSelf() > 0 and len(lstArgs) <= 0:
#                 raise SingletonException, 'If the singleton requires __init__ args, supply them on first instantiation'
#             instance = cls.__new__(cls)
#             instance.__init__(*lstArgs)
#             cls.cInstance = instance
#         return cls.cInstance
#     getInstance = classmethod(getInstance)
# 
#     def _isInstantiated(cls):
#         return hasattr(cls, 'cInstance')
#     _isInstantiated = classmethod(_isInstantiated)
# 
#     def _getConstructionArgCountNotCountingSelf(cls):
#         try:
#             return cls.__init__.im_func.func_code.co_argcount - 1
#         except AttributeError:
#             return 0
#     _getConstructionArgCountNotCountingSelf = classmethod(_getConstructionArgCountNotCountingSelf)
# 
#     def _forgetClassInstanceReferenceForTesting(cls):
#         """
#         This is designed for convenience in testing -- sometimes you
#         want to get rid of a singleton during test code to see what
#         happens when you call getInstance() under a new situation.
# 
#         To really delete the object, all external references to it
#         also need to be deleted.
#         """
#         try:
#             delattr(cls,'cInstance')
#         except AttributeError:
#             # run up the chain of base classes until we find the one that has the instance
#             # and then delete it there
#             for baseClass in cls.__bases__:
#                 if issubclass(baseClass, Singleton):
#                     baseClass._forgetClassInstanceReferenceForTesting()
#     _forgetClassInstanceReferenceForTesting = classmethod(_forgetClassInstanceReferenceForTesting)
# 
# Path: ermesms/errors/StopError.py
# class StopError(Exception):
#     """Indica l'interruzione di invio da parte dell'utente"""
# 
#     def __init__(self):
#         """Costruttore standard."""
#         Exception.__init__(self)
# 
#     def __str__(self):
#         return u"Invio interrotto per richiesta dell'utente"


# Path: ermesms/ConnectionManager.py
import re
import time
import pycurl
from cStringIO import StringIO
from ermesms.lib.singletonmixin import Singleton
from ermesms.errors.StopError import StopError

# -*- coding: utf-8 -*-



class ConnectionManager(Singleton):
    """Ritorna e configura gli oggetti Curl.
    Questa classe vorrebbe essere un Facade su pycurl, anche se al momento
    non lo è completamente."""

    debug = None

    debugDataOld = None