<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4677977692529614434</id><updated>2011-11-27T16:17:26.734-08:00</updated><category term='pygtk'/><category term='widget enable'/><category term='timezone'/><category term='format'/><category term='widget disable'/><category term='date'/><category term='python'/><category term='sensible'/><category term='filter'/><category term='convert'/><category term='time'/><title type='text'>My Log on Python/Django</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://pythonlog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4677977692529614434/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://pythonlog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Tamonash Roy</name><uri>http://www.blogger.com/profile/17446229210198363245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4677977692529614434.post-6185142453018081713</id><published>2009-07-14T10:57:00.000-07:00</published><updated>2009-07-14T11:12:16.464-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='widget disable'/><category scheme='http://www.blogger.com/atom/ns#' term='sensible'/><category scheme='http://www.blogger.com/atom/ns#' term='widget enable'/><category scheme='http://www.blogger.com/atom/ns#' term='pygtk'/><title type='text'>Make widgets Enable and/or Disable in pygtk</title><content type='html'>Many a times while you are working pygtk, You would like to make some widgets like buttons, checkboxes etc etc.. to be disabled for a action to complete, And again would like to enable it, after the action is complete. This simple function is all you would need to accomplish this.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;def make_sensitive(state, widget_list):&lt;br /&gt; """ &lt;br /&gt; Author: Tamonash Roy&lt;br /&gt; ------------------------&lt;br /&gt; Enables/disables widgets&lt;br /&gt; ------------------------&lt;br /&gt; state: either True or False, True to Enable, False to Disable&lt;br /&gt; widget_list: A list of widgets that you want to enable or disable collectively.&lt;br /&gt; """&lt;br /&gt; s = state and 1 or 0&lt;br /&gt; for w in widget_list:&lt;br /&gt;  w.set_sensitive(s)&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4677977692529614434-6185142453018081713?l=pythonlog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pythonlog.blogspot.com/feeds/6185142453018081713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4677977692529614434&amp;postID=6185142453018081713' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4677977692529614434/posts/default/6185142453018081713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4677977692529614434/posts/default/6185142453018081713'/><link rel='alternate' type='text/html' href='http://pythonlog.blogspot.com/2009/07/make-widgets-enable-andor-disable-in.html' title='Make widgets Enable and/or Disable in pygtk'/><author><name>Tamonash Roy</name><uri>http://www.blogger.com/profile/17446229210198363245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4677977692529614434.post-7062051281865339658</id><published>2009-03-26T00:36:00.000-07:00</published><updated>2009-07-14T11:16:13.540-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='timezone'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='convert'/><title type='text'>Convert time zone from US to India</title><content type='html'>This shows the steps to convert time zones from EST to IST&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&gt;&gt;&gt; from datetime import datetime&lt;br /&gt;&gt;&gt;&gt; from pytz import timezone&lt;br /&gt;&gt;&gt;&gt; us_tz = timezone("US/Eastern")&lt;br /&gt;&gt;&gt;&gt; in_tz = timezone("Asia/Calcutta")&lt;br /&gt;&gt;&gt;&gt; now = datetime.now()&lt;br /&gt;&gt;&gt;&gt; dt_in = in_tz.localize(now)&lt;br /&gt;&gt;&gt;&gt; dt_us = dt_in.astimezone(us_tz)&lt;br /&gt;&gt;&gt;&gt; dt_in&lt;br /&gt;datetime.datetime(2009, 3, 26, 12, 58, 17, 909000, tzinfo=&lt;DstTzInfo 'Asia/Calcutta'IST+5:30:00 STD&gt;)&lt;br /&gt;&gt;&gt;&gt; dt_us&lt;br /&gt;datetime.datetime(2009, 3, 26, 3, 28, 17, 909000, tzinfo=&lt;DstTzInfo 'US/Eastern' EDT-1 day, 20:00:00 DST&gt;)&lt;br /&gt;&gt;&gt;&gt; dt_in.year&lt;br /&gt;2009&lt;br /&gt;&gt;&gt;&gt; dt_in.month&lt;br /&gt;3&lt;br /&gt;&gt;&gt;&gt; datetime.weekday(dt_in)&lt;br /&gt;3&lt;br /&gt;&gt;&gt;&gt; dt_in.hour&lt;br /&gt;12&lt;br /&gt;&gt;&gt;&gt; dt_in.minute&lt;br /&gt;58&lt;br /&gt;&gt;&gt;&gt; dt_in.second&lt;br /&gt;17&lt;br /&gt;&gt;&gt;&gt;&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4677977692529614434-7062051281865339658?l=pythonlog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pythonlog.blogspot.com/feeds/7062051281865339658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4677977692529614434&amp;postID=7062051281865339658' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4677977692529614434/posts/default/7062051281865339658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4677977692529614434/posts/default/7062051281865339658'/><link rel='alternate' type='text/html' href='http://pythonlog.blogspot.com/2009/03/convert-time-zone-from-us-to-india.html' title='Convert time zone from US to India'/><author><name>Tamonash Roy</name><uri>http://www.blogger.com/profile/17446229210198363245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4677977692529614434.post-3191214867728087574</id><published>2008-10-03T03:57:00.001-07:00</published><updated>2008-10-03T03:57:57.331-07:00</updated><title type='text'>What is a Slug?</title><content type='html'>SlugField&lt;br /&gt;"Slug" is a newspaper term. A slug is a short label for something, containing only letters, numbers, underscores or hyphens. They're generally used in URLs.&lt;br /&gt;&lt;br /&gt;Implies maxlength=50 and db_index=True.&lt;br /&gt;&lt;br /&gt;Accepts an extra option, prepopulate_from, which is a list of fields from which to auto-populate the slug, via JavaScript, in the object's admin form:&lt;br /&gt;&lt;br /&gt;meta.SlugField(prepopulate_from=("pre_name", "name"))&lt;br /&gt;prepopulate_from doesn't accept DateTimeFields.&lt;br /&gt;&lt;br /&gt;The admin represents SlugField as an &lt;input type="text"&gt; (a single-line input).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4677977692529614434-3191214867728087574?l=pythonlog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pythonlog.blogspot.com/feeds/3191214867728087574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4677977692529614434&amp;postID=3191214867728087574' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4677977692529614434/posts/default/3191214867728087574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4677977692529614434/posts/default/3191214867728087574'/><link rel='alternate' type='text/html' href='http://pythonlog.blogspot.com/2008/10/what-is-slug.html' title='What is a Slug?'/><author><name>Tamonash Roy</name><uri>http://www.blogger.com/profile/17446229210198363245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4677977692529614434.post-3476239967624797051</id><published>2008-09-30T06:04:00.000-07:00</published><updated>2008-09-30T06:08:01.503-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='filter'/><category scheme='http://www.blogger.com/atom/ns#' term='date'/><title type='text'>The date filter in template</title><content type='html'>Template use:&lt;br /&gt;{{ article.pub_date|date:"F j, Y" }}&lt;br /&gt;&lt;br /&gt;&lt;a href = "http://docs.djangoproject.com/en/dev/intro/overview/?from=olddocs#design-your-templates"&gt;http://docs.djangoproject.com/en/dev/intro/overview/?from=olddocs#design-your-templates&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;PHP reference for formating can be fount in&lt;br /&gt;&lt;a href="http://php.about.com/od/learnphp/ss/php_functions_3.htm"&gt;http://php.about.com/od/learnphp/ss/php_functions_3.htm&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4677977692529614434-3476239967624797051?l=pythonlog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pythonlog.blogspot.com/feeds/3476239967624797051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4677977692529614434&amp;postID=3476239967624797051' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4677977692529614434/posts/default/3476239967624797051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4677977692529614434/posts/default/3476239967624797051'/><link rel='alternate' type='text/html' href='http://pythonlog.blogspot.com/2008/09/date-filter-in-template.html' title='The date filter in template'/><author><name>Tamonash Roy</name><uri>http://www.blogger.com/profile/17446229210198363245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4677977692529614434.post-2992442768205388834</id><published>2008-09-30T05:53:00.000-07:00</published><updated>2008-09-30T05:55:34.540-07:00</updated><title type='text'>getattr()</title><content type='html'>Python’s getattr function is used to fetch an attribute from an object, using a string object instead of an identifier to identify the attribute. In other words, the following two statements are equivalent:&lt;br /&gt;&lt;br /&gt;value = obj.attribute&lt;br /&gt;value = getattr(obj, "attribute")&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The function takes an optional default value, which is used if the attribute doesn’t exist. The following example only calls the method if it exists:&lt;br /&gt;&lt;br /&gt;func = getattr(obj, "method", None)&lt;br /&gt;if func:&lt;br /&gt;    func(args)&lt;br /&gt;&lt;br /&gt;http://effbot.org/zone/python-getattr.htm&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4677977692529614434-2992442768205388834?l=pythonlog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pythonlog.blogspot.com/feeds/2992442768205388834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4677977692529614434&amp;postID=2992442768205388834' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4677977692529614434/posts/default/2992442768205388834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4677977692529614434/posts/default/2992442768205388834'/><link rel='alternate' type='text/html' href='http://pythonlog.blogspot.com/2008/09/getattr.html' title='getattr()'/><author><name>Tamonash Roy</name><uri>http://www.blogger.com/profile/17446229210198363245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4677977692529614434.post-8612056832224800799</id><published>2008-09-30T04:43:00.000-07:00</published><updated>2008-09-30T05:53:21.970-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='format'/><category scheme='http://www.blogger.com/atom/ns#' term='time'/><category scheme='http://www.blogger.com/atom/ns#' term='date'/><title type='text'>format strings for datetime strftime</title><content type='html'>The Information on formating of date is available &lt;a href=http://docs.python.org/lib/module-time.html&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4677977692529614434-8612056832224800799?l=pythonlog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pythonlog.blogspot.com/feeds/8612056832224800799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4677977692529614434&amp;postID=8612056832224800799' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4677977692529614434/posts/default/8612056832224800799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4677977692529614434/posts/default/8612056832224800799'/><link rel='alternate' type='text/html' href='http://pythonlog.blogspot.com/2008/09/format-strings-for-datetime-strftime.html' title='format strings for datetime strftime'/><author><name>Tamonash Roy</name><uri>http://www.blogger.com/profile/17446229210198363245</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
