Show
Ignore:
Timestamp:
06/30/07 19:32:16 (3 years ago)
Author:
JensDiemer
Message:

* move _replace_add_data() from PyLucid.index into PyLucid.tools.content_processors
* use replace_add_data() to insert the CSS data into page_admin tag_list and tinyTextile_help

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.8(django)/PyLucid/tools/content_processors.py

    r1127 r1135  
    2222 
    2323from PyLucid.system.response import SimpleStringIO 
     24from PyLucid.db.internal_pages import get_internal_page 
    2425from PyLucid import settings 
    2526 
     
    103104    html = template.render(context2) 
    104105    return html 
     106 
     107 
     108def replace_add_data(context, content): 
     109    """ 
     110    Replace the temporary inserted "add data" tag, with all collected CSS/JS 
     111    contents, e.g. from the internal pages. 
     112    Note: The tag added in PyLucid.plugins_internal.page_style 
     113    """ 
     114    try: 
     115        internal_page = get_internal_page("page_style", "add_data") 
     116        internal_page_content = internal_page.content_html 
     117 
     118        context = { 
     119            "js_data": context["js_data"], 
     120            "css_data": context["css_data"], 
     121        } 
     122        html = render_string_template(internal_page_content, context) 
     123    except Exception, msg: 
     124        html = "<!-- Replace the ADD_DATA_TAG error: %s -->" % msg 
     125 
     126    content = content.replace(settings.ADD_DATA_TAG, html) 
     127    return content