<?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>ediaz &#124; iamedu &#187; Python</title>
	<atom:link href="http://ediaz.me/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://ediaz.me</link>
	<description>Technology, Music, Development, Science</description>
	<lastBuildDate>Thu, 03 Jun 2010 23:28:33 +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>Simple python master and slave</title>
		<link>http://ediaz.me/2010/05/simple-python-master-and-slave/</link>
		<comments>http://ediaz.me/2010/05/simple-python-master-and-slave/#comments</comments>
		<pubDate>Sun, 02 May 2010 20:52:55 +0000</pubDate>
		<dc:creator>iamedu</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ediaz.me/?p=222</guid>
		<description><![CDATA[Yesterday I was a little bit playful so I decided to write a simple master/slave application in python.
What it does is send a command string through the socket, the command gets executed on the other end and returns the answer.

?Download localizer.pyimport os
import socket
&#160;
host = &#34;127.0.0.1&#34;
port = 1234
&#160;
def execute&#40;command&#41;:
    result = &#34;&#34;
  [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I was a little bit playful so I decided to write a simple master/slave application in python.</p>
<p>What it does is send a command string through the socket, the command gets executed on the other end and returns the answer.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://ediaz.me/wp-content/plugins/wp-codebox/wp-codebox.php?p=222&amp;download=localizer.py">localizer.py</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2223"><td class="code" id="p222code3"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">socket</span>
&nbsp;
host = <span style="color: #483d8b;">&quot;127.0.0.1&quot;</span>
port = <span style="color: #ff4500;">1234</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> execute<span style="color: black;">&#40;</span>command<span style="color: black;">&#41;</span>:
    result = <span style="color: #483d8b;">&quot;&quot;</span>
    args = command.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot; &quot;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> args<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> == <span style="color: #483d8b;">&quot;cd&quot;</span>:
        <span style="color: #dc143c;">os</span>.<span style="color: black;">chdir</span><span style="color: black;">&#40;</span>args<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #483d8b;">&quot;Dir changed&quot;</span>
    pipe = <span style="color: #dc143c;">os</span>.<span style="color: black;">popen</span><span style="color: black;">&#40;</span>command, <span style="color: #483d8b;">&quot;r&quot;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> pipe.<span style="color: black;">readlines</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
        result += line
    <span style="color: #ff7700;font-weight:bold;">return</span> result
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> get_and_obey<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    s = <span style="color: #dc143c;">socket</span>.<span style="color: #dc143c;">socket</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">socket</span>.<span style="color: black;">AF_INET</span>, <span style="color: #dc143c;">socket</span>.<span style="color: black;">SOCK_STREAM</span><span style="color: black;">&#41;</span>
    s.<span style="color: black;">connect</span><span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>host, port<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #008000;">True</span>:
        command = <span style="color: #483d8b;">&quot;&quot;</span>
        <span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #008000;">True</span>:
            temp = s.<span style="color: black;">recv</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1024</span><span style="color: black;">&#41;</span>
            command += temp
            <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> temp <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>temp<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">1024</span>:
	        <span style="color: #ff7700;font-weight:bold;">break</span>
	<span style="color: #ff7700;font-weight:bold;">if</span> command == <span style="color: #483d8b;">&quot;exit&quot;</span>:
	    <span style="color: #ff7700;font-weight:bold;">break</span>
        result = execute<span style="color: black;">&#40;</span>command<span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> result:
	    result = <span style="color: #483d8b;">&quot;Error with command&quot;</span>
        s.<span style="color: black;">send</span><span style="color: black;">&#40;</span>result<span style="color: black;">&#41;</span>
    s.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
    get_and_obey<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://ediaz.me/wp-content/plugins/wp-codebox/wp-codebox.php?p=222&amp;download=listener.py">listener.py</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2224"><td class="code" id="p222code4"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">socket</span>
&nbsp;
host = <span style="color: #483d8b;">''</span>
port = <span style="color: #ff4500;">1234</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> recv_and_command<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    s = <span style="color: #dc143c;">socket</span>.<span style="color: #dc143c;">socket</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">socket</span>.<span style="color: black;">AF_INET</span>, <span style="color: #dc143c;">socket</span>.<span style="color: black;">SOCK_STREAM</span><span style="color: black;">&#41;</span>
    s.<span style="color: black;">bind</span><span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>host, port<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    s.<span style="color: black;">listen</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
    conn, addr = s.<span style="color: black;">accept</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Receiving and commmanding&quot;</span>, addr
    <span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #008000;">True</span>:
        command = <span style="color: #008000;">raw_input</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;remote&gt;&gt;&quot;</span><span style="color: black;">&#41;</span>
        conn.<span style="color: black;">send</span><span style="color: black;">&#40;</span>command<span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span> command == <span style="color: #483d8b;">&quot;exit&quot;</span>: 
	    <span style="color: #ff7700;font-weight:bold;">break</span>
        result = <span style="color: #483d8b;">&quot;&quot;</span>
        <span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #008000;">True</span>:
            temp = conn.<span style="color: black;">recv</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1024</span><span style="color: black;">&#41;</span>
	    result += temp
	    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> temp <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>temp<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">1024</span>:
	        <span style="color: #ff7700;font-weight:bold;">break</span>
        <span style="color: #ff7700;font-weight:bold;">print</span> result
    s.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
    recv_and_command<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>I want to write a version that uses the http protocol, and maybe someday I&#8217;ll write my own http server <img src='http://ediaz.me/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ediaz.me/2010/05/simple-python-master-and-slave/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ARMYC Simulator</title>
		<link>http://ediaz.me/2010/04/armyc-simulator/</link>
		<comments>http://ediaz.me/2010/04/armyc-simulator/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 21:29:19 +0000</pubDate>
		<dc:creator>iamedu</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[joystick]]></category>
		<category><![CDATA[Objective C]]></category>
		<category><![CDATA[PS3]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Simulator]]></category>

		<guid isPermaLink="false">http://ediaz.me/?p=204</guid>
		<description><![CDATA[This is a very simple video of the ARMYC simulator, the simulator aims to be able to specify special ARM devices
In this case we are simulating three devices:

An internal memory, written in objective C.
An LCD device, written in python.
A joystick driver, written in python.

The interface to the programs is through the memory, and we can [...]]]></description>
			<content:encoded><![CDATA[<p>This is a very simple video of the ARMYC simulator, the simulator aims to be able to specify special ARM devices</p>
<p>In this case we are simulating three devices:</p>
<ul>
<li>An internal memory, written in objective C.</li>
<li>An LCD device, written in python.</li>
<li>A joystick driver, written in python.</li>
</ul>
<p>The interface to the programs is through the memory, and we can add the configuration through a simple file:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p204code7'); return false;">View Code</a> INI</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2047"><td class="code" id="p204code7"><pre class="ini" style="font-family:monospace;"><span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>dataflash0<span style="">&#93;</span></span>
<span style="color: #000099;">lib</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> at91sam9260</span>
<span style="color: #000099;">sym</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> dataflash</span>
<span style="color: #000099;">model</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> objc</span>
<span style="color: #000099;">base</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 0</span>
<span style="color: #000099;">size</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 2097152</span>
&nbsp;
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>control1<span style="">&#93;</span></span>
<span style="color: #000099;">lib</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> at91sam9260</span>
<span style="color: #000099;">sym</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> Control</span>
<span style="color: #000099;">model</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> python</span>
<span style="color: #000099;">base</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 8587830276</span>
<span style="color: #000099;">port</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> /dev/input/js0</span>
&nbsp;
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>lcd<span style="">&#93;</span></span>
<span style="color: #000099;">lib</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> at91sam9260</span>
<span style="color: #000099;">sym</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> LcdMx</span>
<span style="color: #000099;">model</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> python</span>
<span style="color: #000099;">config</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> images.cfg</span>
<span style="color: #000099;">base</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 4294963716</span></pre></td></tr></table></div>

<div align="center"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/B1tc47n0-Qo&amp;hl=en_US&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube.com/v/B1tc47n0-Qo&amp;hl=en_US&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p204code8'); return false;">View Code</a> C</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2048"><td class="code" id="p204code8"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;controller.h&gt;</span>
<span style="color: #339933;">#include &lt;lcd.h&gt;</span>
&nbsp;
<span style="color: #993333;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #993333;">unsigned</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>lcd <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">unsigned</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #0000dd;">4294963716</span><span style="color: #339933;">;</span>
	<span style="color: #993333;">unsigned</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>control1 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">unsigned</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #0000dd;">8587830276</span><span style="color: #339933;">;</span>
	<span style="color: #993333;">unsigned</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>control2 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">unsigned</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #0000dd;">8587830272</span><span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span> i<span style="color: #339933;">;</span>
	<span style="color: #993333;">char</span> id1<span style="color: #339933;">;</span>
	<span style="color: #993333;">char</span> id2<span style="color: #339933;">;</span>
	<span style="color: #993333;">char</span> move1<span style="color: #339933;">;</span>
	<span style="color: #993333;">char</span> move2<span style="color: #339933;">;</span>
	id1 <span style="color: #339933;">=</span> createObject<span style="color: #009900;">&#40;</span>lcd<span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	id2 <span style="color: #339933;">=</span> createObject<span style="color: #009900;">&#40;</span>lcd<span style="color: #339933;">,</span> <span style="color: #0000dd;">2</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	put_char<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'0'</span> <span style="color: #339933;">+</span> id1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	put_char<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	put_char<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'0'</span> <span style="color: #339933;">+</span> id2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	put_char<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		move1 <span style="color: #339933;">=</span> readControl<span style="color: #009900;">&#40;</span>control1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		move2 <span style="color: #339933;">=</span> readControl<span style="color: #009900;">&#40;</span>control2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		put_char<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'0'</span> <span style="color: #339933;">+</span> move1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		put_char<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">' '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		put_char<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'0'</span> <span style="color: #339933;">+</span> move2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		put_char<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>move1 <span style="color: #339933;">!=</span> <span style="color: #0000dd;">8</span><span style="color: #009900;">&#41;</span>
			move<span style="color: #009900;">&#40;</span>lcd<span style="color: #339933;">,</span> id1<span style="color: #339933;">,</span> readControl<span style="color: #009900;">&#40;</span>control1<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>move2 <span style="color: #339933;">!=</span> <span style="color: #0000dd;">8</span><span style="color: #009900;">&#41;</span>
			move<span style="color: #009900;">&#40;</span>lcd<span style="color: #339933;">,</span> id2<span style="color: #339933;">,</span> readControl<span style="color: #009900;">&#40;</span>control2<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>If you are interested in the project you can find info <a href="http://code.google.com/p/armycreator">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ediaz.me/2010/04/armyc-simulator/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>repoze.bfg on a standard java webapp</title>
		<link>http://ediaz.me/2010/01/repoze-bfg-on-a-standard-java-webapp/</link>
		<comments>http://ediaz.me/2010/01/repoze-bfg-on-a-standard-java-webapp/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 14:49:09 +0000</pubDate>
		<dc:creator>iamedu</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[repoze.bfg]]></category>

		<guid isPermaLink="false">http://ediaz.me/?p=149</guid>
		<description><![CDATA[Ok thanks to Chris McDonough and the repoze community things are now much easier than they were on my last post, in this one I&#8217;ll explain how to install repoze.bfg with the jinja2 templating environment, and after that how to use it inside your java webapp, this is very interesting because you can use any [...]]]></description>
			<content:encoded><![CDATA[<p>Ok thanks to Chris McDonough and the repoze community things are now much easier than they were on my <a href="http://ediaz.me/2010/01/repoze-bfg-on-jython-2-5/">last post</a>, in this one I&#8217;ll explain how to install repoze.bfg with the jinja2 templating environment, and after that how to use it inside your java webapp, this is very interesting because you can use any resource from your application server from bfg!! how cool is that?</p>
<p>Ok, so first set up your virtualenv you can check how to do that on my last post if you don&#8217;t know (just follow it up to the &#8220;source sys/bin/activate&#8221;) command.</p>
<p>Now there are two ways to install repoze.bfg, the first one is:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p149code16'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p14916"><td class="code" id="p149code16"><pre class="bash" style="font-family:monospace;">easy_install <span style="color: #660033;">-i</span> http:<span style="color: #000000; font-weight: bold;">//</span>dist.repoze.org<span style="color: #000000; font-weight: bold;">/</span>bfg<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.2</span><span style="color: #000000; font-weight: bold;">/</span>simple repoze.bfg.jinja2</pre></td></tr></table></div>

<p>and the second one is to install it from <a href="http://pypi.python.org/pypi">pypi</a> which is almost the same:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p149code17'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p14917"><td class="code" id="p149code17"><pre class="bash" style="font-family:monospace;">easy_install repoze.bfg.jinja2</pre></td></tr></table></div>

<p>Cool isn&#8217;t it?</p>
<p>Now to create your repoze.bfg app use paster like this:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p149code18'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p14918"><td class="code" id="p149code18"><pre class="bash" style="font-family:monospace;">paster create <span style="color: #660033;">-t</span> bfg_jinja2_starter bfgapp</pre></td></tr></table></div>

<p>And set it up as a development egg</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p149code19'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p14919"><td class="code" id="p149code19"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> bfgapp
jython setup.py devel</pre></td></tr></table></div>

<p>You can test it if you want, running</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p149code20'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p14920"><td class="code" id="p149code20"><pre class="bash" style="font-family:monospace;">paster serve bfgapp.ini</pre></td></tr></table></div>

<p>And that&#8217;s it!! Much easier isn&#8217;t it?</p>
<p>Now, let&#8217;s look how to put this inside our java webapp, for this we are going to use a WSGI java servlet which is included with jython, it&#8217;s called <a href="http://opensource.xhaus.com/projects/show/modjy">modjy</a>.</p>
<p>First of all copy the jython.jar file inside your WEB-INF/lib directory.</p>
<p>Next add the servlet to your WEB-INF/web.xml file, here is my example web.xml</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p149code21'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p14921"><td class="code" id="p149code21"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;web-app</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;3.0&quot;</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/xml/ns/javaee&quot;</span> <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span> <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;display-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>BFGApp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/display-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>modjy<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.xhaus.modjy.ModjyJServlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>python.home<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/home/iamedu/BFG/sys<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>cache_callables<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>reload_on_mod<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>log_level<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>debug<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>load_site_packages<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>python.executable<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/home/iamedu/BFG/sys/bin/jython<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;load-on-startup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/load-on-startup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>DefaultServlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.catalina.servlets.DefaultServlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>listings<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;load-on-startup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/load-on-startup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>modjy<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>DefaultServlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/static/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;session-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;session-timeout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            30
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/session-timeout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/session-config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/web-app<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Here there are two important initial parameters for the modjy servlet:</p>
<ul>
<li><strong>python.home</strong> This one should point to your virtualenv</li>
<li><strong>python.executable</strong> This one should point to your virtualenv&#8217;s jython executable</li>
</ul>
<p>You can see I also defined a &#8220;default&#8221; servlet, this is because there&#8217;s a problem with the modjy servlet managing static resources, and it&#8217;s probably faster to manage them directly with the default servlet.</p>
<p>Now to make the static resources accessible to the default servlet, just copy them from the templates/static directory in your BFG app to the web directory inside your java webapp, just copy the default.css file and the images directory don&#8217;t copy the whole static directory, unless you want to change your links to something like: &#8220;static/static/default.css&#8221;</p>
<p>Now we just need to add the wrapper between the modjy servlet and bfg, this is quite easy, create an application.py file inside your web directory with the following contents:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p149code22'); return false;">View Code</a> PYTHON</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p14922"><td class="code" id="p149code22"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">site</span>
<span style="color: #ff7700;font-weight:bold;">from</span> repoze.<span style="color: black;">bfg</span>.<span style="color: black;">paster</span> <span style="color: #ff7700;font-weight:bold;">import</span> get_app
&nbsp;
handler = get_app<span style="color: black;">&#40;</span><span style="color: #483d8b;">'/home/iamedu/BFG/MyProject/MyProject.ini'</span>, <span style="color: #483d8b;">'main'</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>And now deploy your app and voila!, you have repoze.bfg on you favorite servlet container, you can call your java classes from bfg as it is running in the same Java VM.</p>
<p>We use import site, because the modjy servlet doesn&#8217;t load site-packages automatically, and it&#8217;s probably a bad idea to write the complete path in the get_app, you should copy it to your webapp&#8217;s web directory and get the current work directory.</p>
<p>If you want to package your bfg app inside your java webapp you can copy it to the web directory, everything inside that directory is also in your pythonpath.</p>
<p>Hope this helps somebody!</p>
]]></content:encoded>
			<wfw:commentRss>http://ediaz.me/2010/01/repoze-bfg-on-a-standard-java-webapp/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>repoze.bfg on jython 2.5</title>
		<link>http://ediaz.me/2010/01/repoze-bfg-on-jython-2-5/</link>
		<comments>http://ediaz.me/2010/01/repoze-bfg-on-jython-2-5/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 04:44:20 +0000</pubDate>
		<dc:creator>iamedu</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[repoze.bfg]]></category>

		<guid isPermaLink="false">http://ediaz.me/?p=120</guid>
		<description><![CDATA[I&#8217;m going to be honest, I don&#8217;t really like Java for the frontend, but it is very widely used and I find it very nice for whatever&#8217;s not the frontend.
There must be a lot of java guys who think the same and there are projects like Groovy and Grails endorsed by Sun,  I was impressed [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to be honest, I don&#8217;t really like Java for the frontend, but it is very widely used and I find it very nice for whatever&#8217;s not the frontend.</p>
<p>There must be a lot of java guys who think the same and there are projects like <a href="http://groovy.codehaus.org/">Groovy</a> and <a href="http://www.grails.org/">Grails</a> endorsed by Sun,  I was impressed to see even a Ruby container in <a href="https://glassfish.dev.java.net/">glassfish v3</a>.</p>
<p>I haven&#8217;t tried ruby yet so I cannot comment on that, and I wanted to try something simple with jython so I decided to try bfg, my first attempts didn&#8217;t work so I asked for help on the bfg developers list, and a loooot of help from Chris McDonough I got it working.</p>
<p>It isn&#8217;t soo nice yet, and zcml configuration doesn&#8217;t work but at least it&#8217;s usable.</p>
<p>Here is how to get it working, since some changes were just made by Chris on the development&#8217;s trunk you need subversion and mercurial to get the repos.</p>
<p>First of all get <a href="http://www.jython.org/">jython</a> I tried this with 2.5.1, it is pretty simple to install it.</p>
<p>Next you need to get setuptools, you can get that from <a href="http://pypi.python.org/pypi/setuptools">pypi</a> make sure to download the source version (the one that ends with .tar.bz2)</p>
<p>To install it uncompress it, get into the directory and run:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p120code33'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12033"><td class="code" id="p120code33"><pre class="bash" style="font-family:monospace;"><span style="color: #800000;">${JYTHONDIR}</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>jython setup.py <span style="color: #c20cb9; font-weight: bold;">install</span></pre></td></tr></table></div>

<p>Since we are going to be testing a lot it&#8217;s better to install virtualenv do it with</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p120code34'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12034"><td class="code" id="p120code34"><pre class="bash" style="font-family:monospace;"><span style="color: #800000;">${JYTHONDIR}</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>easy_install virtualenv</pre></td></tr></table></div>

<p>Now create a folder where you can start working, in this case I&#8217;ll assume it&#8217;s called BFG</p>
<p>Get into the BFG folder and create a virtual env.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p120code35'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12035"><td class="code" id="p120code35"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> BFG
<span style="color: #800000;">${JYTHONDIR}</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>virtualenv <span style="color: #660033;">--no-site-packages</span> sys
<span style="color: #7a0874; font-weight: bold;">source</span> sys<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>activate</pre></td></tr></table></div>

<p>After this you&#8217;ll have you virtualenv&#8217;s jython and easy_install in your path.</p>
<p>It&#8217;s time to download latest versions from repos, and also <a href="http://http://pypi.python.org/packages/source/z/zope.schema/zope.schema-3.5.4.tar.gz">http://pypi.python.org/packages/source/z/zope.schema/zope.schema-3.5.4.tar.gz</a> this from pypi</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p120code36'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12036"><td class="code" id="p120code36"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">co</span> http:<span style="color: #000000; font-weight: bold;">//</span>svn.repoze.org<span style="color: #000000; font-weight: bold;">/</span>repoze.bfg<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span> repoze.bfg
<span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">co</span> http:<span style="color: #000000; font-weight: bold;">//</span>svn.repoze.org<span style="color: #000000; font-weight: bold;">/</span>repoze.bfg.jinja2<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span> repoze.bfg.jinja2
hg clone http:<span style="color: #000000; font-weight: bold;">//</span>dev.pocoo.org<span style="color: #000000; font-weight: bold;">/</span>hg<span style="color: #000000; font-weight: bold;">/</span>jinja2-main jinja2
<span style="color: #c20cb9; font-weight: bold;">tar</span> xfvj zope.schema-3.5.4.tar.gz</pre></td></tr></table></div>

<p>Now we need to change a few things head into the zope.schema-3.5.4 folder and edit this file src/zope/schema/_bootstrapfields.py</p>
<p>In line 31 you should see something like:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p120code37'); return false;">View Code</a> PYTHON</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12037"><td class="code" id="p120code37"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">class</span> ValidatedProperty<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:
&nbsp;
    <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>, name, check=<span style="color: #008000;">None</span><span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>._info = name, check
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__set__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, inst, value<span style="color: black;">&#41;</span>:
        name, check = <span style="color: #008000;">self</span>._info
        <span style="color: #ff7700;font-weight:bold;">if</span> value <span style="color: #66cc66;">!</span>= inst.<span style="color: black;">missing_value</span>:
            <span style="color: #ff7700;font-weight:bold;">if</span> check <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">None</span>:
                check<span style="color: black;">&#40;</span>inst, value<span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">else</span>:
                inst.<span style="color: black;">validate</span><span style="color: black;">&#40;</span>value<span style="color: black;">&#41;</span>
        inst.<span style="color: #0000cd;">__dict__</span><span style="color: black;">&#91;</span>name<span style="color: black;">&#93;</span> = value</pre></td></tr></table></div>

<p>Add a __get__ method like this:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p120code38'); return false;">View Code</a> PYTHON</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12038"><td class="code" id="p120code38"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">class</span> ValidatedProperty<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:
&nbsp;
    <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>, name, check=<span style="color: #008000;">None</span><span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>._info = name, check
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__set__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, inst, value<span style="color: black;">&#41;</span>:
        name, check = <span style="color: #008000;">self</span>._info
        <span style="color: #ff7700;font-weight:bold;">if</span> value <span style="color: #66cc66;">!</span>= inst.<span style="color: black;">missing_value</span>:
            <span style="color: #ff7700;font-weight:bold;">if</span> check <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">None</span>:
                check<span style="color: black;">&#40;</span>inst, value<span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">else</span>:
                inst.<span style="color: black;">validate</span><span style="color: black;">&#40;</span>value<span style="color: black;">&#41;</span>
        inst.<span style="color: #0000cd;">__dict__</span><span style="color: black;">&#91;</span>name<span style="color: black;">&#93;</span> = value
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__get__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, inst, owner<span style="color: black;">&#41;</span>:
        name, check = <span style="color: #008000;">self</span>._info
        <span style="color: #ff7700;font-weight:bold;">return</span> inst.<span style="color: #0000cd;">__dict__</span><span style="color: black;">&#91;</span>name<span style="color: black;">&#93;</span></pre></td></tr></table></div>

<p>Now install zope.schema with:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p120code39'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12039"><td class="code" id="p120code39"><pre class="bash" style="font-family:monospace;">jython setup.py <span style="color: #c20cb9; font-weight: bold;">install</span></pre></td></tr></table></div>

<p>Now get into the jinja2 directory, here you should patch your file with the patch provided below</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p120code40'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12040"><td class="code" id="p120code40"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">patch</span> <span style="color: #660033;">-p1</span> <span style="color: #000000; font-weight: bold;">&amp;</span>lt; jinja2_jython.patch</pre></td></tr></table></div>

<p>Now for install jinja2, repoze.bfg and repoze.bfg.jinja2 in that order, for each package just go into the directory and run:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p120code41'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12041"><td class="code" id="p120code41"><pre class="bash" style="font-family:monospace;"><span style="color: #800000;">${JYTHONDIR}</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>jython setup.py <span style="color: #c20cb9; font-weight: bold;">install</span></pre></td></tr></table></div>

<p>You can create a project with paster now, but it won&#8217;t work right away, because zcml doesn&#8217;t work with jython but you can get it working.</p>
<p>Here is a sample project tweaked to work, just download it and run:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p120code42'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12042"><td class="code" id="p120code42"><pre class="bash" style="font-family:monospace;">paster serve MyProject.ini</pre></td></tr></table></div>

<p>I hope this works for you and that you find it useful</p>
<p><a href="http://ediaz.me/wp-content/uploads/2010/01/MyProject-jython.tar.bz2">MyProject-jython.tar</a></p>
<p><a href="http://ediaz.me/wp-content/uploads/2010/01/jinja2_jython.patch.bz2">jinja2_jython.patch</a></p>
<p><strong>UPDATE </strong>Chris just told me that zope.schema now passes tests under jython, so it&#8217;s no longer necesarry to change the _bootstrapfields.py file.</p>
<p>Another thing, I forgot to mention that you need to run jython setup.py develop with the MyProject egg.</p>
]]></content:encoded>
			<wfw:commentRss>http://ediaz.me/2010/01/repoze-bfg-on-jython-2-5/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mexican States and Municipalities in Python</title>
		<link>http://ediaz.me/2009/12/mexican-states-and-municipalities-in-python/</link>
		<comments>http://ediaz.me/2009/12/mexican-states-and-municipalities-in-python/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 12:00:35 +0000</pubDate>
		<dc:creator>iamedu</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Municipalities]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ediaz.me/?p=47</guid>
		<description><![CDATA[First of all, I want to say I am using a creative commons image with this post, it is from Christian Frausto Bernal go check his pictures, they are pretty good.
Ok, so today I needed to get the mexican states and municipalities to use in some Plone dictionaries, so I got that from the SEPOMEX [...]]]></description>
			<content:encoded><![CDATA[<p>First of all, I want to say I am using a creative commons image with this post, it is from<a href="http://www.flickr.com/photos/cfrausto/"> Christian Frausto Bernal</a> go check his pictures, they are pretty good.</p>
<p>Ok, so today I needed to get the mexican states and municipalities to use in some Plone dictionaries, so I got that from the <a href="http://www.sepomex.gob.mx/">SEPOMEX</a> site.</p>
<p>I processed it a little and I got a very simple python file.</p>
<p>I has two dictionaries, the first one called states has a dictionary of normalized id&#8217;s and names, for example:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p47code46'); return false;">View Code</a> PYTHON</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4746"><td class="code" id="p47code46"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> states <span style="color: #ff7700;font-weight:bold;">import</span> states
<span style="color: #ff7700;font-weight:bold;">print</span> states<span style="color: black;">&#91;</span><span style="color: #483d8b;">'distrito_federal'</span><span style="color: black;">&#93;</span></pre></td></tr></table></div>

<p>and you&#8217;ll get something like:</p>
<p>Distrito Federal</p>
<p>The other dictionary is the one with the municipalities, you can use it like this:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p47code47'); return false;">View Code</a> PYTHON</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4747"><td class="code" id="p47code47"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> states <span style="color: #ff7700;font-weight:bold;">import</span> data
<span style="color: #ff7700;font-weight:bold;">print</span> data<span style="color: black;">&#91;</span><span style="color: #483d8b;">'distrito_federal'</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'miguel_hidalgo'</span><span style="color: black;">&#93;</span></pre></td></tr></table></div>

<p>And you should get something like Miguel Hidalgo.</p>
<p>Of your you can traverse it with something like:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p47code48'); return false;">View Code</a> PYTHON</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4748"><td class="code" id="p47code48"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">for</span> m <span style="color: #ff7700;font-weight:bold;">in</span> data<span style="color: black;">&#91;</span><span style="color: #483d8b;">'distrito_federal'</span><span style="color: black;">&#93;</span>.<span style="color: black;">keys</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> m</pre></td></tr></table></div>

<p>That way you can get every municipality key.</p>
<p>And of course you know.. it&#8217;s python and it should be pretty simple to convert it to mysql, csv, or another format you might be using..</p>
<p>So have fun!</p>
<p>If you think that might be helpful you can download it here:</p>
<p><a href="http://ediaz.me/wp-content/uploads/2009/12/states.py_.bz2">Mexican States and Municipalities</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ediaz.me/2009/12/mexican-states-and-municipalities-in-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create Content from Debug Shell</title>
		<link>http://ediaz.me/2009/12/create-content-from-cms-shell/</link>
		<comments>http://ediaz.me/2009/12/create-content-from-cms-shell/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 17:29:22 +0000</pubDate>
		<dc:creator>iamedu</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[Plone]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ediaz.me/?p=20</guid>
		<description><![CDATA[Maybe you knew this, but I just found out and I had to write it… otherwise I’ll forget it.
First start a plone instance in debug mode:



$ bin/instance debug


Starting debugger (the name &#8220;app&#8221; is bound to the top-level Zope object)



Now you have your python shell to play!
First of all you need a user, so let’s try [...]]]></description>
			<content:encoded><![CDATA[<p>Maybe you knew this, but I just found out and I had to write it… otherwise I’ll forget it.</p>
<p>First start a plone instance in <strong>debug</strong> mode:</p>
<div>
<ol>
<li>
<div>$ bin/instance <strong>debug</strong></div>
</li>
<li>
<div>Starting debugger <span>(</span>the name <span>&#8220;app&#8221;</span> is bound to the top-level Zope object<span>)</span></div>
</li>
</ol>
</div>
<p>Now you have your python <strong>shell</strong> to play!<br />
First of all you need a user, so let’s try the admin user:</p>
<div>
<ol>
<li>
<div><span>from</span> AccessControl.<span>SecurityManagement</span> <span>import</span> newSecurityManager</div>
</li>
<li>
<div><span>user</span> = app.<span>acl_users</span>.<span>authenticate</span><span>(</span><span>&#8220;admin&#8221;</span>, <span>&#8220;admin&#8221;</span>, <span>None</span><span>)</span></div>
</li>
<li>
<div>newSecurityManager<span>(</span><span>None</span>, <span>user</span><span>)</span></div>
</li>
</ol>
</div>
<p>As you probably guessed the first “admin” is the username, and the second one the password.<br />
OK, now we have enough permissions to create our content let’s move on, imagine you have a<br />
plone site called “development” and a folder called “test” in it.</p>
<div>
<ol>
<li>
<div>container = app.<span>development</span>.<span>test</span></div>
</li>
<li>
<div><span>id</span> = container.<span>invokeFactory</span><span>(</span>type_name=<span>&#8220;News Item&#8221;</span>, <span>id</span>=<span>‘new-news’</span><span>)</span></div>
</li>
<li>
<div>obj = container<span>[</span><span>id</span><span>]</span></div>
</li>
<li>
<div>obj.<span>setTitle</span><span>(</span><span>‘This is my dumb test’</span><span>)</span></div>
</li>
<li>
<div><span>import</span> transaction</div>
</li>
<li>
<div>transaction.<span>commit</span><span>(</span><span>)</span></div>
</li>
<li>
<div>app._p_jar.<span>sync</span><span>(</span><span>)</span></div>
</li>
</ol>
</div>
<p>Now you can go into your plone site, and you’ll have the new news, if you can’t see them try going to:</p>
<p>http://localhost:8080/development/test/new-news</p>
<p>Remember changing the url according to your own.</p>
<p>Hope this helps someone</p>
]]></content:encoded>
			<wfw:commentRss>http://ediaz.me/2009/12/create-content-from-cms-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
