05 febrero
2010
tracd behind an apache2 proxy
wrong redirect after adding a ticket
I found this weird behaviour with tracd and an apache proxy today, while setting up some public trac access for one of our projects.
This is the setup (click on the image for a larger version):
The idea is pretty basic, there is an Apache server running with SSL support and accepting requests for https://my.publicname.com. It is configured to act as a reverse proxy for the server running tracd behind it, accepting requests for http://192.168.1.2:8000.
So, in the example someone could open up a browser, put https://my.publicaddress.com/project in the address/location bar and access that project trac page. The process would be:
1. A request is sent to the Apache server, which will accept it and process it using the following rule in the VirtualHost configuration:
RewriteRule ^/project/(.*) \
http://192.168.1.2:8000/project/$1 [L,P]
2. Another request is sent from Apache to tracd, asking for the needed data
3. The data is sent back from tracd to Apache
4. The data is sent back to the user, transparently (the user doesn't even know that there are more than one server serving the contents).
Nice!! but... it failed when I tried to add a ticket using a external connection. :(
Each time I tried to add a ticket, after it was added, my browser was redirected to http://192.168.1.1:8000/project/ticket/(ticketnumber) instead of https://my.publicaddress.com/project/ticket/(ticketnumber). Ugly. It seemed like trac was building the url internally and, of course, that internal url will not work from outside.
After some read-and-try, I found that the problem could be solved editing my trac env trac.ini config file, and replacing:
base_url =
[ ... ]
use_base_url_for_redirect = False
with:
base_url = /project
[ ... ]
use_base_url_for_redirect = True
This solved the problem, allowing me to use the trac instance from both within the LAN and from the outside.
28 enero
2010
Paris happiness
wow, almost 5 years have passed since that picture
Yes, I was happy when Marta took that picture. It was 2005 and we (Marta, Rita, Dolo and me) were in Paris during our one-week excursion to France (3 days in the Bretagne, 3 days in Paris) and I was happy.
I like group trips, even more if there is a car involved and it ends in a road trip. That trip was kind of a mix, road trip during the first 3 days and totally different while we were in Paris.
The photo was taken in a small green area by the memorial to the martyrs of deportation. It was February (or March, don't remember exactly) and it was cold, but I couldn't resist to lay down on the grass.
It was perfect, being there, doing that, almost perfect... until a gendarme appeared and told us that laying on the grass was not allowed, too bad.
24 enero
2010
New FreeBSD port: openerp-web
YES! my first port after sooo much time.
Today my first FreeBSD port went into the ports tree:
http://www.freebsd.org/cgi/query-pr.cgi?pr=143036
I've ported the OpenERP web client so, if you update your ports tree now (using portsnap or csup) you can search for openerp:
cd /usr/ports && make search name=openerp
You will get two results, the openerp-server port and my openerp-web port:
Port: py26-openerp-web-5.0.6
Path: /usr/ports/finance/openerp-web
Info: OpenERP Web Client
Maint: HERE_GOES_MY_EMAIL!
B-deps: gettext-0.17_1 libiconv-1.13.1 py26-Babel-0.9.4 py26-beaker-1.5.1 py26-cheetah-2.4.1_1 py26-cherrypy-3.1.2 py26-formencode-1.2.2 py26-mako-0.2.5 py26-markdown-2.0.3 py26-parsing-1.5.2_1 py26-pytz-2009u py26-setuptools-0.6c11 py26-simplejson-2.0.9 py26-xlwt-0.7.2 python26-2.6.4
R-deps: gettext-0.17_1 libiconv-1.13.1 py26-Babel-0.9.4 py26-beaker-1.5.1 py26-cheetah-2.4.1_1 py26-cherrypy-3.1.2 py26-formencode-1.2.2 py26-mako-0.2.5 py26-markdown-2.0.3 py26-parsing-1.5.2_1 py26-pytz-2009u py26-setuptools-0.6c11 py26-simplejson-2.0.9 py26-xlwt-0.7.2 python26-2.6.4
WWW: https://launchpad.net/openobject-client-web
I needed that, as I've been working a lot on setting up OpenERP solutions under FreeBSD so having the ports to take care of the dependencies is very useful.
Lately I've been working on a howto style doc too. In that doc I cover how to install and configure both the openerp server and the web client. I'll post about it once it is finished.
23 enero
2010
I survived the "Chuleton Chuck Norris"
pero casi quedo no camiño!
Hace ya algunos días que recibí mi invitación para participar en la cena "Chuletón Chuck Norris Certified" organizada por MarcosBL.
Hoy puedo decir orgulloso I survived!.
El chuletón era supuestamente de kilo, pero yo creo que alguno sobrepasaba sobrado ese peso. Si a eso le sumamos los primeros (pulpo, chocos, croquetas, pimientos...), los postres (tartas de queso, piña, chocolate y tejas y cañas fritas...) y la bebida (vino y cerveza a barrer y licores varios), pues tenemos como resultado que los 10 participantes en la prueba estabamos a vivir a eso de la 1 de la madrugada ;D.
La batalla inicial dió paso a una pelicula de terror en la que, camino del centro de Lugo, los miembros del grupo se iban descolgando uno a uno de la compañia, los chuletones nos estaban venciendo!!
Finalmente los pocos miembros restantes nos retiramos a lugares mas seguros (la cama) sobre las 5:30 de la madrugada.
Esos pocos supervivientes comentabamos, camino de casa, que tendríamos que hacernos unas camisetas como aquellas que hace años había del Dragon Khan de PortAventura. Asi que aqui esta un boceto de una posible propuesta (por dios, que alguien haga algo mejor!)
Finalmente, creo que no es necesario explicar a que viene meter a Chuck Norris en todo esto... y para el que sea necesario, un par de enlaces:
20 enero
2010
Hidden emails for comments in this COREBlog
it was a bad idea not to put your url in my comments
For all of you who usually comment my posts:
- First: Thnx, I really appreciate your comments ;)
- Second: I've detected that a lot of the people who add comments to this blog didn't add an url in the comment form. I don't know if it is an act of pure lazyness (because I know some of them who has a blog, for example) or simply because they don't want their blogs to be linked here (WHY?). Anyway, these people were adding their email addresses, and those where publicly showed in the blog. I've modified the code that show the comments in this e-shell.org COREBlog theme to show a link to # instead of the email address.
I want to get more people involved in the blog, but I don't want to contribute to SPAM your INBOXes.
Just in case some other COREBloggers out there want to know, I just edited the comment_body DTML method inside my custom skin folder, replacing:
<a href="mailto:<dtml-if "REQUEST.form.has_key('email')"><dtml-var "removeHTML(REQUEST.form['email'])"><dtml-else><dtml-var email missing=""></dtml-if>">
with:
<a href="#">
19 enero
2010
Autocompletion for your python shell|console|interpreter
this is an old one, but I would like to have it here as a reminder
One of the nice features of the django shell (that is, the python shell you get when you call ./manage.py shell inside a django project) is that it has tab autocompletion, that is, you can import a module and use tab-completion to see all the modules within it.
A lot of people are using iPython these days because of the lack of this feature on the default Python shell, but this is only by default, and if you are using iPython only because of the tab completion, forget about installing extra stuff, you only have to do this little trick:
import rlcompleter, readline
readline.parse_and_bind('tab:complete')
and you can use tab completion, for example:
>>> import smtplib
>>> smtplib.
smtplib.CRLF smtplib.SSLFakeFile smtplib.__setattr__(
smtplib.LMTP smtplib.__all__ smtplib.__sizeof__(
smtplib.LMTP_PORT smtplib.__class__( smtplib.__str__(
smtplib.OLDSTYLE_AUTH smtplib.__delattr__( smtplib.__subclasshook__(
smtplib.SMTP smtplib.__dict__ smtplib._have_ssl
smtplib.SMTPAuthenticationError( smtplib.__doc__ smtplib.base64
smtplib.SMTPConnectError( smtplib.__file__ smtplib.email
smtplib.SMTPDataError( smtplib.__format__( smtplib.encode_base64(
smtplib.SMTPException( smtplib.__getattribute__( smtplib.hmac
smtplib.SMTPHeloError( smtplib.__hash__( smtplib.quoteaddr(
smtplib.SMTPRecipientsRefused( smtplib.__init__( smtplib.quotedata(
smtplib.SMTPResponseException( smtplib.__name__ smtplib.re
smtplib.SMTPSenderRefused( smtplib.__new__( smtplib.socket
smtplib.SMTPServerDisconnected( smtplib.__package__ smtplib.ssl
smtplib.SMTP_PORT smtplib.__reduce__( smtplib.stderr
smtplib.SMTP_SSL smtplib.__reduce_ex__(
smtplib.SMTP_SSL_PORT smtplib.__repr__(
In this example, after importing smtplib I just wrote smtplib. in the shell and hit tab twice, to get all the available options in that module.
Nice, isn't it?
Ok, now it would be even nicer if we do not have to set tab completion each time we run the python shell, but this is an easy one.
Each time you run the python shell|console|interpreter, it will search for a variable in your environment called PYTHONSTARTUP, where you can set a file that will be executed after starting the shell (the perfect place to put some init-lines).
So, all you have to do is, first, add this two lines to a file, for example, called .pythonrc in your home:
$ cat ~/.pythonrc
import rlcompleter, readline
readline.parse_and_bind('tab:complete')
$
Second, add the PYTHONSTARTUP variable to your shell profile file. If you are using csh, tcsh or similar shells, this will do it:
echo "setenv PYTHONSTARTUP ~/.pythonrc" >> ~/.cshrc
If your shell is sh, bash, ksh or similars, this will do it:
echo "export PYTHONSTARTUP=~/.pythonrc" >> ~/.profile
(check your OS info, perhaps instead of .profile it could be .kshrc, .bashrc or something like that).
After that, you will be able to use tab completion each time in your default python shell, with no additional dependencies!
NOTE: Of course, you should take a look at iPython anyway, as it has a lot more features than tab-completion, it is a powerful tool you may find very very useful.
16 enero
2010
A parabola do carballo e mais o eucalipto
esto vai para quen me queira entender
Fai xa tempo que queria escribir sobre este tema, e penso que o galego e a mellor lingua na que expresarme.
Se ti que estas lendo esto eres galego, de seguro sabes de un problema que temos en Galicia dende fai moitos anos, o problema dos eucaliptos (ou alcolitos que lles chama o meu avo paterno). O problema podese describir con este sinxelo exemplo.
Imaxina que eres o dono dunha finca, una finca ben grande, que che quedou por parte de teus pais. Estas a pensar que facer coa finca, non o tes claro, resulta que e unha extension bastante grande, ten alguns carballos e moito verde. Nestas que ti andas a pensar en que facer, cando chega un coñecido que che di:
Oiche oh!, se o prado ese fora meu, xa o tiña plantado de alcolitos, que crecen rapido e pagan ben a madeira
E ahi que se presenta o que eu chamo a parabola do carballo e mais o eucalipto.
Na nosa terra, fai anos, era moi habitual atopar carballos no campo, nos montes. Un arbol que e bon contra os incendios, que protexe o resto da vexetacion que lle rodea e que da alimento para os animais (as landras). Dende fai algun tempo xa, en lugar de estas arbores cada vez se atopan mais plantacions de alcolitos que deixan o chan sen recursos (fixate a ver se ves herba debaixo dun) non dan alimento e son moi perigosos en caso de incendio...
¿E por que? pois por que crecen rapido e vendense ben como madeira.
¿Cara onde vou con todo esto? Pois a algo que creo que se pode aplicar de forma sinxela o meu ambito profesional, e e que non comprendo a xente que en lugar de tomar un proxecto, una idea, e traballar sobre esa idea, facendoa medrar e chegando algun dia a que ese proxecto sea beneficioso para mais xente (ainda que sexa un longo camiño); en lugar de esto, prefiren ir a donde estan os cartos, o negocio, da o mesmo o tipo de proxecto, por que non e o proxecto o que buscan, e ver donde hai cartos para propoñer calquera cousa (preferentemente se xa esta feita por outra xente e implica pouco traballo) chegar o dia X no que hay que presentar algo, coller os cartos e seguir na busca de mais choios.
Creo que agora xa sabes por onde vou. Non sei, quizais todo esto e papel mollado, ideas na miña cabeciña de lucense tolo, quizais non, e ti pensas o mismo ca min.