2009/4/22 nicdumz@svn.wikimedia.org:
@@ -4145,6 +4145,14 @@ # search for family module in the 'families' subdirectory sys.path.append(config.datafilepath('families')) exec "import %s_family as myfamily" % fam
- except SyntaxError:
- if '-' in fam:
- # A python module cannot include an hyphen
- output(u"""\
+A family name cannot include an hyphen (-). Please consider renaming your +'%s' family to '%s' or '%s' instead."""
- % (fam, fam.replace('-', ''), fam.replace('-', '_')))
- sys.exit(1)
except ImportError: if fatal: output(u"""\
On the other hand using the builtin __import__ would allow us to load families with hyphens:
try: # search for family module in the 'families' subdirectory sys.path.append(config.datafilepath('families')) - exec "import %s_family as myfamily" % fam + myfamily = __import__('%s_family' % fam) except SyntaxError: if '-' in fam: # A python module cannot include an hyphen output(u"""\
__import__ is also cleaner than exec, obviously.
Should we allow family names with hyphens?