Top "Decorator" questions

Decorator is an object-oriented design pattern that allows adding behavior to existing classes in a dynamic fashion.

Why does calling the security authentication property `principal.displayName` in a decorator throw an exception?

Is there a reason why calling the security authentication property principal.displayName in a decorator would cause a problem? I'm …

java spring spring-security decorator sitemesh
What is the difference between a mixin and the decorator pattern?

The Decorator Pattern is dynamic extension-at-runtime of classes. It dynamically forms a is-a relationship. I started to wonder if I …

language-agnostic decorator mixins
Numpy vectorize as a decorator with arguments

I tried to vectorize (agreed, not the most efficient way to do it, but my question is rather on the …

python numpy decorator python-decorators
Do overridden methods inherit decorators in python?

Just like the title says, do overridden methods inherit decorators? class A: @memoized def fun(self, arg): return None class …

python inheritance decorator
How to use the user_passes_test decorator in class based views?

I am trying to check certain conditions before the user is allowed to see a particular user settings page. I …

python django python-2.7 decorator python-decorators
Currying decorator in python

I am trying to write a currying decorator in python, and I think I've got the general idea down, but …

python decorator currying
Zend Framework forms, decorators and validation: should I go back to plain HTML?

I am currently working on a pretty large application which contains a lot of forms. Up to this moment, I …

php zend-framework zend-form decorator
Check if a function uses @classmethod

TL;DR How do I find out whether a function was defined using @classmethod or something with the same effect? …

python decorator class-method python-decorators
When do we need decorator pattern?

When is it necessary to use the decorator pattern? If possible, give me a real world example that is well-suited …

design-patterns decorator
Why do I need to decorate login_required decorator with @method_decorator

I am trying to understand the code for the mixins posted at this blog post. These mixins call the login_…

django decorator django-class-based-views login-required