<?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>AxiaCore Blog</title>
	<atom:link href="http://axiacore.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://axiacore.com/blog</link>
	<description>Implementamos tecnologia y es asi como lo hacemos</description>
	<lastBuildDate>Fri, 29 Jan 2010 17:22:40 +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>Paginacion en Django estilo Digg</title>
		<link>http://axiacore.com/blog/2010/01/paginacion-en-django-estilo-digg/</link>
		<comments>http://axiacore.com/blog/2010/01/paginacion-en-django-estilo-digg/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 17:20:57 +0000</pubDate>
		<dc:creator>Camilo Nova</dc:creator>
				<category><![CDATA[AxiaCore]]></category>
		<category><![CDATA[Codigo Fuente]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://axiacore.com/blog/?p=800</guid>
		<description><![CDATA[La Paginación en django es excelente, permite una flexibilidad importante para solucionar muchos problemas que se presentan al paginar resultados, por ejemplo el problema del cacheo, que se presenta al realizar una consulta que pide todos los datos sabiendo que solo vamos a mostrar unos pocos.
Gracias a la excelente documentación podemos encontrar toda la información [...]]]></description>
			<content:encoded><![CDATA[<p>La Paginación en django es excelente, permite una flexibilidad importante para solucionar muchos problemas que se presentan al paginar resultados, por ejemplo el problema del cacheo, que se presenta al realizar una consulta que pide todos los datos sabiendo que solo vamos a mostrar unos pocos.</p>
<p>Gracias a la excelente documentación podemos encontrar toda la información aquí: <a href="http://docs.djangoproject.com/en/1.1/topics/pagination/#topics-pagination">http://docs.djangoproject.com/en/1.1/topics/pagination/#topics-pagination</a></p>
<p>Sin embargo, cuando se trabajan volúmenes grandes de información, digamos mas de 50 paginas, se hace dispendioso pasar entre paginas hasta llegar a la que buscamos, por eso es muy útil tener una paginación al estilo Digg que muestra algunas paginas adicionales y no solo el enlace a la anterior y la siguiente.</p>
<p>Tomando como base este excelente trabajo: <a href="http://krisje8.com/blog/2009/jul/02/django-pagination-template-tag-digg-style/ ">http://krisje8.com/blog/2009/jul/02/django-pagination-template-tag-digg-style/ </a>realice algunas modificaciones para que muestre &#8216;&#8230;&#8217; entre las paginas iniciales y la pagina actual, para darle una mejor ubicación al usuario sobre donde se encuentra.</p>
<p>Tenemos el siguiente <a href="http://docs.djangoproject.com/en/dev/howto/custom-template-tags/">template_tag</a>:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#! /usr/bin/env python</span>
<span style="color: #808080; font-style: italic;"># -*- coding: utf8 -*-</span>
<span style="color: #808080; font-style: italic;"># render_paginator.py</span>
<span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">template</span> <span style="color: #ff7700;font-weight:bold;">import</span> Library
&nbsp;
register = Library<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> render_paginator<span style="color: black;">&#40;</span>context, first_last_amount=<span style="color: #ff4500;">2</span>, before_after_amount=<span style="color: #ff4500;">4</span><span style="color: black;">&#41;</span>:
    page_obj = context<span style="color: black;">&#91;</span><span style="color: #483d8b;">'page_obj'</span><span style="color: black;">&#93;</span>
    paginator = context<span style="color: black;">&#91;</span><span style="color: #483d8b;">'paginator'</span><span style="color: black;">&#93;</span>
    page_numbers = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;"># Pages before current page</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> page_obj.<span style="color: black;">number</span> <span style="color: #66cc66;">&gt;</span> first_last_amount + before_after_amount:
        <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>, first_last_amount + <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>:
            page_numbers.<span style="color: black;">append</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span>
&nbsp;
        page_numbers.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #008000;">None</span><span style="color: black;">&#41;</span>
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span>page_obj.<span style="color: black;">number</span> - before_after_amount, page_obj.<span style="color: black;">number</span><span style="color: black;">&#41;</span>:
            page_numbers.<span style="color: black;">append</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>, page_obj.<span style="color: black;">number</span><span style="color: black;">&#41;</span>:
            page_numbers.<span style="color: black;">append</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;"># Current page and pages after current page</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> page_obj.<span style="color: black;">number</span> + first_last_amount + before_after_amount <span style="color: #66cc66;">&lt;</span> paginator.<span style="color: black;">num_pages</span>:
        <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span>page_obj.<span style="color: black;">number</span>, page_obj.<span style="color: black;">number</span> + before_after_amount + <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>:
            page_numbers.<span style="color: black;">append</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span>
&nbsp;
        page_numbers.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #008000;">None</span><span style="color: black;">&#41;</span>
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span>paginator.<span style="color: black;">num_pages</span> - first_last_amount + <span style="color: #ff4500;">1</span>, paginator.<span style="color: black;">num_pages</span> + <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>:
            page_numbers.<span style="color: black;">append</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span>page_obj.<span style="color: black;">number</span>, paginator.<span style="color: black;">num_pages</span> + <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>:
            page_numbers.<span style="color: black;">append</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: black;">&#123;</span>
        <span style="color: #483d8b;">'paginator'</span>: paginator,
        <span style="color: #483d8b;">'page_obj'</span>: page_obj,
        <span style="color: #483d8b;">'page_numbers'</span>: page_numbers
    <span style="color: black;">&#125;</span>
&nbsp;
register.<span style="color: black;">inclusion_tag</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'layout/pagination.html'</span>, takes_context=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span><span style="color: black;">&#40;</span>render_paginator<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Con la siguiente plantilla:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">{% if page_obj.has_previous %}
  &lt;a href=&quot;?page={{ page_obj.previous_page_number }}&quot;&gt;Previous&lt;/a&gt;
{% endif %}
{% for page in page_numbers %}
  {% if page %}
    {% ifequal page page_obj.number %}
      &lt;b&gt;{{ page }}&lt;/b&gt;
    {% else %}
      &lt;a href=&quot;?page={{ page }}&quot;&gt;{{ page }}&lt;/a&gt;
    {% endifequal %}
  {% else %}
    ...
  {% endif %}
{% endfor %}
{% if page_obj.has_next %}
  &lt;a href=&quot;?page={{ page_obj.next_page_number }}&quot;&gt;Next&lt;/a&gt;
{% endif %}</pre></td></tr></table></div>

<p>Para usarlo se coloca el siguiente codigo en cualquiera de las plantillas que queramos paginar:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">    {% if is_paginated %}
      {% load render_paginator %}
      {% render_paginator 2 3 %}
    {% endif %}</pre></td></tr></table></div>

<p>Lo que genera un código como:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">Previous  1  2  ... 5  6  7  8  9  10  11  ... 25  26  Next</pre></td></tr></table></div>

<p>Lo mejor de todo es que no necesita ningún componente adicional ni interfiere con la paginación por defecto que traen las vistas genéricas en django.</p>
]]></content:encoded>
			<wfw:commentRss>http://axiacore.com/blog/2010/01/paginacion-en-django-estilo-digg/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Trabajar para vivir</title>
		<link>http://axiacore.com/blog/2010/01/trabajar-para-vivir/</link>
		<comments>http://axiacore.com/blog/2010/01/trabajar-para-vivir/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 01:35:51 +0000</pubDate>
		<dc:creator>Camilo Nova</dc:creator>
				<category><![CDATA[AxiaCore]]></category>
		<category><![CDATA[Futbol]]></category>
		<category><![CDATA[Trabajar]]></category>

		<guid isPermaLink="false">http://axiacore.com/blog/?p=795</guid>
		<description><![CDATA[y no vivir para trabajar&#8230;

Gracias por los excelentes momentos que pasamos a todos aquellos involucrados con AxiaCore, además de trabajar en lo que mas nos gusta nuestra vida transcurre junto a ustedes, por eso cada momento debe ser especial.
Respecto al partido, AxiaCore sufrió una derrota, seguimos todas las indicaciones del profe, las cosas no se [...]]]></description>
			<content:encoded><![CDATA[<p>y no vivir para trabajar&#8230;</p>
<p style="text-align: center;"><a href="http://axiacore.com/blog/wp-content/uploads/2010/01/IMG_5173.jpg"><img class="size-medium wp-image-796  aligncenter" title="Futbol 5" src="http://axiacore.com/blog/wp-content/uploads/2010/01/IMG_5173-300x219.jpg" alt="" width="300" height="219" /></a></p>
<p>Gracias por los excelentes momentos que pasamos a todos aquellos involucrados con AxiaCore, además de trabajar en lo que mas nos gusta nuestra vida transcurre junto a ustedes, por eso cada momento debe ser especial.</p>
<p>Respecto al partido, AxiaCore sufrió una derrota, seguimos todas las indicaciones del profe, las cosas no se nos dieron, esperamos para la próxima fecha recuperar puntos valiosos para llegar al cuadrangular y cumplirle a la afición <img src='http://axiacore.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://axiacore.com/blog/2010/01/trabajar-para-vivir/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Symfony interactive shell</title>
		<link>http://axiacore.com/blog/2009/11/symfony-interactive-shell/</link>
		<comments>http://axiacore.com/blog/2009/11/symfony-interactive-shell/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 18:48:51 +0000</pubDate>
		<dc:creator>Juan Pablo Romero Bernal</dc:creator>
				<category><![CDATA[AxiaCore]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://axiacore.com/blog/?p=792</guid>
		<description><![CDATA[The command line interface (known as cli) is a good tool for most developers, due ten fingers make more things than two. In fact, when we develop web applicactions using the Symfony framework several tasks are made through the command line, for instance: model generation, creation of database schemas, cache clear and so on. This [...]]]></description>
			<content:encoded><![CDATA[<p>The command line interface (known as cli) is a good tool for most developers, due ten fingers make more things than two. In fact, when we develop web applicactions using the Symfony framework several tasks are made through the command line, for instance: model generation, creation of database schemas, cache clear and so on. This tasks simplify the work in a significant way (if you are a symfony user, you know what i&#8217;m talking about).</p>
<p>Of course, this functionality is offered for the php command line interface (the php-cli), that sometimes is not enough to execute some actions such as: watch the object state, perform database inserts (and the typical crud operations), call methods in a interactive way, etc,. I know that some people says: the php cli has a interactive mode (-a option), but i think it is very limited. Talking with others developers, the php interpreter needs an interactive terminal (like python) and it keeps to work with our symfony projects.</p>
<p>The good new is that the facebook team has released (under BSD license) an interactive shell for php interpreter (as their own creators says: &#8221; &#8230; ironically written in python&#8221;) called <a href="http://www.phpsh.org">phpsh</a> and  it&#8217;s a great work !. I&#8217;ve perform some tests to integrate it with Symfony and i think, it can be a great tool for support and debugging.</p>
<p>Some simple examples:</p>
<p>After we installed phpsh (see the README file), we can work with php sentences and use the common functions:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">test$ phpsh
Starting php
type <span style="color: #0000ff;">'h'</span> or <span style="color: #0000ff;">'help'</span> to see instructions <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span> features
php<span style="color: #339933;">&gt;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Hello world&quot;</span>
Hello world
php<span style="color: #339933;">&gt;</span> <span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$a</span>
<span style="color: #cc66cc;">5</span>
php<span style="color: #339933;">&gt;</span> <span style="color: #000088;">$f</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'one'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'two'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'three'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
php<span style="color: #339933;">&gt;</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$f</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$n</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$n</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #cc66cc;">123</span>
php<span style="color: #339933;">&gt;</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$f</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$n</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$n</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #cc66cc;">1</span>
<span style="color: #cc66cc;">2</span>
<span style="color: #cc66cc;">3</span>
php<span style="color: #339933;">&gt;</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$f</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$n</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #339933;">...</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$n</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">...</span> <span style="color: #009900;">&#125;</span>
<span style="color: #cc66cc;">1</span>
<span style="color: #cc66cc;">2</span>
<span style="color: #cc66cc;">3</span>
php<span style="color: #339933;">&gt;</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$f</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #cc66cc;">3</span></pre></div></div>

<p>Well, but right now, i&#8217;ll show you something more interesting: a symfony application using the interactive shell.  It not requires additional configuration, just load a file: the frontal controller of your app (in the web directory), for example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">test$ phpsh web<span style="color: #339933;">/</span>index<span style="color: #339933;">.</span>php
Starting php with extra includes<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'web/index.php'</span><span style="color: #009900;">&#93;</span>
 <span style="color: #339933;">.......................</span>
php<span style="color: #339933;">&gt;</span></pre></div></div>

<p>To hide the html output, we can create a copy of this file and avoid the call to dispatch method:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/config/ProjectConfiguration.class.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$configuration</span> <span style="color: #339933;">=</span> ProjectConfiguration<span style="color: #339933;">::</span><span style="color: #004000;">getApplicationConfiguration</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'frontend'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'prod'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
sfContext<span style="color: #339933;">::</span><span style="color: #004000;">createInstance</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$configuration</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now, load again (i&#8217;ve called shell.php):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">test$ phpsh shell<span style="color: #339933;">.</span>php
Starting php with extra includes<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'shell.php'</span><span style="color: #009900;">&#93;</span>
type <span style="color: #0000ff;">'h'</span> or <span style="color: #0000ff;">'help'</span> to see instructions <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span> features
php<span style="color: #339933;">&gt;</span> <span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> CityPeer<span style="color: #339933;">::</span><span style="color: #004000;">doSelect</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Criteria<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
php<span style="color: #339933;">&gt;</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$city</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #339933;">...</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$city</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #339933;">...</span> <span style="color: #009900;">&#125;</span>
Barranquilla
Bogota
Berlin
Medellin
php<span style="color: #339933;">&gt;</span></pre></div></div>

<p>As you can see, it can be access to the model classes (i&#8217;m sorry with doctrine users) and the Symfony classes. For example, if my file app.yml looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">all<span style="color: #339933;">:</span>
 results_per_page<span style="color: #339933;">:</span> <span style="color: #cc66cc;">15</span>
 sf_phpmailer<span style="color: #339933;">:</span>
   mailer<span style="color: #339933;">:</span>                    <span style="color: #009900; font-weight: bold;">true</span>
   smtp_auth<span style="color: #339933;">:</span>                 <span style="color: #009900; font-weight: bold;">true</span>
   smtp_secure<span style="color: #339933;">:</span>               <span style="color: #0000ff;">&quot;ssl&quot;</span>
   host<span style="color: #339933;">:</span>                      <span style="color: #0000ff;">&quot;smtp.example.com&quot;</span>
   port<span style="color: #339933;">:</span>                      <span style="color: #cc66cc;">600</span>
   username<span style="color: #339933;">:</span>                  <span style="color: #0000ff;">&quot;user&quot;</span>
   password<span style="color: #339933;">:</span>                  <span style="color: #0000ff;">&quot;password&quot;</span>
   from<span style="color: #339933;">:</span>                      <span style="color: #0000ff;">&quot;nobody@example.com&quot;</span>
   from_name<span style="color: #339933;">:</span>                 <span style="color: #0000ff;">&quot;NoBody&quot;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">test$ phpsh shell<span style="color: #339933;">.</span>php
Starting php with extra includes<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'shell.php'</span><span style="color: #009900;">&#93;</span>
type <span style="color: #0000ff;">'h'</span> or <span style="color: #0000ff;">'help'</span> to see instructions <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span> features
php<span style="color: #339933;">&gt;</span> <span style="color: #000088;">$conf</span> <span style="color: #339933;">=</span> sfConfig<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'app_sf_phpmailer_port'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$conf</span><span style="color: #339933;">;</span>
<span style="color: #cc66cc;">600</span>
php<span style="color: #339933;">&gt;</span> <span style="color: #b1b100;">echo</span> sfConfig<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'app_results_per_page'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #cc66cc;">15</span>
php<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Well, it&#8217;s easy and very interesting. I hope work in detail and make more experiments. That&#8217;s all folks !.</p>
]]></content:encoded>
			<wfw:commentRss>http://axiacore.com/blog/2009/11/symfony-interactive-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trabajando con Symfony en forma interactiva</title>
		<link>http://axiacore.com/blog/2009/11/trabajando-con-symfony-en-forma-interactiva/</link>
		<comments>http://axiacore.com/blog/2009/11/trabajando-con-symfony-en-forma-interactiva/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 06:23:33 +0000</pubDate>
		<dc:creator>Juan Pablo Romero Bernal</dc:creator>
				<category><![CDATA[AxiaCore]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://axiacore.com/blog/?p=781</guid>
		<description><![CDATA[Para algunos desarrolladores nos es muy cómodo trabajar desde la línea de comandos, ya que diez dedos hacen más que dos. De hecho cuando se desarrollan aplicaciones con Symfony, el uso de la terminal de comandos es fundamental para muchas tareas (generación del modelo, creación de esquemas de base de datos, limpiar la cache, etc,.) [...]]]></description>
			<content:encoded><![CDATA[<p>Para algunos desarrolladores nos es muy cómodo trabajar desde la línea de comandos, ya que diez dedos hacen más que dos. De hecho cuando se desarrollan aplicaciones con Symfony, el uso de la terminal de comandos es fundamental para muchas tareas (generación del modelo, creación de esquemas de base de datos, limpiar la cache, etc,.) que simplifican el trabajo significativamente.</p>
<p>Desde luego, todo esto es gracias a la interfaz en línea de comandos del ínterprete php (más conocido como php-cli), que en algunos casos se queda corto para ejecutar algunas pruebas: ver el estado de un objeto, insertar datos en la base de datos,  probar métodos de manera interactiva, etc,. Sé que algunos dirán que php-cli tiene un modo interactivo, pero en realidad desde mi punto de vista es muy limitado.  Sería muy interesante contar con algo similar a la terminal interactiva de python y desde luego que se pueda trabajar con nuestros proyectos en Symfony.</p>
<p>Lo mejor de todo, es que la gente de facebook liberó bajo licencia BSD una shell interactiva para php y como sus mismos credadores dicen: &#8220;&#8230; irónicamente escrita en python &#8230;.&#8221;; se llama <a href="http://www.phpsh.org/">phpsh</a> y realmente es un gran trabajo. He realizado algunas pruebas de integración con Symfony y creo que puede ser de gran apoyo para pruebas y aún más para las personas que están aprendiendo a trabajar con el framework.</p>
<p>A continuación van algunos de los sencillos experimentos realizados:</p>
<p>Una vez se haya instalado phpsh (leer el README), podemos trabajar  con sentencias de php y usar las funciones:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">test$ phpsh
Starting php
type <span style="color: #0000ff;">'h'</span> or <span style="color: #0000ff;">'help'</span> to see instructions <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span> features
php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Hola mundo&quot;</span>
Hola mundo
php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$a</span>
<span style="color: #cc66cc;">5</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$f</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'uno'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'dos'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'tres'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$f</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$n</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$n</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #cc66cc;">123</span>
php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$f</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$n</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$n</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #cc66cc;">1</span>
<span style="color: #cc66cc;">2</span>
<span style="color: #cc66cc;">3</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$f</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$n</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #339933;">...</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$n</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">...</span> <span style="color: #009900;">&#125;</span>
<span style="color: #cc66cc;">1</span>
<span style="color: #cc66cc;">2</span>
<span style="color: #cc66cc;">3</span>
php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$f</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #cc66cc;">3</span></pre></div></div>

<p>Bien, pero ahora viene algo un poco más interesante: usar a través del shell interactivo nuestra aplicación hecha en Symfony.</p>
<p>No requiere ninguna configuración especial, simplemente cargar un archivo y listo; se trata del controlador frontal de nuestra aplicación (alguno de los que se encuentra en web), así:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">test$ phpsh web<span style="color: #339933;">/</span>index<span style="color: #339933;">.</span>php
Starting php with extra includes<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'web/index.php'</span><span style="color: #009900;">&#93;</span>
&nbsp;
  <span style="color: #339933;">.......................</span>
&nbsp;
php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span></pre></div></div>

<p>Para obviar la salida html, podemos crear una copia de ese archivo y evitar la llamada al método dispatch(), así:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/config/ProjectConfiguration.class.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$configuration</span> <span style="color: #339933;">=</span> ProjectConfiguration<span style="color: #339933;">::</span><span style="color: #004000;">getApplicationConfiguration</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'frontend'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'prod'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
sfContext<span style="color: #339933;">::</span><span style="color: #004000;">createInstance</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$configuration</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Ahora, de nuevo lo cargamos (ese archivo lo he llamado shell.php):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">test$ phpsh shell<span style="color: #339933;">.</span>php
Starting php with extra includes<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'shell.php'</span><span style="color: #009900;">&#93;</span>
type <span style="color: #0000ff;">'h'</span> or <span style="color: #0000ff;">'help'</span> to see instructions <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span> features
php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$c</span> <span style="color: #339933;">=</span> CiudadPeer<span style="color: #339933;">::</span><span style="color: #004000;">doSelect</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Criteria<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$ciudad</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #339933;">...</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$ciudad</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #339933;">...</span> <span style="color: #009900;">&#125;</span>
Barranquilla
Bogota
Constantinopla
Medellin
&nbsp;
php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span></pre></div></div>

<p>Como se puede ver, puedo acceder a las clases de mi modelo (disculpas a los usuarios de Doctrine) y desde luego a las clases que nos proporciona Symfony, por ejemplo si mi archivo <strong>apps/frontend/config/app.yml</strong> es:</p>

<div class="wp_syntax"><div class="code"><pre class="yml" style="font-family:monospace;">all:
 resultados_por_pagina: 15
 sf_phpmailer:
   mailer:                    true
   smtp_auth:                 true
   smtp_secure:               &quot;ssl&quot;
   host:                      &quot;smtp.mihost&quot;
   port:                      600
   username:                  &quot;miusuario&quot;
   password:                  &quot;miclave&quot;
   from:                      &quot;nosesabe@example.com&quot;
   from_name:                 &quot;Anonimo&quot;</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">test$ phpsh shell<span style="color: #339933;">.</span>php
Starting php with extra includes<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'shell.php'</span><span style="color: #009900;">&#93;</span>
type <span style="color: #0000ff;">'h'</span> or <span style="color: #0000ff;">'help'</span> to see instructions <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span> features
php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$conf</span> <span style="color: #339933;">=</span> sfConfig<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'app_sf_phpmailer_port'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$conf</span><span style="color: #339933;">;</span>
<span style="color: #cc66cc;">600</span>
php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> sfConfig<span style="color: #339933;">::</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'app_resultados_por_pagina'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #cc66cc;">15</span>
php<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span></pre></div></div>

<p>Bueno, esos han sido los experimentos que he alcanzado a realizar. Espero trabajar más en detalle y publicar los resultados. Hasta una próxima.</p>
]]></content:encoded>
			<wfw:commentRss>http://axiacore.com/blog/2009/11/trabajando-con-symfony-en-forma-interactiva/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mostrar numero de version en django</title>
		<link>http://axiacore.com/blog/2009/11/mostrar-numero-de-version-en-django/</link>
		<comments>http://axiacore.com/blog/2009/11/mostrar-numero-de-version-en-django/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 13:31:17 +0000</pubDate>
		<dc:creator>Camilo Nova</dc:creator>
				<category><![CDATA[AxiaCore]]></category>
		<category><![CDATA[Desarrollo]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://axiacore.com/blog/?p=776</guid>
		<description><![CDATA[En AxiaCore utilizamos subversion para llevar el control de versiones de los proyectos, junto a nuestro esquema de desarrollo ágil manejamos ciclos cortos de lanzamiento de nuevas funcionalidades, por eso para nosotros es necesario conocer el numero de revisión del SVN y publicarlo en un lugar fácilmente accesible para los usuarios, de tal forma que [...]]]></description>
			<content:encoded><![CDATA[<p>En AxiaCore utilizamos subversion para llevar el control de versiones de los proyectos, junto a nuestro esquema de desarrollo ágil manejamos ciclos cortos de lanzamiento de nuevas funcionalidades, por eso para nosotros es necesario conocer el numero de revisión del SVN y publicarlo en un lugar fácilmente accesible para los usuarios, de tal forma que rápidamente nos puedan indicar la versión que están utilizando.</p>
<p>La aproximación inicial es tener un parámetro donde se indique un numero de versión de la aplicación, pero esta fue rápidamente descartada porque no es flexible y se tendría que cambiar la versión manualmente en cada nuevo cambio, así que decidimos manejar el numero de revisión del repositorio como el indicador de la versión. Ahora bien, se necesita una manera automática de obtener dicho numero y publicarlo en una plantilla HTML para verlo en la interfaz de usuario.</p>
<p>Lo resolvimos así:</p>
<p>Partimos de la plantilla donde básicamente django nos permite lo siguiente:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">{% load version_tag %}
&lt;p&gt;Version: {% get_version %}&lt;/p&gt;</pre></td></tr></table></div>

<p>Entonces cargamos un &#8216;custom tag&#8217; que nos retorna la versión actual de la aplicación, el cual es:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#! /usr/bin/env python</span>
<span style="color: #808080; font-style: italic;"># -*- coding: utf8 -*-</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">subprocess</span>
<span style="color: #ff7700;font-weight:bold;">from</span> django <span style="color: #ff7700;font-weight:bold;">import</span> template
<span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">core</span>.<span style="color: black;">cache</span> <span style="color: #ff7700;font-weight:bold;">import</span> cache
&nbsp;
register = template.<span style="color: black;">Library</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
@register.<span style="color: black;">simple_tag</span>
<span style="color: #ff7700;font-weight:bold;">def</span> get_version<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;
    Retorna el numero de version para la aplicacion y lo almacena en
    cache para evitar ser llamado multiples veces y mejorar el rendimiento
    de la aplicacion.
    &quot;&quot;&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> cache.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'version'</span><span style="color: black;">&#41;</span>:
        comando = <span style="color: #483d8b;">'svn info | grep Rev | head -1'</span>
        <span style="color: #ff7700;font-weight:bold;">try</span>:
            proc = <span style="color: #dc143c;">subprocess</span>.<span style="color: black;">Popen</span><span style="color: black;">&#40;</span>comando, shell=<span style="color: #008000;">True</span>, 
                stdout=<span style="color: #dc143c;">subprocess</span>.<span style="color: black;">PIPE</span>, stderr=<span style="color: #dc143c;">subprocess</span>.<span style="color: black;">PIPE</span>
            <span style="color: black;">&#41;</span>
            line = proc.<span style="color: black;">communicate</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
            version = line<span style="color: black;">&#91;</span>line.<span style="color: black;">find</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot; &quot;</span><span style="color: black;">&#41;</span>+<span style="color: #ff4500;">1</span>:<span style="color: black;">&#93;</span>.<span style="color: black;">rstrip</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">except</span>:
            version = <span style="color: #483d8b;">'---'</span>
&nbsp;
        tiempo = <span style="color: #ff4500;">24</span> <span style="color: #66cc66;">*</span> <span style="color: #ff4500;">60</span> <span style="color: #66cc66;">*</span> <span style="color: #ff4500;">60</span>   <span style="color: #808080; font-style: italic;">#Tiempo en segundos de un dia</span>
        cache.<span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'version'</span>, version, tiempo<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">return</span> cache.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'version'</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Este archivo (version_tag.py) debe estar dentro de una carpeta llamada &#8216;templatetags&#8217; de alguna aplicación del proyecto.</p>
<p>Lo interesante de esta solución es:</p>
<ol>
<li>Obtiene el numero de versión por el comando &#8217;svn info&#8217;</li>
<li>Reduce las llamadas al comando ubicando la información en cache durante un día</li>
<li>Es totalmente desacoplado del proyecto y se puede reutilizar fácilmente</li>
<li>Se puede adaptar para otros sistemas de control de versiones</li>
</ol>
<p>Que les parece?</p>
]]></content:encoded>
			<wfw:commentRss>http://axiacore.com/blog/2009/11/mostrar-numero-de-version-en-django/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
