Beispiel #1
0
 def test_reload_code_change(self):
     from plone.reload.code import reload_code
     from plone.reload.code import MOD_TIMES
     our_package = os.path.abspath(
         os.path.join(TESTS, os.pardir, '__init__.pyc'))
     our_entry = MOD_TIMES[our_package]
     try:
         MOD_TIMES[our_package] = (our_entry[0] - 10, our_entry[1])
         self.assertEqual(len(reload_code()), 1)
     finally:
         MOD_TIMES[our_package] = our_entry
Beispiel #2
0
 def test_reload_code_change(self):
     from plone.reload.code import reload_code
     from plone.reload.code import MOD_TIMES
     our_package = os.path.abspath(
         os.path.join(TESTS, os.pardir, '__init__.pyc'))
     our_entry = MOD_TIMES[our_package]
     try:
         MOD_TIMES[our_package] = (our_entry[0] - 10, our_entry[1])
         self.assertEqual(len(reload_code()), 1)
     finally:
         MOD_TIMES[our_package] = our_entry
Beispiel #3
0
 def test_reload_code_change(self):
     from plone.reload.code import reload_code
     from plone.reload.code import get_mod_times
     our_package = os.path.abspath(
         os.path.join(TESTS, os.pardir, '__init__.py'))
     times = get_mod_times()
     our_entry = times[our_package]
     try:
         times[our_package] = (our_entry[0] - 10, our_entry[1])
         self.assertEqual(len(reload_code()), 1)
     finally:
         times[our_package] = our_entry
Beispiel #4
0
    def code_reload(self):
        if not self.available():
            return

        reloaded = reload_code()

        result = ''
        if reloaded:
            result += 'Code reloaded:\n\n'
            result += '\n'.join(reloaded)
        else:
            result = 'No code reloaded!'
        return result
Beispiel #5
0
    def code_reload(self):
        if not self.available():
            return

        reloaded = reload_code()

        result = ''
        if reloaded:
            result += 'Code reloaded:\n\n'
            result += '\n'.join(reloaded)
        else:
            result = 'No code reloaded!'
        return result
Beispiel #6
0
    def zcml_reload(self):
        if not self.available():
            return

        # We always do an implicit code reload so we can register all newly
        # added classes.
        reloaded = reload_code()
        reload_zcml()

        # TODO Minimize all caches, we only really want to invalidate the
        # local site manager from all caches
        self.context._p_jar.db().cacheMinimize()
        result = ''
        if reloaded:
            result += 'Code reloaded:\n\n'
            result += '\n'.join(reloaded)
        else:
            result = 'No code reloaded!'
        result += '\n\nGlobal ZCML reloaded.'
        return result
Beispiel #7
0
    def zcml_reload(self):
        if not self.available():
            return

        # We always do an implicit code reload so we can register all newly
        # added classes.
        reloaded = reload_code()
        reload_zcml()

        # TODO Minimize all caches, we only really want to invalidate the
        # local site manager from all caches
        self.context._p_jar.db().cacheMinimize()
        result = ''
        if reloaded:
            result += 'Code reloaded:\n\n'
            result += '\n'.join(reloaded)
        else:
            result = 'No code reloaded!'
        result += '\n\nGlobal ZCML reloaded.'
        return result
Beispiel #8
0
 def test_reload_code(self):
     from plone.reload.code import reload_code
     self.assertEqual(len(reload_code()), 0)
Beispiel #9
0
 def test_reload_code(self):
     from plone.reload.code import reload_code
     self.assertEqual(len(reload_code()), 0)