Questions tagged as 'decorator-pattern'

1
answer

How decorators work in Python?

@Elizeu Santos asked in the Portuguese Python group of facebook the following:    "Talk to people, I'm studying python and something I'm not understanding   are the decorators. I faced them doing the flask tuition, they can   make me clear up...
asked by 06.07.2014 / 05:39
1
answer

Understanding the pythonic way of dealing with properties

I'm trying to figure out how this python properties issue works. But the problem is that in all the net tutorials out there I only find the damn example with only one attribute. I'm looking for an example where you have more to do with day to da...
asked by 01.07.2015 / 01:56
1
answer

Field handling in the Model before writing to the database (Python + Django)

I am trying to perform a password encryption using Python 3.7 and Django 2.1. Looking at the Python documentation, Django and some answers here in StackOverflow, I came up with the code as follows, however, the password field is written blank...
asked by 31.08.2018 / 13:46
1
answer

How to use the modules and decorator NgModule?

I have questions about how to use the NgModule decorators. What are they and what are they for? How to create a separate module to load one or more libraries and components? For example, one to load the dependencies and elements of...
asked by 05.08.2018 / 23:56
0
answers

Decorator Pattern with Repository Pattern

I have a need here and I'm having a hard time implementing I have an application with Decorator Pattern and would like to update the data of my components by taking the information directly from the database, but I am not finding a legal way to...
asked by 13.10.2015 / 18:45
0
answers

Accessing private property with decorator in typescript

In Typescript, is it possible to access a private property by the decorator? An example of the code I've already done class A { @dec private _teste: string = 'teste' constructor(){} public get teste() { return this._teste...
asked by 02.01.2019 / 23:31
0
answers

Reflection with property decorator in typescript does not work

I'm trying to create a decorator (NonExportable) to tell which fields in a class should not be exported. Here is the code: nonexportable-decorators.ts const NON_EXPORTABLE_KEY = Symbol("NonExportable"); export default function NonExporta...
asked by 14.03.2017 / 19:51
1
answer

Recursions in closures

# -*- coding: utf-8 -*- def memoize(limit, *, message = 'Limit exceded'): count = 0 def inner(func): cache = {} def wrapped(number): nonlocal count if count < limit: if number no...
asked by 05.04.2018 / 15:13
1
answer

How to use two decorator APIs in Appweb Flask

I'm new to the programming world and I'm looking forward to a more in-depth web application. I made a resquests of a json dictionary of two different api. IwanttoputthisdatascrapingintoatableinmyindexpagesoI'mnotsurehowtodothiswithtwoapi....
asked by 27.09.2018 / 22:50
1
answer

How to share methods between presenters in Ruby on Rails 4

I would like to add methods to my template through a Presenter, but some methods are shared among other presenters. Ex: os métodos 'pode_ser_mostrado?', 'pode_ser_editado?', 'pode_ser_excluido?' What is the best way, to create a base pres...
asked by 18.01.2015 / 05:11