Django, epix phail. #2 2
Templates… ahhh…
No, wait……
Templates! ARGHHHHHHHHHHH! (maniacal cackle)
I am not going to say the R-o-R word. really I won’t as I know that tends to cause python people to spontaneously combust.
But, really, a whole nother ‘language’ to implement templates?!
And yes, I know why…. python uses whitespace as structure, so it is really impossible to use PYTHON in a template. the indenting would get complicated.
But really. djangos templating ‘language’ is an abomination. Its almost python, but not quiet. so you have to remember what the differences are.
And its special case handling of method object attributes….
When you say {% if user.is_authenticated } and it introspects to see that ‘.is_authenticated’ returns a method object and calls the object to get the value. And it does this because the code cannot handle { user.is_authenticated() %} as it SHOULD be.
Well, that points me in my next direction.
Python and its method semantics (next time!)
Django, epix phail. #1 2
I am working on a project that is using Django.
We have decided to use ‘South’ which is a migration framework which tries to do for django what rails has out of the box.
This is the first posting of many in what will be a series of rants against django, python, stupidity and pride.
First off, lets look at south.
Django models explicitly define the field structure of the table that is going to hold the objects. Now, I quite like that. It means that if I want to find out what fields a model has, I can look at the object definition. Rails does not have that. fields are defined in the db, and, only in recent rails versions is a comment added to the beginning of your model files detailing the structure.
Now, along comes south. and because the structure is explicit, it tries to do something neat. It will attempt to auto-generate the migration for you by introspecting the previous database structure and comparing to the current one. When I encountered that I thought it was lovely, neat, useful, clean.
BUT IT DOES NOT ALWAYS WORK.
It recognises when you ADD things but not when you take them away. So, if you remove a field, when you generate the migration, it sees it, updates its own copy of how the structure should look, but does not emit the code to remove the field from the database.
Ok you think, thats ugly, but not too bad right? The structure of your objects is still correct, you just have an unused column in your table? yeah? huh? huh?
NO.
Your models are broken because even though the structure of your objects is declared explicitly in your model code, when Django instantiates the object from the database, it IGNORES the defined structure in the model, and instantiates the object with all the fields from the database table. And then continues to use those fields as if they are meant to be there.
What TOSH.
Next time….. “Django templates, or ‘how to go quietly, or not so quietly insaner’”
Boldly striding backwards, into the future. 2
Money, where is it going? and how does it get there?
Today, I discover that the fastest way to pay a bill is with my debit card. AND THAT IT TAKES 3 BUSINESS DAYS.
Think about that for a minute.
I remember seeing a program about how cheques ‘cleared’ in the ‘olden days’ (1970s).
When a bill was payed at a bank with a paper cheque, it was gathered up with all the other cheques, and sent down to London, where the paper cheques where whisked between clearing branches of the appropriate banks, this process took at most 4 days.
Now, in the time where I can communicate securely with almost any point on the planets surface with a delay only measurable in the milliseconds, it takes one day less.
How about cash you ask… SURELY, that is processed more quickly, no clearing is needed. Nope! Cash takes LONGER, between 3 and 4 days.
It is not only those payment methods, the old ones, the one that used to take 4 days to shuffle physical paper around the country? That now takes between 4 and 7 days to clear.
What is going on?
Well, I have a theory.
Banks control all money transactions, and if they can interpose a delay between the point of taking the money and the point of putting it somewhere else, why, they can USE the money in the interim.
This delay has nothing to do with technology, nothing to do with what really happens.
Banks control that delay to enhance their liquidity.
If, every month, they handle the transfer of a salary payment into a persons account, and for that payment, they ‘hold’ the money for 5 days, thats a sixth of the month (if you include weekends).
So, they effectively HAVE 1/6 of that persons wages, all the time (when averaged over everyone)
Not only that, but that money is transferred multiple times, each time, being ‘held’ by the banks. Oh, what a lovely scam.
And how can they improve profitability in these uncertain times? INCREASE THE HOLDING TIME.
Who is watching this? who is controlling this?
Shockingly, nobody (that I know of)
Ahhh, the wonders of insurance. 1
Our washing machine has started to make startling and alarming noises, so Wendy phoned British Gas.
Not strange, we have insurance cover for many of our whitegoods and plumbing with them.
While arranging a visit for the washing machine the good little telephone person asked Wendy if we had insurance to cover our mains water supply. She replied no. Wendy then passed the phone to me, to see if I wanted to add this cover to our current contract.
Having had a problem with my water supply in a previous property I was interested. So, the operator went through the boilerplate she was required to.
When she got to what was excluded from cover….
Damage caused by tree roots.
Damage caused by third parties.
Accidental damage.
Hmmmm….. so, what is actually LEFT?
What could happen that WOULD be covered?
Not much really.
Maybe if I took a pickaxe to the thing myself….
But not, if it attacked by someone else, or a tree root damages it or a meteorite hits it (is that an accident or act of god? blame is essential?!)
So, nope, I will not be paying to guard my mains water supply from acts of self.
art meets television. 1
And, unlike here in the west where television wins by totally destroying the art, in the Ukraine, art wins. Refreshing and wonderful.
Please, follow this link
yes, Yes, YES....... *YES* *YES* *YES* 1
hehehe, now I have your attention….
A friend posted a link to a computerworld article
Reading that, I could not help but point at the screen every few paragraphs and shout “YES”.
Dead on. A must read.