February 2009
2 posts
1 tag
Creating Static Methods In Python
Static methods can be a little confusing if you come to Python from other languages in which they are first class citizens. To create a static method you need to pass an existing method through staticmethod(): class Person: people = {} def __init__(self, name): self.name = name Person.people[self.name] = self def find_by_name(name): return Person.people.get(name) find_by_name...
Feb 13th
1 tag
Rails 2.2 Templates
TemplateHandlers have been significantly overhauled in Rails 2.2, and these changes are not backwards-compatible with Rails 2.1. Instead of being responsible for rendering a template, TemplateHandlers should now provide a string of Ruby that will be eval’ed by ActionView further along the rendering chain. So, where previously a TemplateHandler might have declared a render method: class...
Feb 1st