- Entries : Category [ pyramid ]
- Stuff concerning the pyramid web development framework.
17 August 2011
Chameleon PT Checkboxes
It's the same... almost the same
With pyramid, web developers have the choice to use various templating engines. Coming from Zope, "Chameleon ZPT Templates" are a good choice, as they are compatible to the ZPTs I've gotten used to over the years. The thing is, these templates are compatible, but there are differences.
One thing that had me wondering was how to set the "checked" attribute on checkbox input fields. In Zope's ZTPs, you can do something like tal:attributes="checked somevariable" and if somevariable is evaluated to True, then the checked-attribute will be set to "checked", otherwise it will not be there at all. It's a special case that is necessary for the way some browsers handle this attribute.
In Chameleon's PT, I got a lot of "None type is not callable" errors, or else it would show the box as checked when it shouldn't... and I was overall confused. Turns out the incantation that works for me here is something like this: tal:attributes="checked 'checked' if somevariable else None". It seems in order to not insert the "checked" attribute, Chameleon PT wants the value to be None, but it doesn't like python's True for a value either, therefore putting in the string 'checked'.
25 October 2011
Always writing tests
It's the way of the egyptian
The coding standard in the Pyramid project is something that I attempt to get closer to. One thing that's there is that code always has tests. So in the current project (which happens to be using Pyramid), I make sure that code has 100% test coverage.
Sometimes it's a bit of a pain though. "Just let me write that one little method and I'll be done! The tests will only be bother!"
But then I start writing the tests anyway and $#!@ if there aren't a bunch of bugs being flushed out of the code. Writing tests simply pays off.
07 November 2011
Welcome to Betabug Sirius
My new Company Site
It has been quite some time that I announced that I'd be working
as a freelancer. Lots of stuff had to be done in that time, but finally
things are ready. I've founded my own little company and set up
a small website: Welcome to Betabug Sirius!
For once this isn't a "ZWiki-As-A-CMS" site (which is what I usually
do when I want a site to go up fast), but a plain, static html site,
done in vi. I know it won't scale when I'll want to expand it, but
I had fun coding it up in the old style.
So far I already have a few customers, working with Zope (mostly in
bugfixing and maintenance of existing / legacy sites) and with Pyramid (building
a brand new web application). There is also a project to build something
unique and "our own" on a longer horizon, involving technology and art.
There has been and still is a lot of bureaucracy, but so far the ride has
been smooth and sometimes even fun. Part of the strategy is to work
together with other companies to form flexible teams for each project.
That's something that has worked real well so far, giving me fun and
inspiration to work with others.
06 October 2012
Hacking till the drinks are on fire
So, here I am, on the other corner of Europe. Together with graffic we flew via Madrid to La Coruna and then drove with Wu to his place in Lugo. Yesterday we started "sprinting" on our customer's pyramid app. Sprinting, what's that? It means that for some days we work really concentrated on programming this thing. It also means that for once we're working in the same room instead of cooperating over the net.
It's really great to work with these guys. Yesterday r0sk was working with us too. We got tons of things done already, despite "wasting" some hours at the start having a meeting about what to work on first. Now the sprint will continue till Tuesday and then we'll have our queimada and we'll be relaxing in the countryside of Galicia for a while.
29 May 2015
Starting a New Project Naively Sure is Easier
Experience is not always an advantage
Starting a new pyramid fun project with some friends here. Sometimes I
think that having experience with another pyramid project isn't always
helpful. Instead of just writing my simple objects and growing them, I'm
thinking: "well, for this kind of thing, we added xy and yz, and we made
a feature to ..." and then instead of coding along, I'm sitting there,
thinking if adding that feature right away makes sense, and if I should
copy that bit of code or not.
Sure I could start with the simpler objects, but then I'd have to migrate
them later on. On the other hand, if I try to do it all at once now,
I can just sit there with a cup of tea for a couple of days and try to
"waterfall" it all through. Have to find some middle ground somewhere,
and have to accept that at least initially "migration" will be to the
tune of "throw away your database and start over". Gotta get moving.