From a08d34d8ab7e27e98a0a17bf94aaf54a0d3cd597 Mon Sep 17 00:00:00 2001 From: Logan Collins Date: Tue, 17 Jul 2018 15:14:28 -0500 Subject: [PATCH] Separate finding and loading jsx_props module --- bottlereact.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bottlereact.py b/bottlereact.py index 9eba761..1c5f197 100644 --- a/bottlereact.py +++ b/bottlereact.py @@ -25,7 +25,7 @@ from __future__ import print_function -import collections, ctypes, json, os, re, shutil, signal, socket, subprocess, tempfile, threading, time, urllib +import collections, ctypes, importlib, json, os, re, shutil, signal, socket, subprocess, tempfile, threading, time, urllib try: import bottle import react.jsx @@ -518,11 +518,9 @@ def __init__(self, name, fn): self.name = name self.fn = fn self.default_props = dict - try: + if importlib.util.find_sepc('jsx_props'): import jsx_props self.default_props = jsx_props.__dict__.get('init%s'%name, dict) - except ImportError: - pass def __call__(self, props=None, children=None): ''' props must be a dict or None