|
[Webware-checkins] r6335 - in Webware/trunk: KidKit KidKit/Docs
KidKit/Examples WebKit/Configs
From: <updates@we...> - 2007-03-18 20:49
|
Author: chrisz Date: Sun Mar 18 14:49:05 2007 New Revision: 6335 Modified: Webware/trunk/KidKit/Docs/RelNotes-X.Y.phtml Webware/trunk/KidKit/Docs/UsersGuide.phtml Webware/trunk/KidKit/Examples/Main.py Webware/trunk/KidKit/Examples/Welcome.kid Webware/trunk/KidKit/KidServletFactory.py Webware/trunk/KidKit/Properties.py Webware/trunk/WebKit/Configs/Application.config Log: Updated KidKit: The Homepage has changed; ElementTree is not required any more; added support for the new Kid output formatting. Modified: Webware/trunk/KidKit/Docs/RelNotes-X.Y.phtml ============================================================================== --- Webware/trunk/KidKit/Docs/RelNotes-X.Y.phtml (original) +++ Webware/trunk/KidKit/Docs/RelNotes-X.Y.phtml Sun Mar 18 14:49:05 2007 @@ -2,39 +2,10 @@ <p><% name %> version <% versionString %> released on <% releaseDate %></p> -<a name="Introduction"></a><h2>Introduction</h2> -<ul> - <li>...</li> -</ul> - -<a name="MajorChanges"></a><h2>Major Changes</h2> -<ul> - <li>...</li> -</ul> - <a name="NewFeatures"></a><h2>New Features</h2> <ul> - <li>...</li> -</ul> - -<a name="Improvements"></a><h2>Improvements and Refinements</h2> -<ul> - <li>...</li> -</ul> - -<a name="Security"></a><h2>Security</h2> -<ul> - <li>...</li> -</ul> - -<a name="MinorChanges"></a><h2>Minor API Changes</h2> -<ul> - <li>...</li> -</ul> - -<a name="Bugfixes"></a><h2>Bugfixes</h2> -<ul> - <li>...</li> + <li>You can now modify the Kid output formatting using the configuration + parameter <code>KidOutputFormat</code>.</li> </ul> <% footer() %> \ No newline at end of file Modified: Webware/trunk/KidKit/Docs/UsersGuide.phtml ============================================================================== --- Webware/trunk/KidKit/Docs/UsersGuide.phtml (original) +++ Webware/trunk/KidKit/Docs/UsersGuide.phtml Sun Mar 18 14:49:05 2007 @@ -2,8 +2,9 @@ <p><% name %> version <% versionString %></p> -<p>First version created by Winston Wolff, January 2005.<br> -Improved version by Christoph Zwerschke, October 2005.</p> +<p>Created by Winston Wolff, January 2005.<br> +Improved version by Christoph Zwerschke, October 2005. +Lates changes by Christoph Zwerschke, March 2007.</p> <h2>Synopsis</h2> @@ -13,24 +14,16 @@ This is very similar to the concept of Python Server Pages (PSP), but Kid provides some unique features making it an amazing modern alternative to PSP.</p> -<p>Kid and KidKit are currently under development, so consider -KidKit still <em>alpha</em> at the moment (August 2006). -If you use Kid a lot, feel free to improve this component.</p> - <h2>Requirements</h2> <p>Contrary to PSP, Kid itself is not included in Webware. You need to install -the Kid package separately. Note that Kid needs the ElementTree package and -optionally makes use of the cElementTree package (future versions of Kid may -also utilize the xml.etree package that comes shipped with Python 2.5).</p> +the Kid package separately.</p> <p>You can download Kid from -<a href="http://kid.lesscode.org">kid.lesscode.org</a>, -and ElementTree from -<a href="http://effbot.org/downloads/#elementtree">effbot.org/downloads/#elementtree</a>.</p> +<a href="http://www.kid-templating.org/">www.kid-templating.org/</a>.</p> -<p>The current KidKit has been tested with Kid versions from 0.6 up to 0.9.3, -and ElementTree version 1.2.6. Other versions may work as well.</p> +<p>The current KidKit has been tested with Kid versions from 0.6 up to 0.9.5. +Other versions may work as well.</p> <h2>Feedback</h2> @@ -67,8 +60,11 @@ <ul> <li><b>KidOutputMethod</b><br> -The default output method for Kid. Possible values are: +The default output method for Kid. Some possible values are: 'xml', 'html', 'html-strict', 'xhtml' and 'xhtml-strict'.</li> +<li><b>KidOutputMethod</b><br> +The default output format for Kid. Some possible values are: +'default', 'compact', 'newlines', 'pretty', 'wrap', 'nice', 'ugly', 'named'.</li> <li><b>CacheKidTemplates</b><br> Set this to False if you do not want compiled Kid templates (i.e. the <tt>.py</tt> or <tt>.pyc</tt> files) to be cached on disk. @@ -96,7 +92,7 @@ <p>In the simplest case, you can just take a Kid template file with the extension <tt>.kid</tt> and place it into a directory that is a valid Webware context. For instance, you will find the following file with the name -<tt>Time2.kid</tt> in the <i>KidKitExamples</i> context: +<tt>Time2.kid</tt> in the <i>KidKitExamples</i> context:</p> <pre class="py"> <?xml version='1.0' encoding='utf-8'?> @@ -214,7 +210,7 @@ the output method for an individual template by setting the variable <tt>output</tt> at the global level. For instance, you could add the following line as first line (before the <tt>html</tt> tag) to the -Kid template above: +Kid template above:</p> <pre class="py"> <?python output='xhtml-strict' ?> @@ -246,8 +242,7 @@ <h2>Credits</h2> <ul> -<li>Kid has been developed by Ryan Tomayko (http://lesscode.org).</li> -<li>ElementTree has been developed by Fredrik Lundh (http://effbot.org).</li> +<li>Kid has been developed by Ryan Tomayko (rtomayko<at>gmail.com).</li> <li>KidKit was contributed to Webware in January 2005 by Winston Wolff (winstonw<at>stratolab.com). The first version was based on the Cheetah servlet factory @@ -257,6 +252,8 @@ The new version is based on the PSP servlet factory. KidKit now supports caching and several configuration parameters for controlling caching, servlet hooks and output methods.</li> +<li>Support for newer Kid versions, particularly output formatting, +added by Christoph Zwerschke in March 2007.</li> </ul> <% footer() %> \ No newline at end of file Modified: Webware/trunk/KidKit/Examples/Main.py ============================================================================== --- Webware/trunk/KidKit/Examples/Main.py (original) +++ Webware/trunk/KidKit/Examples/Main.py Sun Mar 18 14:49:05 2007 @@ -13,10 +13,4 @@ def writeContent(self): self.writeln('''<h4 style="color:red">Kid templates not installed.</h4> <p>The KidKit plug-in is based on the <tt>kid</tt> package available at -<a href="http://kid.lesscode.org">kid.lesscode.org</a>.</p> -<p>Please note that <tt>kid</tt> in turn requires -the <tt>ElementTree</tt> package available at -<a href="http://effbot.org/downloads/#elementtree">effbot.org/downloads/#elementtree</a>.</p> -<p>You may also want to install the <tt>cElementTree</tt> package from -<a href="http://effbot.org/downloads/#cElementTree">effbot.org/downloads/#cElementTree</a> -in order to enhance the performance.</p>''') +<a href="http://www.kid-templating.org">www.kid-templating.org</a>.</p>''') Modified: Webware/trunk/KidKit/Examples/Welcome.kid ============================================================================== --- Webware/trunk/KidKit/Examples/Welcome.kid (original) +++ Webware/trunk/KidKit/Examples/Welcome.kid Sun Mar 18 14:49:05 2007 @@ -18,7 +18,7 @@ <p>You are currently using Kid version <strong py:content="kid.__version__">(version)</strong>. -See the <a href="http://kid.lesscode.org">Kid homepage</a> +See the <a href="http://www.kid-templating.org">Kid homepage</a> for more information about Kid templates.</p> <h4 style="text-align:center">Here are some examples.</h4> Modified: Webware/trunk/KidKit/KidServletFactory.py ============================================================================== --- Webware/trunk/KidKit/KidServletFactory.py (original) +++ Webware/trunk/KidKit/KidServletFactory.py Sun Mar 18 14:49:05 2007 @@ -1,17 +1,16 @@ """Servlet factory for Kid templates. -This allows you to run kid template files directly from within Webware. +This allows you to run Kid template files directly from within Webware. Compiled templates are cached either along with the templates or in the Cache/KidKit subdirectory of the WebKit working directory. Note that the Kid package itself is not part of Webware; you need to install -it separately. You also need to install the ElementTree package to use Kid. +it separately (see http://www.kid-templating.org for more information). CREDITS: -* Kid has been developed by Ryan Tomayko (http://lesscode.org). -* ElementTree has been developed by Fredrik Lundh (http://effbot.org). +* Kid has been developed by Ryan Tomayko (rtomayko<at>gmail.com). * KidKit was contributed by Winston Wolff (winstonw<at>stratolab.com). Based on the Cheetah servlet factory. No caching, fixed servlet hook. * Improved version contributed by Christoph Zwerschke (cito<at>online.de). @@ -26,8 +25,13 @@ from WebKit.Page import Page defaultHook = Page.respond # the default hook for Kid servlets defaultOutput = 'html' # the default Kid output method +defaultFormat = 'default' # the default Kid output format from kid import load_template, output_methods +try: # output formatting exists in newer Kid versions only + from kid.format import output_formats +except: + output_formats = None from kid.compiler import KidFile from KidKit.Examples.KidExamplePage import KidExamplePage @@ -49,6 +53,14 @@ except: output = defaultOutput assert output in output_methods + if output_formats is None: + format = None + else: + try: + format = module.format + except: + format = defaultFormat + assert format in output_formats class KidServlet(ServletClass): """The base class for a Kid servlet.""" @@ -56,13 +68,18 @@ _module = module _template = module.Template() _output = output + _format = format def writeTemplate(self, *args, **kwargs): self._template.servlet = self response = self._response fragment = response.size() > 0 - self._template.write(self._response, - fragment=fragment, output=output) + if format is None: + self._template.write(self._response, + fragment=fragment, output=output) + else: + self._template.write(self._response, + fragment=fragment, output=output, format=format) setattr(KidServlet, writeMethod, KidServlet.writeTemplate) return KidServlet @@ -76,6 +93,8 @@ setting = application.setting global defaultOutput # the default output method defaultOutput = setting('KidOutputMethod', defaultOutput) + global defaultFormat # the default output format + defaultFormat = setting('KidOutputFormat', defaultFormat) self._cacheTemplates = setting('CacheKidTemplates', True) self._useCache = setting('UseKidKitCache', False) if self._useCache: @@ -111,7 +130,7 @@ map(os.remove, files) def computeClassName(self, pagename): - """Generates a (hopefully) unique class/file name for each Kid file. + """Generate a (hopefully) unique class/file name for each Kid file. Argument: pagename: the path to the Kid template file Returns: a unique name for the class generated fom this Kid file Modified: Webware/trunk/KidKit/Properties.py ============================================================================== --- Webware/trunk/KidKit/Properties.py (original) +++ Webware/trunk/KidKit/Properties.py Sun Mar 18 14:49:05 2007 @@ -4,7 +4,7 @@ docs = [ {'name': "User's Guide", 'file': 'UsersGuide.html'} ] -status = 'alpha' +status = 'beta' requiredPyVersion = (2, 3, 0) @@ -25,9 +25,8 @@ def willRunFunc(): # WebKit doesn't check requiredSoftware yet. So we do so: try: - import imp for soft in requiredSoftware: - imp.find_module(soft['name']) + __import__(soft['name']) except ImportError: success = 0 else: Modified: Webware/trunk/WebKit/Configs/Application.config ============================================================================== --- Webware/trunk/WebKit/Configs/Application.config (original) +++ Webware/trunk/WebKit/Configs/Application.config Sun Mar 18 14:49:05 2007 @@ -62,9 +62,12 @@ # Set to True to clear the PSP cache on disk when the AppServer starts: ClearPSPCacheOnStart = False -# The default output method for Kid. Possible values are: +# The default output method for Kid. Some possible values are: # xml, html, html-strict, xhtml, xhtml-strict KidOutputMethod = 'html' +# The default output format for Kid. Some possible values are: +# default, compact, newlines, pretty, wrap, nice, ugly, named +KidOutputMethod = 'html' # Set to False if you do not want compiled Kid templates to be cached on disk: CacheKidTemplates = True # Set to True if you want to use a separate KidKit file cache for the servlets, |
| Thread | Author | Date |
|---|---|---|
| [Webware-checkins] r6335 - in Webware/trunk: KidKit KidKit/Docs KidKit/Examples WebKit/Configs | <updates@we...> |