Commits

Alessandro Molina committed 6e7358d

Cleaver form import and depend on tagging with TW2 support

  • Participants
  • Parent commits bb7275e

Comments (0)

Files changed (2)

 install_requires=[
     "TurboGears2 >= 2.1.4",
     "tgext.pluggable >= 0.1.0",
-    "tgext.tagging",
+    "tgext.tagging >= 0.2.1",
     "tgext.datahelpers",
     "tgext.ajaxforms",
     "tgext.crud >= 0.4"

smallpress/lib/forms.py

     article_form = config.get('form_instance')
     if not article_form:
         form_path = config.get('form', 'smallpress.lib.forms.ArticleForm')
-        root_module, path = form_path.split('.', 1)
-        form_class = reduce(getattr, path.split('.'), sys.modules[root_module])
+        module, form_name = form_path.rsplit('.', 1)
+        module = __import__(module, fromlist=form_name)
+        form_class = getattr(module, form_name)
         article_form = config['form_instance'] = form_class()
 
     return article_form