<?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>snipeworld.com &#187; Pylons</title>
	<atom:link href="http://snipeworld.com/category/python/pylons-python/feed/" rel="self" type="application/rss+xml" />
	<link>http://snipeworld.com</link>
	<description>The right man in the right place</description>
	<lastBuildDate>Mon, 28 Jun 2010 05:51:55 +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>How to write and read array from cookie in Pylons</title>
		<link>http://snipeworld.com/2009/05/05/how-to-write-and-read-cookie-in-pylons/</link>
		<comments>http://snipeworld.com/2009/05/05/how-to-write-and-read-cookie-in-pylons/#comments</comments>
		<pubDate>Tue, 05 May 2009 08:04:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Pylons]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[cookies]]></category>
		<category><![CDATA[pylons]]></category>

		<guid isPermaLink="false">http://snipeworld.com/?p=68</guid>
		<description><![CDATA[How to write and read array from cookies ?
The easiest way to write an array in cookie is serialize it using pickle module and quote returned string with urllib module. For example:
import pickle, urllib
cookie = []
response.set_cookie('some_cookie', urllib.quote(pickle.dumps(cookie)))
And getting an array from cookie:
cookie = pickle.loads(str(urllib.unquote(request.cookies['some_cookie'])))

]]></description>
			<content:encoded><![CDATA[<p>How to write and read array from cookies ?</p>
<p>The easiest way to write an array in cookie is serialize it using pickle module and quote returned string with urllib module. For example:</p>
<pre>import pickle, urllib
cookie = []
response.set_cookie('some_cookie', urllib.quote(pickle.dumps(cookie)))</pre>
<p>And getting an array from cookie:</p>
<pre>cookie = pickle.loads(str(urllib.unquote(request.cookies['some_cookie'])))</pre>
<p><img id="kosa-target-image" style="position: absolute; visibility: hidden; z-index: 2147483647; left: 283px; top: 55px;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAUCAYAAACJfM0wAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAAB90RVh0U29mdHdhcmUATWFjcm9tZWRpYSBGaXJld29ya3MgOLVo0ngAAAAWdEVYdENyZWF0aW9uIFRpbWUAMDQvMDQvMDhrK9wWAAACA0lEQVQ4jbXVz0sUYRjA8e+u6xqlKJUaBZuUh6AfhyCEpUN/QIR0skMh6iHwsKe6lFu4HjpJhy5BS1CsZtDSrYMYdPHUZauDbhcpi7bEH2DOtjvP83aY3dFxxi1hfeAd3nlhPu/zPjPvOyHgKnsQEQDz60kaaKuTuRpqHxqMAKBWvVCoJOjAxqqj60Q1Y3fg05dWki/OMjt3+L+A+KklRvs+cia2VhtOTsYpN5wgl4nReTCM6s7o96UyA6kFkpNK9tZMEFx0B2bnO8hlYky/L5N9V2TDsinbgohi207fFqGxwZDoO0T67nEu9FseAyAMODWuNqC9LczUTBGrKIgqqgYRQdSgqogovy2b8YkCxzqiBBlOxuJ/earqIqqKbMfVsLYuGGMIMnb8KkTUk60HNwapTOqGCYLVDzdGDH9Km1mKiDOBMe4qmqJbl+g1wu5gtQGFZWHw8gFam/GXoILubwpxf+go336WCDJ8pYh35xkYayZ9J8aVi52+lZgt18VCif7RBeLd+X+XItX7nJHXyvkb6wD8eHOOqekVEuNffZM4icyR6s34SuGDTx/Jk715D4CTIy959XaFB0/n+Tw2TMu+jUDcMby3vg2yPW4/WuTxtYe0RJd9D9eKmodQT1eOxKVn9HR9qJZ1l3DABgGYuD7sdGR36CZsrFXqeNADhNijX9NfAyI+Sz1Sug0AAAAASUVORK5CYII=" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://snipeworld.com/2009/05/05/how-to-write-and-read-cookie-in-pylons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The easiest way to modify response headers in Pylons</title>
		<link>http://snipeworld.com/2009/04/24/the-easiest-way-to-modify-response-headers-in-pylons/</link>
		<comments>http://snipeworld.com/2009/04/24/the-easiest-way-to-modify-response-headers-in-pylons/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 11:40:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Pylons]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[headers]]></category>
		<category><![CDATA[pylons]]></category>

		<guid isPermaLink="false">http://snipeworld.com/?p=66</guid>
		<description><![CDATA[Remember the trick!
The easiest way to modify response headers in Pylons is add:
response.headerlist = [('Content-type', 'image/png')]
just before render() function.
]]></description>
			<content:encoded><![CDATA[<p>Remember the trick!</p>
<p>The easiest way to modify response headers in Pylons is add:</p>
<pre>response.headerlist = [('Content-type', 'image/png')]</pre>
<p>just before render() function.</p>
]]></content:encoded>
			<wfw:commentRss>http://snipeworld.com/2009/04/24/the-easiest-way-to-modify-response-headers-in-pylons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple solution &#8211; how to use own decorators in Pylons actions</title>
		<link>http://snipeworld.com/2009/04/09/decorators-in-pylons-actions/</link>
		<comments>http://snipeworld.com/2009/04/09/decorators-in-pylons-actions/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 10:55:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Pylons]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[pylons]]></category>

		<guid isPermaLink="false">http://snipeworld.com/?p=62</guid>
		<description><![CDATA[This is a simple solution to create own decorator function for any action in Pylons.
First, you have to import some functions:
from decorator import decorator
from pylons.decorators.util import get_pylons # to get request environment
Now create decorator function, for example myowndecorator:
def myowndecorator():
    def wrapper(func, *args, **kwargs):
        request = [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple solution to create own decorator function for any action in Pylons.</p>
<p>First, you have to import some functions:</p>
<pre>from decorator import decorator
from pylons.decorators.util import get_pylons # to get request environment</pre>
<p>Now create decorator function, for example myowndecorator:</p>
<pre>def myowndecorator():
    def wrapper(func, *args, **kwargs):
        request = get_pylons(args).request # use it for any operation with request
        # do something
        return func(*args, **kwargs)
    return decorator(wrapper)</pre>
<p>Save it in your project lib directory as mylib.py.</p>
<p>In last step you have to import function from you library, and use decorator in your controller:</p>
<pre>from myproject.lib.mylib import myowndecorator

class PanelController(BaseController):
    @myowndecorator()
    def index(self):
        return render('/panel/index.mako')</pre>
]]></content:encoded>
			<wfw:commentRss>http://snipeworld.com/2009/04/09/decorators-in-pylons-actions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
