Exemplo n.º 1
0
 def _restoreMailHost(self):
   """Restore original Mail Host
   """
   cls = self.portal.MailHost.__class__
   if cls.__bases__[0] is DummyMailHostMixin:
     cls.__bases__ = cls.__bases__[1:]
     pmc_init_of(cls)
Exemplo n.º 2
0
 def _setUpDummyMailHost(self):
   """Replace Original Mail Host by Dummy Mail Host in a non-persistent way
   """
   cls = self.portal.MailHost.__class__
   if not issubclass(cls, DummyMailHostMixin):
     cls.__bases__ = (DummyMailHostMixin,) + cls.__bases__
     pmc_init_of(cls)
Exemplo n.º 3
0
    def resetAcquisition(cls):
        # First, fill the __get__ slot of the class
        # that has been null'ed after resetting its __bases__
        # This descriptor is the magic allowing __of__ and our
        # _aq_dynamic trick
        pmc_init_of(cls)

        # And we need to do the same thing on subclasses
        for subclass in PortalTypeMetaClass.getSubclassList(cls):
            pmc_init_of(subclass)
Exemplo n.º 4
0
  def resetAcquisition(cls):
    # First, fill the __get__ slot of the class
    # that has been null'ed after resetting its __bases__
    # This descriptor is the magic allowing __of__ and our
    # _aq_dynamic trick
    pmc_init_of(cls)

    # And we need to do the same thing on subclasses
    for subclass in PortalTypeMetaClass.getSubclassList(cls):
      pmc_init_of(subclass)
Exemplo n.º 5
0
def setupDummyMailHost(self):
  """Replace Original Mail Host by Dummy Mail Host in a non-persistent way

  Copied & pasted from ERP5TypeTestCaseMixin._setUpDummyMailHost
  """
  cls = self.getPortalObject().portal.MailHost.__class__
  if not issubclass(cls, DummyMailHostMixin):
    cls.__bases__ = (DummyMailHostMixin,) + cls.__bases__
    pmc_init_of(cls)
  return True
def setupDummyMailHost(self):
    """Replace Original Mail Host by Dummy Mail Host in a non-persistent way

  Copied & pasted from ERP5TypeTestCaseMixin._setUpDummyMailHost
  """
    cls = self.getPortalObject().MailHost.__class__
    if not issubclass(cls, DummyMailHostMixin):
        cls.__bases__ = (DummyMailHostMixin, ) + cls.__bases__
        pmc_init_of(cls)
    return True
Exemplo n.º 7
0
def setupDummyMailHost(self):
  """Replace Original Mail Host by Dummy Mail Host in a non-persistent way
  and reset the list of already sent messages.

  Copied & pasted from ERP5TypeTestCaseMixin._setUpDummyMailHost
  """
  mailhost = self.getPortalObject().MailHost
  cls = mailhost.__class__
  if not issubclass(cls, DummyMailHostMixin):
    cls.__bases__ = (DummyMailHostMixin,) + cls.__bases__
    pmc_init_of(cls)
  mailhost.reset()
  return True