Changeset 1585

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)
Location:
trunk/pylucid
Files:
3 added
19 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid/doc/plugin_api.py

    • Property svn:eol-style set to LF
    • Property svn:keywords set to Author
    r1507 r1585  
    1111    $LastChangedDate$ 
    1212    $Rev$ 
    13     $Author: JensDiemer $ 
     13    $Author$ 
    1414 
    1515    :copyleft: 2008 by Jens Diemer 
     
    149149 
    150150    #__________________________________________________________________________ 
     151    # PREFERENCES 
     152    # 
     153    def get_my_preferences(self): 
     154        """ 
     155        more info about plugin preferences: 
     156            http://www.pylucid.org/_goto/153/preferences/ 
     157        """ 
     158        # Get the preferences from the database: 
     159        preferences = self.get_preferences() 
     160 
     161        # Get a entry (It's a dict api) 
     162        my_entry_value = preferences["entry_key"] 
     163 
     164 
     165    #__________________________________________________________________________ 
    151166    # ENVIRONMENT 
    152167    # 
  • trunk/pylucid/PyLucid/db_dump_datadir/PyLucid_page.py

    r1562 r1585  
    44default = {} 
    55records = [ 
    6 [1, u'<h2>Welcome to your PyLucid CMS =;-)</h2> \r\n<p>\r\nNote:\r\n</p>\r\n<ul>\r\n\t<li>After install deactivate the _install section!</li> \r\n</ul>\r\n<h3>list of last page updates</h3>\r\n<p>\r\n<a href="{% lucidTag RSSfeedGenerator count="10" %}" type="application/rss+xml" title="page updates">RSS feed</a><br />\r\n{% lucidTag page_update_list %}\r\n</p>\r\n', None, 0, u'index', u'index', u'index', 1, 1, 1, u'', u'', '2007-06-22 09:48:29', '2007-12-04 02:25:55', 1, 1, True, True, None, None] 
     6[1, u'Note:\r\n\r\n* After install deactivate the _install section!\r\n\r\n=== list of last page updates\r\n\r\n{% lucidTag page_update_list count=10 %}', None, 0, u'Welcome', u'Welcome', u'Welcome to your PyLucid CMS =;-)', 1, 1, 6, u'', u'', '2007-06-22 09:48:29', '2008-05-23 11:24:42', 1, 1, True, True, None, None] 
    77[2, u'h2. sub menu\r\n\r\n{% lucidTag sub_menu %}', None, 0, u'example pages', u'ExamplePages', u'example pages', 1, 1, 2, u'', u'', '2007-06-22 09:48:29', '2007-06-22 09:48:33', 1, 1, True, True, None, None] 
    88[3, u'h1. tinyTextile help\r\n\r\nh1. headlines\r\n\r\nheadlines are introduced with \'h1.\':\r\n\r\n<pre>\r\nh1. h-1 headline\r\n\r\nh2. h-2 headline\r\n</pre>\r\n\r\nResult:\r\n\r\nh1. h-1 headline\r\n\r\nh2. h-2 headline\r\n\r\n(Important: one blank line under the headline!)\r\n\r\n<hr class="big_hr">\r\n\r\nh1. Text formatting\r\n\r\n<pre>\r\nI am a --small-- word with &lt;small&gt; tag.\r\nThis is a *fat* word with &lt;strong&gt; tag.\r\n</pre>\r\n\r\nResult:\r\n\r\nI am a --small-- word with ==<small>== tag.\r\nThis is a *fat* word with ==<strong>== tag.\r\n\r\n<hr class="big_hr">\r\n\r\nh1. Links\r\n\r\nLinks according in the following pattern:\r\n\r\n<pre>"LinkText":URL</pre>\r\n\r\nexamples:\r\n<pre>\r\nhttp://exampledomain.dtl\r\nftp://exampledomain.dtl\r\nmailto:name@exampledomain.dtl\r\nhttp://www.python-forum.de\r\nor better: "Das deutsche Python-Forum":http://www.python-forum.de\r\nThis is a link, too: "Link":?#unten\r\nWiki like, internal PyLucid links: [[ExamplePageName]]\r\n</pre>\r\n\r\nResult:\r\nhttp://exampledomain.dtl\r\nftp://exampledomain.dtl\r\nmailto:name@exampledomain.dtl\r\nhttp://www.python-forum.de\r\nor better: "Das deutsche Python-Forum":http://www.python-forum.de\r\nThis is a link, too: "Link":?#unten\r\nWiki like, internal PyLucid links: [[ExamplePageName]]\r\n\r\n<hr class="big_hr">\r\n\r\nh1. List\r\n\r\nYou can make ==<ul>== liste with "*" and ==<ol>== list with "#".\r\nNote: You can\'t mixed this list types ;)\r\n\r\nexamples:\r\n\r\n<pre>\r\nnormal list:\r\n* Lorem ipsum dolor sit amet\r\n** consectetuer adipiscing elit\r\n**** sed diam nonummy nibh\r\n**** euismod tincidunt ut laoreet\r\n** dolore magna aliquam erat volutpat.\r\n\r\nnumbered list:\r\n# Lorem ipsum dolor sit amet\r\n## consectetuer adipiscing elit\r\n#### sed diam nonummy nibh\r\n#### euismod tincidunt ut laoreet\r\n## dolore magna aliquam erat volutpat.\r\n</pre>\r\n\r\nResult:\r\n\r\nnormal list:\r\n* Lorem ipsum dolor sit amet\r\n** consectetuer adipiscing elit\r\n**** sed diam nonummy nibh\r\n**** euismod tincidunt ut laoreet\r\n** dolore magna aliquam erat volutpat.\r\n\r\nnumbered list:\r\n# Lorem ipsum dolor sit amet\r\n## consectetuer adipiscing elit\r\n#### sed diam nonummy nibh\r\n#### euismod tincidunt ut laoreet\r\n## dolore magna aliquam erat volutpat.\r\n\r\n<hr class="big_hr">\r\n\r\nh1. Bilder\r\n\r\nEin HTML-img-Tag wird erzeugt, wenn eine Adresse mit einem "!"-Zeichen\r\numschlossen ist.\r\n\r\n<pre>\r\n!http://images.sourceforge.net/images/project-support.jpg!\r\n!/favicon.ico!\r\n!http://domain.tld/pics/ich werde zu keiner URL weil hier leerzeichen sind.jpg!\r\n</pre>\r\n\r\nResult:\r\n\r\n!http://images.sourceforge.net/images/project-support.jpg!\r\n!/favicon.ico!\r\n!http://domain.tld/pics/ich werde zu keiner URL weil hier leerzeichen sind.jpg!\r\n\r\n<hr class="big_hr">\r\n\r\nh1. Embed Python SourceCode\r\n\r\nPut sourcecode between ==<python>== tag. Note: The start and end tag must be located alone in a line!\r\n\r\nexample:\r\n\r\n==\r\n<python>\r\n#!/usr/bin/python\r\n# -*- coding: UTF-8 -*-\r\n\r\n"""Ein kleines Skript"""\r\n\r\nprint "Hello Word: I love Python!"\r\n</python>\r\n==\r\n\r\nResult:\r\n<python>\r\n#!/usr/bin/python\r\n# -*- coding: UTF-8 -*-\r\n\r\n"""Ein kleines Skript"""\r\n\r\nprint "Hello Word: I love Python!"\r\n</python>\r\n\r\n\r\n<hr class="big_hr">\r\n\r\nh1. Embed source code generally\r\n\r\nWith the ==<code=ext>== Tag you can highlight everything, which offers Pygments.\r\n\'ext\' is the file extension.\r\n\r\nexamples:\r\n\r\n==\r\n<code=php>\r\n<?php\r\n$conn_id = ftp_connect($ftp_server);\r\n?>\r\n</code>\r\n<code=css>\r\nbody {\r\n  color: black;\r\n}\r\n</code>\r\n==\r\n\r\nResult:\r\n\r\n<code=php>\r\n<?php\r\n$conn_id = ftp_connect($ftp_server);\r\n?>\r\n</code>\r\n<code=css>\r\nbody {\r\n  color: black;\r\n}\r\n</code>\r\n\r\n<hr class="big_hr">\r\n\r\nh1. Escaping\r\n\r\nText inner two "="-chars would be escaped.\r\n\r\nexample:\r\n--------\r\n========\r\nTable: <table width="90%" border="0" align="center">\r\nLink: <a href="URL">txt</a>\r\nInput: <input type="submit" value="preview" />\r\n========\r\n\r\nIt goes also within a flow text:\r\nHere ist no Link: ========<a href="URL">txt</a>======== nice?\r\n\r\n<hr class="big_hr">\r\n\r\nh1. pre-Formarted-Text\r\n\r\nYou can use the ==<pre>== tag. tinyTextile ingnore the Markup in the area.\r\n\r\n<pre>\r\nExample:\r\n---------\r\nh2. Not a textile headline\r\n<h3>Manuelly h3 headline with html tags</h3>\r\n* This is not a...\r\n* ...textile list\r\n</pre>\r\n\r\n<hr class="big_hr">\r\n\r\nh1. HTML-Code\r\n\r\nYou can insert any HTML code directy in you page. tinyTextile ingnore it.', 2, 0, u'tinyTextile example', u'TinyTextileExample', u'complete tinyTextile Formating examples', 1, 1, 2, u'', u'', '2007-06-22 09:48:29', '2007-06-22 09:51:45', 1, 1, True, True, None, None] 
  • trunk/pylucid/PyLucid/db_dump_datadir/PyLucid_template.py

    r1333 r1585  
    44default = {} 
    55records = [ 
    6 [1, u'basic', '2007-06-22 09:48:29', '2007-12-07 08:50:16', None, None, u'default template', u'<?xml version="1.0" encoding="UTF-8"?>\r\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "xhtml1-strict.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml">\r\n<head>\r\n<title>PyLucid CMS - {% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</title>\r\n<meta name="robots"                    content="{{ robots }}" />\r\n<meta name="keywords"                  content="{{ PAGE.keywords }}" />\r\n<meta name="description"               content="{{ PAGE.description }}" />\r\n<meta name="Author"                    content="PyLucidCMS" />\r\n<meta name="DC.Date"                   content="{{ PAGE.lastupdatetime }}" />\r\n<meta name="DC.Date.created"           content="{{ PAGE.datetime }}" />\r\n<meta http-equiv="Content-Type"        content="text/html; charset=utf-8" />\r\n<meta name="MSSmartTagsPreventParsing" content="TRUE" />\r\n<meta http-equiv="imagetoolbar"        content="no" />\r\n<link rel="alternate" type="application/rss+xml" title="pages updates" href="{% lucidTag RSSfeedGenerator count="10" %}" />\r\n{% lucidTag page_style %}\r\n</head>\r\n<body>\r\n<div id="headline">\r\n  <a href="/">PyLucid CMS</a>\r\n</div>\r\n\r\n<div id="the_menu">\r\n  {% lucidTag main_menu %}\r\n  <div id="searching">\r\n    {% lucidTag search %}\r\n  </div>\r\n  <a href="http://sourceforge.net/projects/pylucid/" id="logo" alt="goto our SourceForge project page &gt;&gt;" title="goto our SourceForge project page &gt;&gt;">\r\n    <img src="http://sourceforge.net/sflogo.php?group_id=146328&amp;type=1" width="88" height="31" border="0" alt="SourceForge Logo" />\r\n  </a>\r\n</div>\r\n\r\n<div id="main_content">\r\n  <h2 id="page_title">{% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</h2>\r\n    {% if messages %}\r\n    <fieldset id="page_msg"><legend>page message</legend>\r\n    {% for message in messages %}\r\n      {{ message }}<br />\r\n    {% endfor %}\r\n    </fieldset>\r\n  {% endif %}\r\n  {% lucidTag admin_menu %}\r\n  <p>{% lucidTag back_links %}</p>\r\n  {{ PAGE.content }}\r\n  <p id="permalink"><a href="{{ PAGE.get_permalink }}" title="permalink to this page">permalink</a></p>\r\n</div>\r\n\r\n<p id="footer">\r\n   powered by {{ powered_by }} | {{ login_link }} | <!-- script_duration --> | last modified: {{ PAGE.lastupdatetime }}\r\n</p>\r\n\r\n</div>\r\n</body>\r\n</html>'] 
    7 [2, u'old_basic', '2007-06-22 09:48:29', '2007-12-07 08:50:38', None, None, u'the old default ghastly design... ;)', u'<?xml version="1.0" encoding="UTF-8"?>\r\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "xhtml1-strict.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml">\r\n<head>\r\n<title>PyLucid CMS - {% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</title>\r\n<meta name="robots"                    content="{{ robots }}" />\r\n<meta name="keywords"                  content="{{ PAGE.keywords }}" />\r\n<meta name="description"               content="{{ PAGE.description }}" />\r\n<meta name="Author"                    content="PyLucidCMS" />\r\n<meta name="DC.Date"                   content="{{ PAGE.lastupdatetime }}" />\r\n<meta name="DC.Date.created"           content="{{ PAGE.datetime }}" />\r\n<meta http-equiv="Content-Type"        content="text/html; charset=utf-8" />\r\n<meta name="MSSmartTagsPreventParsing" content="TRUE" />\r\n<meta http-equiv="imagetoolbar"        content="no" />\r\n<link rel="alternate" type="application/rss+xml" title="pages updates" href="{% lucidTag RSSfeedGenerator count="10" %}" />\r\n{% lucidTag page_style %}\r\n</head>\r\n<body>\r\n<div id="headline"><h2>PyLucid CMS</h2></div>\r\n<div id="sidebar">\r\n{% lucidTag main_menu %}\r\n</div>\r\n\r\n<div id="main-content">\r\n  <h2 id="page_title">{% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</h2>\r\n    {% if messages %}\r\n    <fieldset id="page_msg"><legend>page message</legend>\r\n    {% for message in messages %}\r\n      {{ message }}<br />\r\n    {% endfor %}\r\n    </fieldset>\r\n  {% endif %}\r\n  {% lucidTag admin_menu %}\r\n  <p>{% lucidTag back_links %}</p>\r\n  {{ PAGE.content }}\r\n  <p id="permalink"><a href="{{ PAGE.get_permalink }}" title="permalink to this page">permalink</a></p>\r\n  <p id="nav_footer">\r\n    powered by {{ powered_by }} | {{ login_link }} | <!-- script_duration --> | last modified: {{ PAGE.lastupdatetime }}\r\n  </p>\r\n</div>\r\n</body>\r\n</html>'] 
    8 [3, u'small_dark', '2007-06-22 09:48:29', '2007-12-07 08:50:50', None, None, u"The 'small dark' design.", u'<?xml version="1.0" encoding="UTF-8"?>\r\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "xhtml1-strict.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml">\r\n<head>\r\n<title>PyLucid CMS - {% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</title>\r\n<meta name="robots"                    content="{{ robots }}" />\r\n<meta name="keywords"                  content="{{ PAGE.keywords }}" />\r\n<meta name="description"               content="{{ PAGE.description }}" />\r\n<meta name="Author"                    content="PyLucidCMS" />\r\n<meta name="DC.Date"                   content="{{ PAGE.lastupdatetime }}" />\r\n<meta name="DC.Date.created"           content="{{ PAGE.datetime }}" />\r\n<meta http-equiv="Content-Type"        content="text/html; charset=utf-8" />\r\n<meta name="MSSmartTagsPreventParsing" content="TRUE" />\r\n<meta http-equiv="imagetoolbar"        content="no" />\r\n<link rel="alternate" type="application/rss+xml" title="pages updates" href="{% lucidTag RSSfeedGenerator count="10" %}" />\r\n{% lucidTag page_style %}\r\n</head>\r\n<body>\r\n<div id="content">\r\n  <p id="head">PyLucid CMS</p>\r\n  <hr class="big" />\r\n  {% lucidTag main_menu %}\r\n  <hr class="small" />\r\n\r\n  <h2 id="page_title">{% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</h2>\r\n    {% if messages %}\r\n    <fieldset id="page_msg"><legend>page message</legend>\r\n    {% for message in messages %}\r\n      {{ message }}<br />\r\n    {% endfor %}\r\n    </fieldset>\r\n  {% endif %}\r\n  {% lucidTag admin_menu %}\r\n  <p>{% lucidTag back_links %}</p>\r\n  {{ PAGE.content }}\r\n  \r\n  <p id="permalink"><a href="{{ PAGE.get_permalink }}" title="permalink to this page">permalink</a></p>\r\n\r\n  <hr class="small" />\r\n  <hr class="big" />\r\n  <p id="nav_footer">\r\n    powered by {{ powered_by }} | {{ login_link }} | <!-- script_duration --> | last modified: {{ PAGE.lastupdatetime }}\r\n  </p>\r\n</div>\r\n</body>\r\n</html>'] 
    9 [4, u'elementary', '2007-06-22 09:48:29', '2007-12-07 08:50:57', None, None, u"The 'elementary' design. Ideal as a basis for your own design.", u'<?xml version="1.0" encoding="UTF-8"?>\r\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "xhtml1-strict.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml">\r\n<head>\r\n<title>PyLucid CMS - {% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</title>\r\n<meta name="robots"                    content="{{ robots }}" />\r\n<meta name="keywords"                  content="{{ PAGE.keywords }}" />\r\n<meta name="description"               content="{{ PAGE.description }}" />\r\n<meta name="Author"                    content="PyLucidCMS" />\r\n<meta name="DC.Date"                   content="{{ PAGE.lastupdatetime }}" />\r\n<meta name="DC.Date.created"           content="{{ PAGE.datetime }}" />\r\n<meta http-equiv="Content-Type"        content="text/html; charset=utf-8" />\r\n<meta name="MSSmartTagsPreventParsing" content="TRUE" />\r\n<meta http-equiv="imagetoolbar"        content="no" />\r\n<link rel="alternate" type="application/rss+xml" title="pages updates" href="{% lucidTag RSSfeedGenerator count="10" %}" />\r\n{% lucidTag page_style %}\r\n</head>\r\n<body>\r\n<div id="headline"><h2>PyLucid CMS</h2></div>\r\n\r\n{% lucidTag main_menu %}\r\n\r\n<div id="main_content">\r\n  <h2 id="page_title">{% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</h2>\r\n    {% if messages %}\r\n    <fieldset id="page_msg"><legend>page message</legend>\r\n    {% for message in messages %}\r\n      {{ message }}<br />\r\n    {% endfor %}\r\n    </fieldset>\r\n  {% endif %}\r\n  {% lucidTag admin_menu %}\r\n  <p>{% lucidTag back_links %}</p>\r\n  {{ PAGE.content }}\r\n  <p id="permalink"><a href="{{ PAGE.get_permalink }}" title="permalink to this page">permalink</a></p>\r\n</div>\r\n\r\n<p id="footer">\r\n   powered by {{ powered_by }} | {{ login_link }} | <!-- script_duration --> | last modified: {{ PAGE.lastupdatetime }}\r\n</p>\r\n\r\n</div>\r\n</body>\r\n</html>'] 
    10 [5, u'small_white', '2007-06-22 09:48:29', '2007-12-07 08:51:05', None, None, u"The 'small white' design.", u'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">\r\n<head>\r\n<title>PyLucid CMS - {% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</title>\r\n<link rel="alternate" type="application/rss+xml" title="pages updates" href="{% lucidTag RSSfeedGenerator count="10" %}" />\r\n<link rel="shortcut icon" type="image/x-icon" href="/favicon_pylucid.ico">\r\n<meta http-equiv="content-type" content="text/html; charset=utf-8" />\r\n<meta name="robots" content="{{ robots }}" />\r\n<meta name="keywords" content="{{ PAGE.keywords }}" />\r\n<meta name="description" content="{{ PAGE.description }}" />\r\n<meta name="DC.Date" content="{{ PAGE.lastupdatetime }}" />\r\n<meta name="DC.Date.created" content="{{ PAGE.datetime }}" />\r\n<meta name="MSSmartTagsPreventParsing" content="TRUE" />\r\n<meta http-equiv="imagetoolbar" content="no" />\r\n{% lucidTag page_style %}\r\n</head>\r\n<body>\r\n<div id="wrap">\r\n  <div id="header">\r\n    <a href="/">\r\n      <img id="pylucid_logo" src="/_static/pylucid_logo_2_364x76.jpg" alt="PyLucid CMS" title="PyLucid CMS" />\r\n    </a>\r\n  </div>\r\n\r\n  <div id="leftside">\r\n    <h2 class="hide">Menu:</h2>\r\n    {% lucidTag main_menu %}\r\n    {% lucidTag search %}\r\n  </div>\r\n\r\n  <div id="contentwide">\r\n    <div id="admin">{% lucidTag admin_menu %}</div>\r\n    {% if messages %}\r\n      <fieldset id="page_msg"><legend>page message</legend>\r\n      {% for message in messages %}\r\n        {{ message }}<br />\r\n      {% endfor %}\r\n      </fieldset>\r\n    {% endif %}\r\n    <h2>{% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</h2>\r\n    <p>{% lucidTag back_links %}</p>\r\n    {{ PAGE.content }}\r\n    <p id="permalink"><a href="{{ PAGE.get_permalink }}" title="permalink to this page">permalink</a></p>\r\n  </div>\r\n\r\n  <div id="footer">\r\n    <p>\r\n      powered by {{ powered_by }} | {{ login_link }} | <!-- script_duration --> | last modified: {{ PAGE.lastupdatetime }}\r\n    </p>\r\n  </div>\r\n</div>\r\n</body>\r\n</html>\r\n'] 
     6[1, u'basic', '2008-05-23 11:11:06', '2008-05-23 11:11:06', None, None, u'default template', u'<?xml version="1.0" encoding="UTF-8"?>\r\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "xhtml1-strict.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml">\r\n<head>\r\n<title>PyLucid CMS - {% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</title>\r\n<meta name="robots"                    content="{{ robots }}" />\r\n<meta name="keywords"                  content="{{ PAGE.keywords }}" />\r\n<meta name="description"               content="{{ PAGE.description }}" />\r\n<meta name="Author"                    content="PyLucidCMS" />\r\n<meta name="DC.Date"                   content="{{ PAGE.lastupdatetime }}" />\r\n<meta name="DC.Date.created"           content="{{ PAGE.datetime }}" />\r\n<meta http-equiv="Content-Type"        content="text/html; charset=utf-8" />\r\n<meta name="MSSmartTagsPreventParsing" content="TRUE" />\r\n<meta http-equiv="imagetoolbar"        content="no" />\r\n<link rel="alternate" type="application/rss+xml" title="pages updates" href="{% lucidTag RSSfeedGenerator count="10" %}" />\r\n{% lucidTag page_style %}\r\n</head>\r\n<body>\r\n<div id="headline">\r\n  <a href="/">PyLucid CMS</a>\r\n</div>\r\n\r\n<div id="the_menu">\r\n  {% lucidTag main_menu %}\r\n  <div id="searching">\r\n    {% lucidTag search %}\r\n  </div>\r\n  <a href="http://sourceforge.net/projects/pylucid/" id="logo" alt="goto our SourceForge project page &gt;&gt;" title="goto our SourceForge project page &gt;&gt;">\r\n    <img src="http://sourceforge.net/sflogo.php?group_id=146328&amp;type=1" width="88" height="31" border="0" alt="SourceForge Logo" />\r\n  </a>\r\n</div>\r\n\r\n<div id="main_content">\r\n  <h2 id="page_title">{% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</h2>\r\n    <!-- page_messages -->\r\n  {% lucidTag admin_menu %}\r\n  <p>{% lucidTag back_links %}</p>\r\n  {{ PAGE.content }}\r\n  <p id="permalink"><a href="{{ PAGE.get_permalink }}" title="permalink to this page">permalink</a></p>\r\n</div>\r\n\r\n<p id="footer">\r\n   powered by {{ powered_by }} | {{ login_link }} | <!-- script_duration --> | last modified: {{ PAGE.lastupdatetime }}\r\n</p>\r\n\r\n</div>\r\n</body>\r\n</html>'] 
     7[2, u'old_basic', '2008-05-23 11:11:06', '2008-05-23 11:11:06', None, None, u'the old default ghastly design... ;)', u'<?xml version="1.0" encoding="UTF-8"?>\r\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "xhtml1-strict.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml">\r\n<head>\r\n<title>PyLucid CMS - {% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</title>\r\n<meta name="robots"                    content="{{ robots }}" />\r\n<meta name="keywords"                  content="{{ PAGE.keywords }}" />\r\n<meta name="description"               content="{{ PAGE.description }}" />\r\n<meta name="Author"                    content="PyLucidCMS" />\r\n<meta name="DC.Date"                   content="{{ PAGE.lastupdatetime }}" />\r\n<meta name="DC.Date.created"           content="{{ PAGE.datetime }}" />\r\n<meta http-equiv="Content-Type"        content="text/html; charset=utf-8" />\r\n<meta name="MSSmartTagsPreventParsing" content="TRUE" />\r\n<meta http-equiv="imagetoolbar"        content="no" />\r\n<link rel="alternate" type="application/rss+xml" title="pages updates" href="{% lucidTag RSSfeedGenerator count="10" %}" />\r\n{% lucidTag page_style %}\r\n</head>\r\n<body>\r\n<div id="headline"><h2>PyLucid CMS</h2></div>\r\n<div id="sidebar">\r\n{% lucidTag main_menu %}\r\n</div>\r\n\r\n<div id="main-content">\r\n  <h2 id="page_title">{% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</h2>\r\n    <!-- page_messages -->\r\n  {% lucidTag admin_menu %}\r\n  <p>{% lucidTag back_links %}</p>\r\n  {{ PAGE.content }}\r\n  <p id="permalink"><a href="{{ PAGE.get_permalink }}" title="permalink to this page">permalink</a></p>\r\n  <p id="nav_footer">\r\n    powered by {{ powered_by }} | {{ login_link }} | <!-- script_duration --> | last modified: {{ PAGE.lastupdatetime }}\r\n  </p>\r\n</div>\r\n</body>\r\n</html>'] 
     8[3, u'small_dark', '2008-05-23 11:11:06', '2008-05-23 11:11:06', None, None, u"The 'small dark' design.", u'<?xml version="1.0" encoding="UTF-8"?>\r\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "xhtml1-strict.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml">\r\n<head>\r\n<title>PyLucid CMS - {% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</title>\r\n<meta name="robots"                    content="{{ robots }}" />\r\n<meta name="keywords"                  content="{{ PAGE.keywords }}" />\r\n<meta name="description"               content="{{ PAGE.description }}" />\r\n<meta name="Author"                    content="PyLucidCMS" />\r\n<meta name="DC.Date"                   content="{{ PAGE.lastupdatetime }}" />\r\n<meta name="DC.Date.created"           content="{{ PAGE.datetime }}" />\r\n<meta http-equiv="Content-Type"        content="text/html; charset=utf-8" />\r\n<meta name="MSSmartTagsPreventParsing" content="TRUE" />\r\n<meta http-equiv="imagetoolbar"        content="no" />\r\n<link rel="alternate" type="application/rss+xml" title="pages updates" href="{% lucidTag RSSfeedGenerator count="10" %}" />\r\n{% lucidTag page_style %}\r\n</head>\r\n<body>\r\n<div id="content">\r\n  <p id="head">PyLucid CMS</p>\r\n  <hr class="big" />\r\n  {% lucidTag main_menu %}\r\n  <hr class="small" />\r\n\r\n  <h2 id="page_title">{% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</h2>\r\n    <!-- page_messages -->\r\n  {% lucidTag admin_menu %}\r\n  <p>{% lucidTag back_links %}</p>\r\n  {{ PAGE.content }}\r\n  \r\n  <p id="permalink"><a href="{{ PAGE.get_permalink }}" title="permalink to this page">permalink</a></p>\r\n\r\n  <hr class="small" />\r\n  <hr class="big" />\r\n  <p id="nav_footer">\r\n    powered by {{ powered_by }} | {{ login_link }} | <!-- script_duration --> | last modified: {{ PAGE.lastupdatetime }}\r\n  </p>\r\n</div>\r\n</body>\r\n</html>'] 
     9[4, u'elementary', '2008-05-23 11:11:06', '2008-05-23 11:11:06', None, None, u"The 'elementary' design. Ideal as a basis for your own design.", u'<?xml version="1.0" encoding="UTF-8"?>\r\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "xhtml1-strict.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml">\r\n<head>\r\n<title>PyLucid CMS - {% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</title>\r\n<meta name="robots"                    content="{{ robots }}" />\r\n<meta name="keywords"                  content="{{ PAGE.keywords }}" />\r\n<meta name="description"               content="{{ PAGE.description }}" />\r\n<meta name="Author"                    content="PyLucidCMS" />\r\n<meta name="DC.Date"                   content="{{ PAGE.lastupdatetime }}" />\r\n<meta name="DC.Date.created"           content="{{ PAGE.datetime }}" />\r\n<meta http-equiv="Content-Type"        content="text/html; charset=utf-8" />\r\n<meta name="MSSmartTagsPreventParsing" content="TRUE" />\r\n<meta http-equiv="imagetoolbar"        content="no" />\r\n<link rel="alternate" type="application/rss+xml" title="pages updates" href="{% lucidTag RSSfeedGenerator count="10" %}" />\r\n{% lucidTag page_style %}\r\n</head>\r\n<body>\r\n<div id="headline"><h2>PyLucid CMS</h2></div>\r\n\r\n{% lucidTag main_menu %}\r\n\r\n<div id="main_content">\r\n  <h2 id="page_title">{% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</h2>\r\n    <!-- page_messages -->\r\n  {% lucidTag admin_menu %}\r\n  <p>{% lucidTag back_links %}</p>\r\n  {{ PAGE.content }}\r\n  <p id="permalink"><a href="{{ PAGE.get_permalink }}" title="permalink to this page">permalink</a></p>\r\n</div>\r\n\r\n<p id="footer">\r\n   powered by {{ powered_by }} | {{ login_link }} | <!-- script_duration --> | last modified: {{ PAGE.lastupdatetime }}\r\n</p>\r\n\r\n</div>\r\n</body>\r\n</html>'] 
     10[5, u'small_white', '2008-05-23 11:11:06', '2008-05-23 11:11:06', None, None, u"The 'small white' design.", u'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r\n<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">\r\n<head>\r\n<title>PyLucid CMS - {% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</title>\r\n<link rel="alternate" type="application/rss+xml" title="pages updates" href="{% lucidTag RSSfeedGenerator count="10" %}" />\r\n<link rel="shortcut icon" type="image/x-icon" href="/favicon_pylucid.ico">\r\n<meta http-equiv="content-type" content="text/html; charset=utf-8" />\r\n<meta name="robots" content="{{ robots }}" />\r\n<meta name="keywords" content="{{ PAGE.keywords }}" />\r\n<meta name="description" content="{{ PAGE.description }}" />\r\n<meta name="DC.Date" content="{{ PAGE.lastupdatetime }}" />\r\n<meta name="DC.Date.created" content="{{ PAGE.datetime }}" />\r\n<meta name="MSSmartTagsPreventParsing" content="TRUE" />\r\n<meta http-equiv="imagetoolbar" content="no" />\r\n{% lucidTag page_style %}\r\n</head>\r\n<body>\r\n<div id="wrap">\r\n  <div id="header">\r\n    <a href="/">\r\n      <img id="pylucid_logo" src="/_static/pylucid_logo_2_364x76.jpg" alt="PyLucid CMS" title="PyLucid CMS" />\r\n    </a>\r\n  </div>\r\n\r\n  <div id="leftside">\r\n    <h2 class="hide">Menu:</h2>\r\n    {% lucidTag main_menu %}\r\n    {% lucidTag search %}\r\n  </div>\r\n\r\n  <div id="contentwide">\r\n    <div id="admin">{% lucidTag admin_menu %}</div>\r\n    <!-- page_messages -->\r\n    <h2>{% if PAGE.title %}{{ PAGE.title|escape }}{% else %}{{ PAGE.name|escape }}{% endif %}</h2>\r\n    <p>{% lucidTag back_links %}</p>\r\n    {{ PAGE.content }}\r\n    <p id="permalink"><a href="{{ PAGE.get_permalink }}" title="permalink to this page">permalink</a></p>\r\n  </div>\r\n\r\n  <div id="footer">\r\n    <p>\r\n      powered by {{ powered_by }} | {{ login_link }} | <!-- script_duration --> | last modified: {{ PAGE.lastupdatetime }}\r\n    </p>\r\n  </div>\r\n</div>\r\n</body>\r\n</html>\r\n'] 
    1111] 
  • trunk/pylucid/PyLucid/index.py

    r1583 r1585  
    9898    context = RequestContext(request) 
    9999 
    100     context["page_msg"] = PageMessages(context) 
     100    request.page_msg = PageMessages(context) 
    101101 
    102102    # Redirect every "warning" messages into the page_msg: 
    103     redirect_warnings(context["page_msg"]) 
     103#    redirect_warnings(request.page_msg) 
     104    redirect_warnings(request.page_msg) 
    104105 
    105106    context["PAGE"] = current_page_obj 
     
    122123 
    123124    # Add the context to the reponse object. 
    124     # Used in PyLucid.middlewares.additional_content 
     125    # Used in PyLucid middlewares 
    125126    request.CONTEXT = context 
     127 
     128    # TODO: remove Backwards-incompatible changes in >v0.8.5 
     129    msg = ( 
     130        'Error, see: <a href="' 
     131        'http://www.pylucid.org/_goto/121/changes/#20-05-2008-page_msg' 
     132        '">pylucid.org - Backwards-incompatible changes - page_msg</a>' 
     133    ) 
     134    context["messages"] = [mark_safe(msg)] 
    126135 
    127136    return context 
  • trunk/pylucid/PyLucid/install/BaseInstall.py

    r1505 r1585  
    130130 
    131131        self.page_msg = PageMessages(self.context) 
    132         self.context["page_msg"] = self.page_msg 
    133  
    134         # Redirect every "warning" messages into context["page_msg"]: 
    135         redirect_warnings(self.context["page_msg"]) 
     132        self.request.page_msg = self.page_msg 
     133 
     134        # Redirect every "warning" messages into request.page_msg: 
     135        redirect_warnings(self.request.page_msg) 
    136136 
    137137    #___________________________________________________________________________ 
     
    145145 
    146146        if msg and msg != "": # insert the messages: 
    147             self.context["page_msg"].write(msg) 
     147            self.request.page_msg.write(msg) 
    148148 
    149149        return render_to_response( 
     
    172172            # Cookie is not set or the salt hash value compair failed 
    173173            if DEBUG: 
    174                 self.context["page_msg"].write("DEBUG: %s" % msg) 
     174                self.request.page_msg.write("DEBUG: %s" % msg) 
    175175        else: 
    176176            # access ok -> start the normal _install view() method 
     
    190190                except WrongPassword, msg: 
    191191                    # Display the form again 
    192                     self.context["page_msg"].write(msg) 
     192                    self.request.page_msg.write(msg) 
    193193                else: 
    194194                    # Password is ok. -> process the normal _instal view() 
     
    205205 
    206206        self.context["no_menu_link"] = True # no "back to menu" link 
    207 #        self.context["page_msg"].write(_("Please input the password")) 
     207#        self.request.page_msg.write(_("Please input the password")) 
    208208        return render_to_response("install_login.html", self.context) 
    209209 
  • trunk/pylucid/PyLucid/install/install.py

    r1552 r1585  
    102102    def view(self): 
    103103        from PyLucid.tools.db_dump import loaddb 
    104  
    105         # Delete all prefecrences (only for alpha state!!!) 
    106         from PyLucid.models import Preference 
    107         Preference.objects.all().delete() 
    108104 
    109105        self._redirect_execute( 
  • trunk/pylucid/PyLucid/install/update.py

    r1584 r1585  
    1919 
    2020#______________________________________________________________________________ 
     21 
     22import re 
     23from PyLucid.tools.Diff import diff_lines as _diff_lines 
     24 
     25PAGE_MSG_RE = re.compile(r"""{% if messages %}.*?{% endif %}(?uims)""") 
     26NEW_PAGE_MSG_TAG = "<!-- page_messages -->" 
     27BACKUP_NAME_SUFFIX = " auto backup" 
     28 
    2129class Update2(BaseInstall): 
    2230    def view(self): 
    2331        self._redirect_execute(self._update_tables) 
     32        self._redirect_execute(self._update_templates) 
    2433 
    2534        return self._simple_render( 
    26             headline="Update PyLucid from v0.8.0 to v0.8.1" 
     35            headline="Update PyLucid from v0.8.0 to v0.8.5" 
    2736        ) 
    2837 
    2938    def _update_tables(self): 
    30         print "update database tables:" 
     39        print "*** update database tables:" 
    3140        for table_name in ("pagesinternal", "markup"): 
    3241            try: 
     
    4049                print "OK" 
    4150 
     51    def _update_templates(self): 
     52        print "\n*** update templates:" 
     53        templates = Template.objects.all() 
     54        for template in templates: 
     55            old_id = template.id 
     56 
     57            print "_"*79 
     58            print "process template '%s':" % template.name 
     59 
     60            if BACKUP_NAME_SUFFIX in template.name: 
     61                #template.delete() 
     62                print "Skip!" 
     63                continue 
     64 
     65            old_content = template.content 
     66            new_content = PAGE_MSG_RE.sub(NEW_PAGE_MSG_TAG, old_content) 
     67            if old_content == new_content: 
     68                print "Old tag not found or changes applied in the past." 
     69                continue 
     70 
     71            print "result diff:" 
     72            diff = _diff_lines(old_content, new_content) 
     73            print diff 
     74            print "-"*79 
     75 
     76            original_name = template.name 
     77            backup_name = original_name + BACKUP_NAME_SUFFIX 
     78            print "Create backup template '%s'..." % backup_name, 
     79 
     80            try: 
     81                bak_template = Template.objects.get(name=backup_name) 
     82            except Template.DoesNotExist: 
     83                # ok, create backup 
     84                template.name = backup_name 
     85                template.id = None 
     86                template.save() 
     87                print "OK" 
     88            else: 
     89                print "\nError: A template with the name '%s' exists." % ( 
     90                    backup_name 
     91                ) 
     92                print "Skip update!" 
     93                continue 
     94 
     95            template.name = original_name 
     96            template.id = old_id 
     97 
     98            print "save new content...", 
     99            template.content = new_content 
     100            template.save() 
     101            print "OK" 
    42102 
    43103def update2(request): 
    44104    """ 
    45     1. update from v0.8.0 to v0.8.1 
     105    1. update from v0.8.0 to v0.8.5 
    46106    """ 
    47107    return Update2(request).start_view() 
     
    428488    "<lucid(Function):(.*?)>(.*?)</lucidFunction>" 
    429489) 
    430 PAGE_MSG_TAG = """\ 
    431   {% if messages %} 
    432     <fieldset id="page_msg"><legend>page message</legend> 
    433     {% for message in messages %} 
    434       {{ message }}<br /> 
    435     {% endfor %} 
    436     </fieldset> 
    437   {% endif %}\ 
    438 """ 
    439490 
    440491CHANGE_TAGS = { 
    441     "page_msg": PAGE_MSG_TAG, 
     492    "page_msg": "<!-- page_messages -->", 
    442493    "script_login": "{{ login_link }}", 
    443494    "robots": "{{ robots }}", 
  • trunk/pylucid/PyLucid/middlewares/pagestats.py

    r1546 r1585  
    2525 
    2626from PyLucid.template_addons.filters import human_duration 
     27from PyLucid.middlewares.utils import is_html, replace_content 
    2728 
    2829# Save the start time of the current running pyhon instance 
     
    5152        """ 
    5253        # Put only the statistic into HTML pages 
    53         if not "html" in response._headers["content-type"][1]: 
     54        if not is_html(response): 
    5455            # No HTML Page -> do nothing 
    5556            return response 
     
    6970        } 
    7071 
    71         content = response.content 
    72         if not isinstance(content, unicode): 
    73             # FIXME: In my shared webhosting environment is response.content a 
    74             # string and not unicode. Why? 
    75             from django.utils.encoding import force_unicode 
    76             try: 
    77                 content = force_unicode(content) 
    78             except: 
    79                 return response 
     72        # insert the page statistic 
     73        response = replace_content(response, TAG, stat_info) 
    8074 
    81 #        content = self.debug_sql_queries(content) 
    82  
    83         # insert the page statistic 
    84         new_content = content.replace(TAG, stat_info) 
    85         response.content = new_content 
     75        #response = self.debug_sql_queries(response) 
    8676 
    8777        return response 
    8878 
    89     def debug_sql_queries(self, content): 
     79    def debug_sql_queries(self, response): 
     80        """ 
     81        Insert all SQL queries. 
     82        ONLY for developers! 
     83        """ 
    9084        show_only = ("PyLucid_plugin", "PyLucid_preference2") 
    9185        sql_info = "<h2>Debug SQL queries:</h2>" 
     
    106100            sql_info += "\n%s\n%s\n" % (time, sql) 
    107101        sql_info += "</pre></body>" 
    108         content = content.replace("</body>", sql_info) 
    109         return content 
     102 
     103        response = replace_content(response, "</body>", sql_info) 
     104 
     105        return response 
  • trunk/pylucid/PyLucid/models/Plugin.py

    r1584 r1585  
    2424from django.contrib.auth.models import User, Group 
    2525 
     26from PyLucid.system.plugin_import import get_plugin_config, get_plugin_version 
    2627from PyLucid.tools.newforms_utils import get_init_dict, setup_help_text 
    2728from PyLucid.tools.data_eval import data_eval, DataEvalError 
     
    106107        evaluate the pformat string into a dict and return it. 
    107108        """ 
    108         data_dict = data_eval(self.pref_data_string) 
     109        if self.pref_data_string == None: 
     110            # There exist no preferences (e.g. plugin update not applied, yet) 
     111            data_dict = None 
     112        else: 
     113            data_dict = data_eval(self.pref_data_string) 
    109114        preference_cache[self.plugin_name] = data_dict 
    110115        return data_dict 
  • trunk/pylucid/PyLucid/plugins_internal/filemanager/filemanager.py

    r1492 r1585  
    252252        self.context     = context 
    253253        self.request     = context["request"] 
    254         self.page_msg    = context["page_msg"] 
     254        self.page_msg    = request.page_msg 
    255255 
    256256    def new_dir_path(self, path_info, must_exist=True): 
  • trunk/pylucid/PyLucid/settings_example.py

    r1541 r1585  
    8686    # Insert a statistic line into the generated page: 
    8787    'PyLucid.middlewares.pagestats.PageStatsMiddleware', 
     88 
     89    'PyLucid.middlewares.pagemessages.PageMessagesMiddleware', 
    8890 
    8991    # PyLucidCommonMiddleware loads the django middlewares: 
  • trunk/pylucid/PyLucid/system/BasePlugin.py

    r1565 r1585  
    5252        self.internal_page = InternalPage(context, self.plugin_name) 
    5353 
     54        self.request    = context["request"] 
     55        self.response   = response 
    5456        self.context    = context 
    55         self.response   = response 
    56  
    57         self.request    = context["request"] 
    58         self.page_msg   = context["page_msg"] 
     57 
     58        self.page_msg   = self.request.page_msg 
    5959        self.URLs       = context["URLs"] 
    6060 
    6161        self.current_page = self.context["PAGE"] 
     62 
     63        self.__preference_cache = None 
     64 
     65    def get_preferences(self): 
     66        """ 
     67        returns the preferences from the database as a dict 
     68        """ 
     69        if self.__preference_cache == None: 
     70            self.__preference_cache = Plugin.objects.get_preferences( 
     71                self.plugin_name 
     72            ) 
     73        return self.__preference_cache 
    6274 
    6375    def build_menu(self): 
  • trunk/pylucid/PyLucid/system/internal_page.py

    r1486 r1585  
    3737    """ 
    3838    def __init__(self, context, plugin_name): 
    39         self.page_msg   = context["page_msg"] 
    40         self.URLs       = context["URLs"] 
     39        self.request     = context["request"] 
     40        self.page_msg    = self.request.page_msg 
     41        self.URLs        = context["URLs"] 
    4142 
    4243        self.plugin_name = plugin_name 
  • trunk/pylucid/PyLucid/system/markups/tinyTextile.py

    r1561 r1585  
    2525    Last commit info: 
    2626    ~~~~~~~~~~~~~~~~~ 
    27     $LastChangedDate$ 
    28     $Rev$ 
    29     $Author$ 
     27    $LastChangedDate:2008-05-13 18:26:55 +0200 (Di, 13 Mai 2008) $ 
     28    $Rev:1561 $ 
     29    $Author:JensDiemer $ 
    3030 
    3131    :copyleft: 2007-2008 by Jens Diemer 
     
    3434 
    3535 
    36 __version__ = "$Rev$" 
     36__version__ = "$Rev:1561 $" 
    3737 
    3838import sys, re 
     
    4646        self.out = out_obj 
    4747        self.context = context 
    48         self.page_msg   = context["page_msg"] 
     48        self.page_msg = context["request"].page_msg 
    4949 
    5050        # Blockelements 
  • trunk/pylucid/PyLucid/system/page_msg.py

    r1544 r1585  
    3333import os, sys, pprint, inspect 
    3434 
    35 from django.utils.safestring import mark_safe 
     35from django.utils.safestring import mark_safe, SafeData 
     36from django.utils.encoding import force_unicode 
     37 
    3638from django.conf import settings 
    37  
    3839 
    3940from PyLucid.tools.utils import escape 
     
    4647    """ 
    4748    def __init__(self, context): 
     49        request = context["request"] 
     50 
    4851        try: 
    49             self.messages = context["messages"] 
    50         except KeyError: 
    51             # No django messages inserted by RequestContext 
    52             # In the _install section we use no RequestContext ;) 
     52            self.messages = request.user.get_and_delete_messages() 
     53        except AttributeError: 
     54            # In the _install section we have no user 
    5355            self.messages = [] 
    5456 
    55         request = context["request"] 
    5657        self.debug_mode = getattr(request, "debug", False) 
    5758 
     
    8586            color, self.prepare(*msg) 
    8687        ) 
    87  
    8888        #~ self.request.user.message_set.create(message=msg) 
    8989        msg = mark_safe(msg) # turn djngo auto-escaping off 
     
    9393        """ 
    9494        Append the fileinfo: Where from the announcement comes? 
    95         Only, if debug_mode is on. 
    9695        """ 
    97         if self.debug_mode != True: 
    98             return "" 
    99  
    10096        try: 
    10197            self_basename = os.path.basename(__file__) 
     
    126122        -for dict, list use pprint ;) 
    127123        """ 
    128         result = [self._get_fileinfo()] 
     124        if self.debug_mode == True: 
     125            result = [self._get_fileinfo()] 
     126        else: 
     127            result = [] 
    129128 
    130129        for item in msg: 
     
    141140 
    142141        result = "".join(result) 
    143         return escape(result) 
     142        return result 
    144143 
    145144    def encode_and_prepare(self, txt): 
    146145        """ 
    147         returns the given txt as a string object. 
     146        Pass "safe" strings, all other would be escaped. 
    148147        """ 
    149         if isinstance(txt, unicode): 
    150             return txt.encode(self._charset) 
     148        if isinstance(txt, SafeData): 
     149            return txt 
    151150 
    152         # FIXME: Is that needed??? 
    153         try: 
    154             return str(txt) 
    155         except: 
    156             return repr(txt) 
     151        if not isinstance(txt, unicode): 
     152            txt = force_unicode(txt) 
     153 
     154        return escape(txt) 
     155 
     156 
     157    #________________________________________________________________ 
     158 
     159    def __repr__(self): 
     160        return "page messages: %s" % repr(self.messages) 
     161 
     162    def __str__(self): 
     163        return "pages messages: %s" % ", ".join(self.messages) 
     164 
     165    def __unicode__(self): 
     166        return u"page messages: %s" % u", ".join(self.messages) 
    157167 
    158168    #________________________________________________________________ 
  • 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 
  • trunk/pylucid/PyLucid/system/URLs.py

    r1537 r1585  
    1111    The view put a instance in context["URLs"]. The BasePlugin bind the class 
    1212    to self. So every plugin can easy access the methods with self.URLs. 
    13      
     13 
    1414    more info: http://pylucid.org/_goto/62/self-URLs/ 
    1515 
     
    102102        self.context     = context 
    103103        self.request     = context["request"] 
    104         self.page_msg    = context["page_msg"] 
     104        self.page_msg    = self.request.page_msg 
    105105 
    106106        self.current_plugin = None 
  • trunk/pylucid/PyLucid/tools/content_processors.py

    r1561 r1585  
    128128        ./PyLucid/models.py 
    129129    """ 
    130     page_msg = context["page_msg"] 
     130    request  = context["request"] 
     131    page_msg = request.page_msg 
    131132 
    132133    if markup_no == 2: # textile 
  • trunk/pylucid/tests/utils/FakeRequest.py

    r1493 r1585  
    2828    META = {"HTTP_HOST": __fake_http_host,} 
    2929    debug = True 
     30    page_msg = FakePageMsg() 
    3031    def get_host(self): 
    3132        """ 
     
    5455    fake_context = { 
    5556        "request": FakeRequest(), 
    56         "page_msg": FakePageMsg(), 
     57#        "page_msg": , 
    5758        "PAGE": page_object, 
    5859        "CSS_ID_list": [],