Show
Ignore:
Timestamp:
05/23/08 16:33:49 (22 months ago)
Author:
JensDiemer
Message:

new page_msg system. Use a middleware to make page_msg lazy: ticket:193

  • update settings_example.py (insert new middleware)
  • change """contextpage_msg?""" to """request.page_msg"""
  • add a simple page_msg unittest (Need more tests!)
  • update _install data (Templates and index page)
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid/PyLucid/system/plugin_manager.py

    r1565 r1585  
    5353            plugin_name, method_name, msg 
    5454        ) 
    55         context["page_msg"](msg) 
     55        request.page_msg(msg) 
    5656        msg2 = '<i title="(Error details in page messages.)">["%s.%s" error.]</i>' % ( 
    5757            plugin_name, method_name 
     
    5959        local_response.write(msg2) 
    6060 
    61 #    context["page_msg"](plugin_name, method_name) 
     61#    request.page_msg(plugin_name, method_name) 
    6262    try: 
    6363        plugin = Plugin.objects.get(plugin_name=plugin_name) 
     
    7373        debug = request.debug, 
    7474    ) 
    75 #    context["page_msg"](plugin_config.plugin_manager_data) 
     75#    request.page_msg(plugin_config.plugin_manager_data) 
    7676    try: 
    7777        method_cfg = plugin_config.plugin_manager_data[method_name] 
     
    8282        return 
    8383 
    84 #    context["page_msg"](method_cfg) 
     84#    request.page_msg(method_cfg) 
    8585    if method_cfg["must_login"]: 
    8686        # User must be login to use this method 
     
    146146 
    147147        msg = "Run plugin %s.%s Error" % (plugin_name, method_name) 
    148         context["page_msg"].red("%s:" % msg) 
     148        request.page_msg.red("%s:" % msg) 
    149149        import sys, traceback 
    150         context["page_msg"]("<pre>%s</pre>" % traceback.format_exc()) 
     150        request.page_msg("<pre>%s</pre>" % traceback.format_exc()) 
    151151        return msg + "(Look in the page_msg)" 
    152152