<?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>Riders Of The Bit &#187; Zope/Plone</title>
	<atom:link href="http://www.ridersofthebit.net/blog/index.php/category/zopeplone/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ridersofthebit.net/blog</link>
	<description>a blog by Oscar Sánchez, now available version 3.2</description>
	<lastBuildDate>Fri, 06 Aug 2010 14:10:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Publishing objects from Zope&#8217;s products</title>
		<link>http://www.ridersofthebit.net/blog/index.php/2008/04/20/publishing-objects-from-zopes-products/</link>
		<comments>http://www.ridersofthebit.net/blog/index.php/2008/04/20/publishing-objects-from-zopes-products/#comments</comments>
		<pubDate>Sun, 20 Apr 2008 11:14:57 +0000</pubDate>
		<dc:creator>ocell</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Internet Technologies]]></category>
		<category><![CDATA[Middleware]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Zope/Plone]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[zope]]></category>
		<category><![CDATA[zpt]]></category>

		<guid isPermaLink="false">http://www.ridersofthebit.net/blog/?p=36</guid>
		<description><![CDATA[Creating Zope homemade products is the best way to developing Python web applications without depending (if you don&#8217;t want) from Plone. Until last wednesday, I had tried some methods to manage Python&#8217;s objects directly from ZPT pages but didn&#8217;t work. Other problem with Zope is the documentation and the community, there are too few documentation, [...]]]></description>
			<content:encoded><![CDATA[<p>Creating Zope homemade products is the best way to developing Python web applications without depending (if you don&#8217;t want) from Plone. Until last wednesday, I had tried some methods to manage Python&#8217;s objects directly from ZPT pages but didn&#8217;t work. Other problem with Zope is the documentation and the community, there are too few documentation, and the community of users/developers is too small (for Plone is bigger). Past wednesday my colleague Xavier finds a way to publishing Python&#8217;s object directly in a ZPT, when he was following an error log to solve an occurred error. The way is a KISS (<em>Keep It Simple and Stupid</em>) way. Every object in the application that you wants to publish, is mandatory that the object inherits from <strong>OFS.SimpleItem</strong>, and the object can be used from a ZPT, calling its methods and properties. This is very important for us because we are developing some Zope web applications, and we need a way to design, develops and testing the applications. Now with this discovering we can organize an application like an Object Oriented application without any method/module to pass data through the main core and the ZPT. And this can help us to use PyUnit or homemade scripts to testing the application and do it independent to the presentation layer.</p>
<p>e.g.: Python Class inherited from OSF.SimpleItem</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">##OurObject.py</span>
<span style="color: #808080; font-style: italic;"># -*- coding: latin-1 -*-</span>
<span style="color: #ff7700;font-weight:bold;">import</span> OFS.<span style="color: black;">SimpleItem</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> OurObject<span style="color: black;">&#40;</span>OFS.<span style="color: black;">SimpleItem</span>.<span style="color: black;">SimpleItem</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, <span style="color: #008000;">id</span> = <span style="color: #483d8b;">''</span>, description = <span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>.<span style="color: #008000;">id</span> = <span style="color: #008000;">id</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">description</span> = description</pre></td></tr></table></div>

<p>e.g.: Calling object inside a ZPT</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>29
30
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h1</span> <span style="color: #000066;">tal:content</span>=<span style="color: #ff0000;">&quot;myInstance/id&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/h1<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">tal:attributes</span>=<span style="color: #ff0000;">&quot;value myInstance/description&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.ridersofthebit.net/blog/index.php/2008/04/20/publishing-objects-from-zopes-products/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
