Author: deets
Date: Thu Jan 24 06:46:24 2008
New Revision: 4036
URL: http://trac.turbogears.org/changeset/4036

Log:
fixed the MK suppression

Modified:
   branches/1.0/CHANGELOG.txt
   branches/1.0/turbogears/tests/test_form_controllers.py
   branches/1.0/turbogears/widgets/base.py

Modified: branches/1.0/CHANGELOG.txt
==============================================================================
--- branches/1.0/CHANGELOG.txt  (original)
+++ branches/1.0/CHANGELOG.txt  Thu Jan 24 06:46:24 2008
@@ -106,6 +106,8 @@
 * Installation of TurboGears now does not require installation of an ORM.
   Instead, a project that relies on SQLObject or SQLAlchemy will have a
   ``setup.py`` file written with the proper requirements (#1501, #1620).
+* removed the hard SQLAlchemy/SQLObject dependecies and modified quickstart
+  to render the required ORM as requirement into a projects setup.py.
 
 Features
 ~~~~~~~~
@@ -152,6 +154,7 @@
 * toolbox loading will no more crash on a missing SQLObject import. (#1620).
 * Identity bug when using non-ASCII characters in the URL. (#1598, #1407,
 #1022)
+* fixed the behavior of tg.mochikit_suppress which wasn't actually working
 
 Project Updates
 ~~~~~~~~~~~~~~~

Modified: branches/1.0/turbogears/tests/test_form_controllers.py
==============================================================================
--- branches/1.0/turbogears/tests/test_form_controllers.py      (original)
+++ branches/1.0/turbogears/tests/test_form_controllers.py      Thu Jan 24 
06:46:24 2008
@@ -97,11 +97,16 @@
     root = cherrypy.root
     turbogears.config.update({"global":{"tg.mochikit_suppress" : True}})
     testutil.createRequest("/usemochi")
-    print cherrypy.response.body[0]
+    suppressed_body = cherrypy.response.body[0]
     # repair the fixture
     turbogears.config.update({"global":{"tg.mochikit_suppress" : False}})
-    assert "MochiKit.js" not in cherrypy.response.body[0]
 
+    testutil.createRequest("/usemochi")
+    included_body = cherrypy.response.body[0]
+
+    assert "MochiKit.js" not in suppressed_body
+    assert "MochiKit.js" in included_body
+    
 def test_mochikit_everywhere():
     "MochiKit can be included everywhere by setting tg.mochikit_all"
     root = cherrypy.root

Modified: branches/1.0/turbogears/widgets/base.py
==============================================================================
--- branches/1.0/turbogears/widgets/base.py     (original)
+++ branches/1.0/turbogears/widgets/base.py     Thu Jan 24 06:46:24 2008
@@ -573,13 +573,19 @@
 
     If 'turbogears.mochikit' is part of tg.include_widgets, a warning is 
issued.
     """
-    def retrieve_javascript(self):
-        if config.get('tg.mochikit_suppress', False):
-            if 'turbogears.mochikit' in config.get('tg.include_widgets', []):
-                warnings.warn("""tg.mochikit_suppress == True, but 
'turbogears.mochikit' is to be included via 'tg.mochikit_suppress'.
+
+    template = """
+    <script xmlns:py="http://purl.org/kid/ns#"; py:if="not suppress" 
type="text/javascript" src="$link"></script>
+    """
+
+    def update_params(self, p):
+        super(MochiKitLink, self).update_params(p)
+        suppress = config.get('tg.mochikit_suppress', False)
+        p['suppress'] = suppress
+
+        if suppress and 'turbogears.mochikit' in 
config.get('tg.include_widgets', []):
+            warnings.warn("""tg.mochikit_suppress == True, but 
'turbogears.mochikit' is to be included via 'tg.mochikit_suppress'.
 This is a contratiction, and mochikit_suppress overrides the inclusion to 
prevent subtle errors due to version mixing of MochkKit.""")
-            return set()
-        return super(MochiKitLink, self).retrieve_javascript()
 
 mochikit = MochiKitLink("turbogears", "js/MochiKit.js")
 

Reply via email to