Changeset 3577
- Timestamp:
- 10/28/07 10:54:14 (1 year ago)
- Files:
-
- branches/1.0/CHANGELOG.txt (modified) (1 diff)
- branches/1.0/turbogears/qstemplates/quickstart/+package+/config/app.cfg_tmpl (modified) (1 diff)
- branches/1.0/turbogears/tests/test_form_controllers.py (modified) (2 diffs)
- branches/1.0/turbogears/widgets/base.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0/CHANGELOG.txt
r3563 r3577 1 1 TurboGears Changelog 2 2 ==================== 3 4 1.0.4: 5 ---------------------------- 6 7 *Changes* 8 * Introduction of tg.mochikit_suppress to prevent the inclusion of 9 the shipped MochiKit 1.3.1. That allows to include custom mochikit versions. 10 11 *Features* 12 * Introduction of tg.mochikit_suppress to prevent the inclusion of 13 the shipped MochiKit 1.3.1. That allows to include custom mochikit versions. 3 14 4 15 1.0.4b2 (October, 27, 2007): branches/1.0/turbogears/qstemplates/quickstart/+package+/config/app.cfg_tmpl
r3287 r3577 28 28 # tg.allow_json = False 29 29 30 # Suppress the inclusion of the shipped MochiKit version, which is rather outdated. 31 # Attention: setting this to True and listing 'turbogears.mochikit' in 'tg.include_widgets' 32 # is a contradiction. This option will overrule the default-inclusion to prevent version 33 # mismatch bugs. 34 # tg.mochikit_suppress = True 35 30 36 # List of Widgets to include on every page. 31 # for ex emple ['turbogears.mochikit']37 # for example ['turbogears.mochikit'] 32 38 # tg.include_widgets = [] 33 39 branches/1.0/turbogears/tests/test_form_controllers.py
r3459 r3577 93 93 assert "MochiKit.js" in cherrypy.response.body[0] 94 94 95 def test_suppress_mochikit(): 96 "MochiKit inclusion can be suppressed" 97 root = cherrypy.root 98 turbogears.config.update({"global":{"tg.mochikit_suppress" : True}}) 99 testutil.createRequest("/usemochi") 100 print cherrypy.response.body[0] 101 # repair the fixture 102 turbogears.config.update({"global":{"tg.mochikit_suppress" : False}}) 103 assert "MochiKit.js" not in cherrypy.response.body[0] 104 95 105 def test_mochikit_everywhere(): 96 106 "MochiKit can be included everywhere by setting tg.mochikit_all" … … 101 111 print cherrypy.response.body[0] 102 112 assert "MochiKit.js" in cherrypy.response.body[0] 113 114 def test_mochikit_nowhere(): 115 "MochiKit can be included everywhere by setting tg.mochikit_all, but setting tg.mochikit_suppress will prevent that" 116 root = cherrypy.root 117 turbogears.config.update({"global":{"tg.mochikit_all" : True}}) 118 turbogears.config.update({"global":{"tg.mochikit_suppress" : True}}) 119 testutil.createRequest("/") 120 turbogears.config.update({"global":{"tg.mochikit_all" : False}}) 121 turbogears.config.update({"global":{"tg.mochikit_suppress" : False}}) 122 print cherrypy.response.body[0] 123 assert "MochiKit.js" not in cherrypy.response.body[0] 103 124 104 125 def test_include_widgets(): branches/1.0/turbogears/widgets/base.py
r3366 r3577 542 542 retrieve_javascript = set_with_self 543 543 544 mochikit = JSLink("turbogears", "js/MochiKit.js") 545 544 class MochiKitLink(JSLink): 545 """ 546 This is a specialized JSLink to allow for suppression of MochiKit-inclusion 547 by core TG. 548 549 The rationale for this is that MK it version 1.3.1 has some issues that are 550 remedied by MK 1.4, but the latter is unfortunately unrleased. 551 552 To remedy this, one can include MK 1.4 by oneself (using e.g. tgMochiKit) - but 553 this will conflict with the contained version which is made use of in several 554 TG widgets. 555 556 By setting the configuration option 557 558 tg.mochikit_suppress = True 559 560 the incusion of MK via built-in widgets will be suppressed. Of course then one 561 has to include the proper version explicitly, or via tg.include_widgets. 562 563 If 'turbogears.mochikit' is part of tg.include_widgets, a warning is issued. 564 """ 565 def retrieve_javascript(self): 566 if config.get('tg.mochikit_suppress', False): 567 if 'turbogears.mochikit' in config.get('tg.include_widgets', []): 568 warnings.warn("""tg.mochikit_suppress == True, but 'turbogears.mochikit' is to be included via 'tg.mochikit_suppress'. 569 This is a contratiction, and mochikit_suppress overrides the inclusion to prevent subtle errors due to version mixing of MochkKit.""") 570 return set() 571 return super(MochiKitLink, self).retrieve_javascript() 572 573 mochikit = MochiKitLink("turbogears", "js/MochiKit.js") 546 574 547 575 class JSI18NWidget(Widget):