Top "Decorator" questions

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

How to create a Python decorator that can be used either with or without parameters?

I'd like to create a Python decorator that can be used either with parameters: @redirect_output("somewhere.log") def foo(): .... …

python decorator
how to do a conditional decorator in python

Is it possible to decorator a function conditionally. For example, I want to decorate the function foo() with a timer …

python conditional decorator python-decorators
Builder Vs Decorator pattern

From When would you use the Builder Pattern?, It is said that builder pattern is appropriate for Pizza example. Why …

oop design-patterns decorator builder
Flask: Decorator to verify JSON and JSON Schema

I have a flask application with calls expecting JSON payload. Before each call is processed, I have a 2-step error …

python flask decorator jsonschema python-decorators
Attaching a decorator to all functions within a class

I don't really need to do this, but was just wondering, is there a way to bind a decorator to …

python class oop decorator class-method
Zend Framework 2 - Form Element Decorators

I want to force the Zend form into Twitter Bootstrap style. I currently iterate through the form fields and write …

php zend-form decorator zend-framework2 zend-form-element
How do I use ViewScripts on Zend_Form File Elements?

I am using this ViewScript for my standard form elements: <div class="field" id="field_<?php echo $this-&…

zend-framework zend-form decorator zend-view zend-form-element
celery task and customize decorator

I'm working on a project using django and celery(django-celery). Our team decided to wrap all data access code within (…

python django decorator celery django-celery
How do I use and apply JavaScript decorators?

I am trying to understand how to use decorators in a very simple piece of code, so I can apply …

node.js decorator ecmascript-next
Multiple decorators for a view in Django: Execution order

I am trying to decorate a Django view by two decorators, one for checking login, and one for checking is_…

python django decorator