[IMP] filesystem watcher only activated on --dev mode (for the moment)

This commit is contained in:
Fabien Meghazi
2014-08-11 17:12:47 +02:00
parent 7fd9d1ea4d
commit 574247a9c4
+4 -6
View File
@@ -125,10 +125,8 @@ class FSWatcher(object):
if isinstance(event, (FileCreatedEvent, FileModifiedEvent)):
if not event.is_directory:
path = event.src_path
if path.endswith('.xml'):
_logger.info('autoreload: xml change detected, voiding orm cache')
# TODO: void orm caches
elif config['dev_mode'] and path.endswith('.py'):
# TODO: assets bundle cache invalidation
if path.endswith('.py'):
try:
source = open(path, 'rb').read() + '\n'
compile(source, path, 'exec')
@@ -884,7 +882,7 @@ def start(preload=None, stop=False):
else:
server = ThreadedServer(openerp.service.wsgi_server.application)
if watchdog:
if watchdog and config['dev_mode']:
watcher = FSWatcher()
watcher.start()
else:
@@ -897,7 +895,7 @@ def start(preload=None, stop=False):
# like the legend of the phoenix, all ends with beginnings
if getattr(openerp, 'phoenix', False):
if watchdog:
if watchdog and config['dev_mode']:
watcher.stop()
_reexec()