fix: guard hot_reload binding with None check
hasattr only checks attribute existence, but event_dispatcher can exist as None when running standalone (backend_accounting.py). Use getattr with None check instead.
This commit is contained in:
parent
ba69fb84d1
commit
5d4e008ec8
@ -33,8 +33,8 @@ def load_pricing():
|
||||
env.load_pricing_data = PricingProgram.load_pricing_data
|
||||
env.get_pricing_program = PricingProgram.get_pricing_program
|
||||
env.test_pricing = test_pricing
|
||||
# Bind hot_reload event — staticmethod, ref safe (stored on class)
|
||||
if hasattr(env, 'event_dispatcher'):
|
||||
# Bind hot_reload event — only when running in ahserver (event_dispatcher available)
|
||||
if getattr(env, 'event_dispatcher', None) is not None:
|
||||
env.event_dispatcher.bind('hot_reload', PricingProgram.on_hot_reload)
|
||||
dbpools = DBPools()
|
||||
dbname = env.get_module_dbname('pricing')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user