--- a/src/pyams_utils/property.py Tue Nov 15 10:43:55 2016 +0100
+++ b/src/pyams_utils/property.py Fri Nov 18 15:28:54 2016 +0100
@@ -36,8 +36,7 @@
class cached(object):
- """Custom property decorator to define a property or function
- which is calculated only once
+ """Custom property decorator to define a property or function which is calculated only once
When applied on a function, caching is based on input arguments
"""
@@ -58,8 +57,9 @@
class cached_property(object):
- """A read-only @property decorator that is only evaluated once. The value is cached
- on the object itself rather than the function or class; this should prevent
+ """A read-only property decorator that is only evaluated once.
+
+ The value is cached on the object itself rather than the function or class; this should prevent
memory leakage.
"""
def __init__(self, fget, doc=None):
@@ -83,6 +83,10 @@
If not request is currently running, a new one is created.
`key` is a required argument; if None, the key will be the method's object
+
+ :param str key: session's value key; if *None*, the key will be the method's object; if *key* is a callable
+ object, it will be called to get the actual session key
+ :param prefix: str; prefix to use for session key; if *None*, the prefix will be the property name
"""
def request_decorator(func):
@@ -111,8 +115,10 @@
If no request is currently running, a new one is created.
- @app: application identifier used to prefix session keys
- @key: session's value key; if None, the key will be the method's object
+ :param str app: application identifier used to prefix session keys
+ :param str key: session's value key; if *None*, the key will be the method's object; if *key* is a callable
+ object, il will be called to get the actual session key
+ :param prefix: str; prefix to use for session key; if *None*, the prefix will be the property name
"""
def session_decorator(func):