diff --git a/tw2/forms/calendars.py b/tw2/forms/calendars.py index 35b22e5..36cce78 100644 --- a/tw2/forms/calendars.py +++ b/tw2/forms/calendars.py @@ -121,10 +121,12 @@ def strftime_before1900(dt, fmt): _calendar_lang_re = re.compile(r'^calendar-(\S+).js$') +# Use pkg_resources to support local files and zip packages (frozen) +from pkg_resources import resource_listdir calendar_langs = dict( (_calendar_lang_re.match(f).group(1), - twc.JSLink(modname=__name__, filename=os.path.join('static/calendar/lang', f))) - for f in os.listdir(os.path.join(os.path.dirname(__file__), 'static/calendar/lang')) + twc.JSLink(modname='tw2.forms', filename='static/calendar/lang/' + f)) + for f in resource_listdir('tw2.forms', 'static/calendar/lang') if f.startswith('calendar-') )