Exemplo n.º 1
0
 def get_data(self, pathname):
     global PATCHED
     PATCHED = True
     if os.path.split(pathname) == (self.filename, "component.xml"):
         from sauna.reload import reload_paths
         if reload_paths:
             # 1) Defer autoinclude of packages found under reload paths.
             autoinclude.defer_paths()
             # 2) Prevent Five from finding packages under reload paths.
             fiveconfigure.defer_install()
         # 3) Return dummy config to keep Zope happy.
         return "<component></component>"
     return super(MonkeyPatchingLoader, self).get_data(self, pathname)
def warm_up_the_sauna():
    """
    Configure in sauna.reload auto-reloading of SRC modules.
    """

    print "Configuring module auto-reload"

    # XXX: Do not assume getcwd() is buildout root, but get in from some opts

    from sauna.reload.reloadpaths import ReloadPaths
    sauna.reload.reload_paths = ReloadPaths([os.path.join(os.getcwd(), "src")])

    from sauna.reload import autoinclude, fiveconfigure
    from sauna.reload import reload_paths
    from sauna.reload import monkeypatcher

    monkeypatcher.PATCHED = True

    if reload_paths:
        # 1) Defer autoinclude of packages found under reload paths.
        autoinclude.defer_paths()
        # 2) Prevent Five from finding packages under reload paths.
        fiveconfigure.defer_install()