Dynamically extending object behaviour in Ruby and Python – a quick...
In path-to, the seemingly innocuous expressions app.users['dojo'].articles['behind-the-scenes'].edit app.user('dojo') are relying on behaviour that is added dynamically. Here, users, articles, edit and...
View ArticleAlternative URI Templates implementation in Python; fun with decorators
I’ve added uri_templates.py to the described_routes-py repository. Feature-wise, it differs from Joe’s in that it supports a partial expansion mode (see this post for motivation)....
View ArticleProgrammatically adding methods to classes and objects: more Ruby/Python...
In Dynamically extending object behaviour in Ruby and Python we explored techniques for extending object behaviour dynamically by catching calls to undefined methods and having the target objects...
View ArticleDRY up your routes – a Pylons routing refactoring
[See UPDATES] This post is in several acts, each one a refactoring. Taking the stage will be some familiar-looking application code; behind the scenes lurks some enhanced framework code that makes the...
View ArticleFun with parameter-collecting proxies
Further inspired by the Routes submapper idea (see DRY up your routes) here’s a generic proxy object that collects arguments repeated across method calls: class Params(object): def __init__(self, obj,...
View Article
More Pages to Explore .....