Decorator common form (in conjunction with decorator takeoff version of view)

In the inner () function : #  combination decorator off version of view

1.inner () function, add a new function (execution) before being decorative functions such as user logins

2.inner () function, add a new function (performed) as the browser is closed after being decorative function, disconnect from the database

3. decorated function before and after new features are added (execution) as it takes time for the statistics to be decorated function

4.inner () function, did not add any new features, direct reference to the original function, the equivalent of an empty decorator,

    Decorative calls are empty loading function is to call the original function as its own: Log decorator, avoid duplication login ( example to be updated )

Guess you like

Origin www.cnblogs.com/bigbox/p/11854467.html